From 9f1c1da1aac3db18fb2940173effc7e5c1f1759b Mon Sep 17 00:00:00 2001 From: sithlord48 Date: Tue, 7 Jan 2025 14:33:36 -0500 Subject: [PATCH] build: unify finding of the qt deploy tool and detect if vcpkg for proper debug build call --- cmake/Libraries.cmake | 11 +++++++++++ deploy/mac/deploy.cmake | 5 +---- deploy/windows/deploy.cmake | 2 -- src/apps/deskflow-gui/CMakeLists.txt | 5 +++++ 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/cmake/Libraries.cmake b/cmake/Libraries.cmake index 29fc6e453..07760882d 100644 --- a/cmake/Libraries.cmake +++ b/cmake/Libraries.cmake @@ -33,6 +33,17 @@ macro(configure_libs) find_package(Qt6 ${REQUIRED_QT_VERSION} REQUIRED COMPONENTS Core Widgets Network) + #Define the location of qt deployment tool + if(WIN32) + if (CMAKE_BUILD_TYPE STREQUAL "Debug" AND NOT VCPKG_INSTALL_DIR STREQUAL "") + find_program(DEPLOYQT windeployqt.debug.bat) + else() + find_program(DEPLOYQT windeployqt) + endif() + elseif(APPLE) + find_program(DEPLOYQT macdeployqt) + endif() + message(STATUS "Qt version: ${Qt6_VERSION}") # TODO SSL check can happen in lib/net when don't have to deploy it any longer on windows diff --git a/deploy/mac/deploy.cmake b/deploy/mac/deploy.cmake index 82f52dcf4..2b9ea9521 100644 --- a/deploy/mac/deploy.cmake +++ b/deploy/mac/deploy.cmake @@ -5,11 +5,8 @@ # calling CMAKE_CURRENT_LIST_DIR after include would return the wrong scope var set(MY_DIR ${CMAKE_CURRENT_LIST_DIR}) -# Install depends into our staged copy -find_program(MACDEPLOYQT_BIN macdeployqt6) - install(CODE "execute_process(COMMAND - ${MACDEPLOYQT_BIN} + ${DEPLOYQT_BIN} \"\${CMAKE_INSTALL_PREFIX}/Deskflow.app\" -timestamp -codesign=- )") diff --git a/deploy/windows/deploy.cmake b/deploy/windows/deploy.cmake index 7e3311816..bc8f21a67 100644 --- a/deploy/windows/deploy.cmake +++ b/deploy/windows/deploy.cmake @@ -12,8 +12,6 @@ configure_file( ${PROJECT_BINARY_DIR}/src/version.rc @ONLY ) -# Install Qt Depends to stage -find_program(DEPLOYQT windeployqt6) install(CODE "execute_process( COMMAND ${DEPLOYQT} --no-compiler-runtime --no-system-d3d-compiler --no-quick-import -network \"\${CMAKE_INSTALL_PREFIX}/deskflow.exe\" )") diff --git a/src/apps/deskflow-gui/CMakeLists.txt b/src/apps/deskflow-gui/CMakeLists.txt index 8e1765340..4ceab872f 100644 --- a/src/apps/deskflow-gui/CMakeLists.txt +++ b/src/apps/deskflow-gui/CMakeLists.txt @@ -76,6 +76,11 @@ if(WIN32) ".*system32.*" RUNTIME DESTINATION . ) + + add_custom_command( + TARGET ${target} POST_BUILD + COMMAND ${DEPLOYQT} --no-compiler-runtime --no-system-d3d-compiler --no-quick-import -network $ + ) elseif(APPLE) set_target_properties(${target} PROPERTIES INSTALL_RPATH "@loader_path/../Libraries;@loader_path/../Frameworks"