Skip to content

Commit a049662

Browse files
committed
Integrated Qt deployapi into CMakeLists script.
1 parent 4c4ff8a commit a049662

3 files changed

Lines changed: 26 additions & 6 deletions

File tree

‎.github/workflows/build_windows.yml‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ jobs:
4343
cd build
4444
cmake .. -DBUILD_TESTS=1
4545
cmake --build . --config $BUILD_TYPE --target DegateTests
46-
./vcpkg_installed/x64-windows/tools/Qt6/bin/windeployqt.exe ./tests/out/bin/$BUILD_TYPE
4746
cd tests/out/bin/$BUILD_TYPE
4847
./DegateTests.exe
4948

‎CMakeLists.txt‎

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ set(LIBS ${Boost_LIBRARIES})
124124
############# Qt
125125
find_package(Qt6 COMPONENTS Core Widgets Gui Xml OpenGL OpenGLWidgets Concurrent LinguistTools REQUIRED)
126126
set(LIBS ${LIBS} Qt6::Widgets Qt6::Gui Qt6::Core Qt6::Xml Qt6::OpenGL Qt6::OpenGLWidgets Qt6::Concurrent)
127+
qt_standard_project_setup()
127128

128129

129130
############################################################################
@@ -226,14 +227,14 @@ endif ()
226227
#
227228
# Link DegateCore
228229
#
229-
add_library(DegateCore STATIC ${SRC_FILES} res/resources.qrc res/qdarkstyle/style.qrc ${CMAKE_BINARY_DIR}/translations.qrc ${TRANSLATION_FILES} ${QM_FILES} "Degate version")
230-
target_link_libraries(DegateCore ${LIBS})
230+
qt_add_library(DegateCore STATIC ${SRC_FILES} res/resources.qrc res/qdarkstyle/style.qrc ${CMAKE_BINARY_DIR}/translations.qrc ${TRANSLATION_FILES} ${QM_FILES} "Degate version")
231+
target_link_libraries(DegateCore PRIVATE ${LIBS})
231232

232233
#
233234
# Link main (Degate)
234235
#
235-
add_executable(Degate "src/Main.cc" res/resources.qrc res/qdarkstyle/style.qrc ${CMAKE_BINARY_DIR}/translations.qrc ${TRANSLATION_FILES} ${QM_FILES} "res/resource.rc")
236-
target_link_libraries(Degate ${LIBS} DegateCore)
236+
qt_add_executable(Degate "src/Main.cc" res/resources.qrc res/qdarkstyle/style.qrc ${CMAKE_BINARY_DIR}/translations.qrc ${TRANSLATION_FILES} ${QM_FILES} "res/resource.rc")
237+
target_link_libraries(Degate PRIVATE ${LIBS} DegateCore)
237238

238239
#
239240
# Activate bundle for MacOS.
@@ -245,6 +246,16 @@ set_target_properties(Degate PROPERTIES MACOSX_BUNDLE TRUE)
245246
#
246247
install (TARGETS Degate DESTINATION out/bin)
247248

249+
#
250+
# Automatic Qt deploy
251+
#
252+
qt_generate_deploy_app_script(
253+
TARGET Degate
254+
OUTPUT_SCRIPT deploy_script
255+
NO_UNSUPPORTED_PLATFORM_ERROR
256+
)
257+
install(SCRIPT ${deploy_script})
258+
248259
#
249260
# Output specifications
250261
#

‎tests/CMakeLists.txt‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ file(GLOB_RECURSE TEST_SRC_FILES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" LIST_DIR
3737
#
3838
# Link
3939
#
40-
add_executable(DegateTests ${TEST_SRC_FILES})
40+
qt_add_executable(DegateTests ${TEST_SRC_FILES})
4141
target_link_libraries(DegateTests PRIVATE ${LIBS} DegateCore Catch2::Catch2)
4242

4343
#
@@ -50,6 +50,16 @@ set_target_properties(DegateTests
5050
RUNTIME_OUTPUT_DIRECTORY "out/bin"
5151
)
5252

53+
#
54+
# Automatic Qt deploy
55+
#
56+
qt_generate_deploy_app_script(
57+
TARGET DegateTests
58+
OUTPUT_SCRIPT deploy_script
59+
NO_UNSUPPORTED_PLATFORM_ERROR
60+
)
61+
install(SCRIPT ${deploy_script})
62+
5363
#
5464
# Link Catch2 tests to CTest
5565
#

0 commit comments

Comments
 (0)