From e21a3c7955f4774b24859aec711f1cd27333d452 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Wed, 17 Nov 2021 07:51:55 +0200 Subject: [PATCH] effects: Add support for cross-compiling support kwin-strip-effect-metadata needs to run on the host. First, one needs to build it, e.g. cmake --build build-native --target kwin-strip-effect-metadata then when cross-compiling, point cmake to the native build directory, e.g. cmake -DKWIN_HOST_TOOLING=${path}/build-native --- src/effects/CMakeLists.txt | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/effects/CMakeLists.txt b/src/effects/CMakeLists.txt index af36adf8fa..288e49fe50 100644 --- a/src/effects/CMakeLists.txt +++ b/src/effects/CMakeLists.txt @@ -3,8 +3,21 @@ add_definitions(-DTRANSLATION_DOMAIN=\"kwin_effects\" -DEFFECT_BUILTINS) include_directories(${KWin_SOURCE_DIR}/src) # for xcbutils.h -add_executable(kwin-strip-effect-metadata strip-effect-metadata.cpp) -target_link_libraries(kwin-strip-effect-metadata Qt5::Core) +if (CMAKE_CROSSCOMPILING) + if (NOT KWIN_HOST_TOOLING) + message(FATAL_ERROR "Please provide the path to a native build and pass -DKWIN_HOST_TOOLING=path") + endif() + find_file(KSEM_EXECUTABLE StripEffectMetadataTargets.cmake + PATHS ${KWIN_HOST_TOOLING} + NO_DEFAULT_PATH + NO_CMAKE_FIND_ROOT_PATH) + include(${KSEM_EXECUTABLE}) +else() + add_executable(kwin-strip-effect-metadata strip-effect-metadata.cpp) + target_link_libraries(kwin-strip-effect-metadata Qt5::Core) + # Export the kwin-strip-effect-metadata target to a file, so it can be used by another build. + export(TARGETS kwin-strip-effect-metadata FILE ${CMAKE_BINARY_DIR}/StripEffectMetadataTargets.cmake) +endif() function (kwin_strip_builtin_effect_metadata target metadata) set(stripped_metadata "${CMAKE_CURRENT_BINARY_DIR}/${metadata}.stripped")