aboutsummaryrefslogtreecommitdiff
path: root/src/mock/wine
diff options
context:
space:
mode:
authorJan200101 <sentrycraft123@gmail.com>2021-06-06 17:10:10 +0200
committerJan200101 <sentrycraft123@gmail.com>2021-06-06 17:10:10 +0200
commit537994756d80178bdaf25e96968f34d2e144797f (patch)
treea093dfc43a8487c5866808e74e7250a6818cf6e0 /src/mock/wine
parentdf1df2929646abd77955b80e3ded3574ac005179 (diff)
downloadpolecat-537994756d80178bdaf25e96968f34d2e144797f.tar.gz
polecat-537994756d80178bdaf25e96968f34d2e144797f.zip
fix win env, add proper mocking code to test implementation
Diffstat (limited to 'src/mock/wine')
-rw-r--r--src/mock/wine/CMakeLists.txt35
-rw-r--r--src/mock/wine/main.c8
2 files changed, 43 insertions, 0 deletions
diff --git a/src/mock/wine/CMakeLists.txt b/src/mock/wine/CMakeLists.txt
new file mode 100644
index 0000000..8275b27
--- /dev/null
+++ b/src/mock/wine/CMakeLists.txt
@@ -0,0 +1,35 @@
+SET(WINE_SOURCES
+ ${CMAKE_CURRENT_SOURCE_DIR}/main.c
+)
+
+set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/mock/bin")
+file(MAKE_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
+
+set(WINE_TAR_DIR "${CMAKE_CURRENT_BINARY_DIR}")
+set(WINE_TAR_DIR "${WINE_TAR_DIR}" PARENT_SCOPE)
+
+add_executable(wine ${WINE_SOURCES})
+target_compile_options(wine PUBLIC ${CFLAGS})
+
+
+set(WINE_TAR_FILE_NAME "wine-mock.tar.xz")
+set(WINE_TAR_FILE "${WINE_TAR_DIR}/${WINE_TAR_FILE_NAME}")
+string(REGEX REPLACE "\\.| |-" "_" WINE_TAR_FILE_NAME ${WINE_TAR_FILE_NAME})
+set(WINE_TAR_OUT "${WINE_TAR_DIR}/${WINE_TAR_FILE_NAME}")
+set(WINE_TAR_OUT "${WINE_TAR_OUT}" PARENT_SCOPE)
+add_custom_command(
+ OUTPUT ${WINE_TAR_FILE}
+ COMMAND
+ ${CMAKE_COMMAND} -E tar "cfv" "${WINE_TAR_FILE}" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}"
+ DEPENDS wine
+)
+
+add_custom_command(
+ OUTPUT ${WINE_TAR_OUT}.c ${WINE_TAR_OUT}.h
+ COMMAND ${CMAKE_COMMAND}
+ "-Dbin_in=${WINE_TAR_FILE}"
+ -P ${CMAKE_SOURCE_DIR}/cmake/FileEmbed.cmake
+ DEPENDS ${WINE_TAR_FILE}
+)
+
+add_custom_target(wine_tar ALL DEPENDS ${WINE_TAR_OUT}.c ${WINE_TAR_OUT}.h) \ No newline at end of file
diff --git a/src/mock/wine/main.c b/src/mock/wine/main.c
new file mode 100644
index 0000000..5b9c25f
--- /dev/null
+++ b/src/mock/wine/main.c
@@ -0,0 +1,8 @@
+#include <stdio.h>
+
+int main(int argc, char** argv)
+{
+ for (int i = 0; i < argc; ++i)
+ printf("%s ", argv[i]);
+ puts("");
+} \ No newline at end of file