From 4662d08d4bf9115231d5b00514cf52f076924aee Mon Sep 17 00:00:00 2001 From: Andrew Tribick Date: Sat, 15 Jun 2024 19:48:27 +0200 Subject: [PATCH] Package Windows artifacts from install target --- .github/workflows/ci.yml | 50 ++++++++++++++++++++++++++------- CMakeLists.txt | 7 ++++- src/celestia/qt6/CMakeLists.txt | 25 +++++++++++++---- 3 files changed, 65 insertions(+), 17 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d6f84da0069..c244edc9112 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -110,6 +110,7 @@ jobs: -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake" ` -DVCPKG_TARGET_TRIPLET=${{matrix.platform}}-windows ` -DCMAKE_GENERATOR_PLATFORM="$GeneratorPlatform" ` + -DCMAKE_INSTALL_PREFIX="${{github.workspace}}/install" ` -DENABLE_SPICE=ON ` -DENABLE_TOOLS=ON ` -DENABLE_TESTS=ON ` @@ -131,23 +132,52 @@ jobs: working-directory: ${{github.workspace}}/build run: ctest -C ${{env.BUILD_TYPE}} - - name: Run winqtdeploy + - name: Install Windows shell: pwsh - working-directory: ${{github.workspace}}/build/src/celestia run: | - & "$env:VCPKG_INSTALLATION_ROOT/installed/${{matrix.platform}}-windows/tools/Qt6/bin/windeployqt.exe" qt6\${{env.BUILD_TYPE}}\celestia-qt6.exe + cmake --install ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --component core + cmake --install ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --component wingui + Rename-Item -Path "install" -NewName "install-wingui" - - name: Upload artifacts + - name: Upload Windows GUI uses: actions/upload-artifact@v4 if: success() with: - name: celestia-windows-${{matrix.platform}} + name: celestia-windows-${{matrix.platform}}-wingui + if-no-files-found: error path: | - ${{github.workspace}}/build/src/**/*.exe - ${{github.workspace}}/build/src/**/*.dll - ${{github.workspace}}/build/po/**/*.gmo - ${{github.workspace}}/build/tools/**/*.exe - ${{github.workspace}}/shaders/*.glsl + ${{github.workspace}}/install-wingui/ + + - name: Install Qt6 + shell: pwsh + run: | + cmake --install ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --component core + cmake --install ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --component qt6gui + Rename-Item -Path "install" -NewName "install-qt6gui" + + - name: Upload Qt6 GUI + uses: actions/upload-artifact@v4 + if: success() + with: + name: celestia-windows-${{matrix.platform}}-qt6gui + if-no-files-found: error + path: | + ${{github.workspace}}/install-qt6gui/ + + - name: Install tools + shell: pwsh + run: | + cmake --install ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --component tools + Rename-Item -Path "install" -NewName "install-tools" + + - name: Upload tools + uses: actions/upload-artifact@v4 + if: success() + with: + name: celestia-windows-${{matrix.platform}}-tools + if-no-files-found: error + path: | + ${{github.workspace}}/install-tools/ build-posix: name: "${{matrix.config.os}}" diff --git a/CMakeLists.txt b/CMakeLists.txt index e6fd37548d3..b88eb09e8ae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,9 @@ -cmake_minimum_required(VERSION 3.9) +if(WIN32) + # Require more recent CMake on Windows because DLLs are a pain + cmake_minimum_required(VERSION 3.19) +else() + cmake_minimum_required(VERSION 3.9) +endif() option(LEGACY_OPENGL_LIBS "Use legacy OpenGL libraries instead of glvnd library (Default: off)" OFF) diff --git a/src/celestia/qt6/CMakeLists.txt b/src/celestia/qt6/CMakeLists.txt index 0a8a71d0ec6..af08e146ac2 100644 --- a/src/celestia/qt6/CMakeLists.txt +++ b/src/celestia/qt6/CMakeLists.txt @@ -36,11 +36,23 @@ if(APPLE) set_property(TARGET celestia-qt6 APPEND_STRING PROPERTY LINK_FLAGS " -framework CoreServices") endif() -install( - TARGETS celestia-qt6 - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - COMPONENT qt6gui -) +if(WIN32) + install( + TARGETS celestia-qt6 + RUNTIME_DEPENDENCIES + PRE_EXCLUDE_REGEXES "^api-ms" "^ext-ms-" + POST_EXCLUDE_REGEXES ".*system32/.*\\.dll$" + DIRECTORIES $ + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + COMPONENT qt6gui + ) +else() + install( + TARGETS celestia-qt6 + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + COMPONENT qt6gui + ) +endif() if(ENABLE_LTO) set_target_properties(celestia-qt6 PROPERTIES INTERPROCEDURAL_OPTIMIZATION ON) @@ -50,10 +62,11 @@ if(WIN32) qt6_generate_deploy_app_script(TARGET celestia-qt6 OUTPUT_SCRIPT deploy-celestia-qt6 NO_UNSUPPORTED_PLATFORM_ERROR + NO_COMPILER_RUNTIME NO_TRANSLATIONS ) install( - SCRIPT "${deploy-celestia-qt6}" + SCRIPT ${deploy-celestia-qt6} COMPONENT qt6gui ) endif()