From 3f857bb284d3c8aa99bcd61980e0f0cab2dd8e19 Mon Sep 17 00:00:00 2001 From: Aki Date: Thu, 7 Mar 2024 23:59:51 +0100 Subject: Added gtest to the project and a stub test for showcase --- cmake/modules/GenerateEmulator.cmake | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 cmake/modules/GenerateEmulator.cmake (limited to 'cmake/modules/GenerateEmulator.cmake') diff --git a/cmake/modules/GenerateEmulator.cmake b/cmake/modules/GenerateEmulator.cmake new file mode 100644 index 0000000..f25ae5f --- /dev/null +++ b/cmake/modules/GenerateEmulator.cmake @@ -0,0 +1,21 @@ +# Generates and attaches new emulator wrapper for a TARGET for use with tests and custom target jobs. + +set(GENERATE_EMULATOR_TEMPLATE "${CMAKE_CURRENT_LIST_DIR}/wine.sh.in") +if(CMAKE_CROSSCOMPILING) + function(generate_emulator TARGET) + cmake_parse_arguments(PARSE_ARGV 1 GENERATE_EMULATOR "" "" "LIBS") + set(WINE_PREFIX "$ENV{HOME}/.wine-${TOOLCHAIN_PREFIX}") + set(WINE_PATH "${CMAKE_FIND_ROOT_PATH}/bin") + foreach(LIB IN ITEMS ${GENERATE_EMULATOR_LIBS}) + get_target_property(DIR ${LIB} BINARY_DIR) + list(PREPEND WINE_PATH "${DIR}") + endforeach() + set(EMULATOR "${CMAKE_CURRENT_BINARY_DIR}/wine") + configure_file("${GENERATE_EMULATOR_TEMPLATE}" "${EMULATOR}" @ONLY) + set_target_properties(${TARGET} PROPERTIES CROSSCOMPILING_EMULATOR "${EMULATOR}") + endfunction() +else() + function(generate_emulator TARGET) + # no-op + endfunction() +endif() -- cgit v1.1