Skip to content

Commit

Permalink
Integrated Qt deployapi into CMakeLists script.
Browse files Browse the repository at this point in the history
  • Loading branch information
DorianBDev committed Sep 24, 2024
1 parent 4c4ff8a commit a049662
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 deletions.
1 change: 0 additions & 1 deletion .github/workflows/build_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ jobs:
cd build
cmake .. -DBUILD_TESTS=1
cmake --build . --config $BUILD_TYPE --target DegateTests
./vcpkg_installed/x64-windows/tools/Qt6/bin/windeployqt.exe ./tests/out/bin/$BUILD_TYPE
cd tests/out/bin/$BUILD_TYPE
./DegateTests.exe
Expand Down
19 changes: 15 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ set(LIBS ${Boost_LIBRARIES})
############# Qt
find_package(Qt6 COMPONENTS Core Widgets Gui Xml OpenGL OpenGLWidgets Concurrent LinguistTools REQUIRED)
set(LIBS ${LIBS} Qt6::Widgets Qt6::Gui Qt6::Core Qt6::Xml Qt6::OpenGL Qt6::OpenGLWidgets Qt6::Concurrent)
qt_standard_project_setup()


############################################################################
Expand Down Expand Up @@ -226,14 +227,14 @@ endif ()
#
# Link DegateCore
#
add_library(DegateCore STATIC ${SRC_FILES} res/resources.qrc res/qdarkstyle/style.qrc ${CMAKE_BINARY_DIR}/translations.qrc ${TRANSLATION_FILES} ${QM_FILES} "Degate version")
target_link_libraries(DegateCore ${LIBS})
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")
target_link_libraries(DegateCore PRIVATE ${LIBS})

#
# Link main (Degate)
#
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")
target_link_libraries(Degate ${LIBS} DegateCore)
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")
target_link_libraries(Degate PRIVATE ${LIBS} DegateCore)

#
# Activate bundle for MacOS.
Expand All @@ -245,6 +246,16 @@ set_target_properties(Degate PROPERTIES MACOSX_BUNDLE TRUE)
#
install (TARGETS Degate DESTINATION out/bin)

#
# Automatic Qt deploy
#
qt_generate_deploy_app_script(
TARGET Degate
OUTPUT_SCRIPT deploy_script
NO_UNSUPPORTED_PLATFORM_ERROR
)
install(SCRIPT ${deploy_script})

#
# Output specifications
#
Expand Down
12 changes: 11 additions & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ file(GLOB_RECURSE TEST_SRC_FILES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" LIST_DIR
#
# Link
#
add_executable(DegateTests ${TEST_SRC_FILES})
qt_add_executable(DegateTests ${TEST_SRC_FILES})
target_link_libraries(DegateTests PRIVATE ${LIBS} DegateCore Catch2::Catch2)

#
Expand All @@ -50,6 +50,16 @@ set_target_properties(DegateTests
RUNTIME_OUTPUT_DIRECTORY "out/bin"
)

#
# Automatic Qt deploy
#
qt_generate_deploy_app_script(
TARGET DegateTests
OUTPUT_SCRIPT deploy_script
NO_UNSUPPORTED_PLATFORM_ERROR
)
install(SCRIPT ${deploy_script})

#
# Link Catch2 tests to CTest
#
Expand Down

0 comments on commit a049662

Please sign in to comment.