From 0990c2632b8ead324158e23c5fc6d9ce49dfe5c8 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Sat, 18 Nov 2023 15:05:35 +0800 Subject: [PATCH] GHA CI: link to C libraries dynamically The C libraries is now updated by the OS and therefore there is no reason to bundle static versions which might be outdated later. Also enable Control Flow Guard for 3rd party libraries. --- .github/workflows/ci_windows.yaml | 38 +++++++++++++++++-------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/.github/workflows/ci_windows.yaml b/.github/workflows/ci_windows.yaml index 5f3ae4ccc..e6aeb4bd6 100644 --- a/.github/workflows/ci_windows.yaml +++ b/.github/workflows/ci_windows.yaml @@ -22,6 +22,7 @@ jobs: env: boost_path: "${{ github.workspace }}/../boost" libtorrent_path: "${{ github.workspace }}/libtorrent" + vpkg_triplet_path: "${{ github.workspace }}/../triplets_overlay" steps: - name: Checkout repository @@ -42,29 +43,32 @@ jobs: vcpkgDirectory: C:/vcpkg doNotUpdateVcpkg: true # the preinstalled vcpkg is updated regularly - - name: Install dependencies from vcpkg + - name: Install dependencies with vcpkg run: | - # tell vcpkg to only build Release variants of the dependencies + # create our own triplet New-Item ` - -Path "${{ github.workspace }}" ` - -Name "triplets_overlay" ` - -ItemType Directory - Copy-Item ` - "${{ env.RUNVCPKG_VCPKG_ROOT }}/triplets/x64-windows-static.cmake" ` - "${{ github.workspace }}/triplets_overlay/x64-windows-static-release.cmake" + -Force ` + -ItemType File ` + -Path "${{ env.vpkg_triplet_path }}/x64-windows-static-md-release.cmake" Add-Content ` - "${{ github.workspace }}/triplets_overlay/x64-windows-static-release.cmake" ` - -Value "set(VCPKG_BUILD_TYPE release)" + -Path "${{ env.vpkg_triplet_path }}/x64-windows-static-md-release.cmake" ` + -Value @("set(VCPKG_TARGET_ARCHITECTURE x64)", + "set(VCPKG_LIBRARY_LINKAGE static)", + "set(VCPKG_CRT_LINKAGE dynamic)", + "set(VCPKG_BUILD_TYPE release)", + "set(VCPKG_C_FLAGS /guard:cf)", + "set(VCPKG_CXX_FLAGS /guard:cf)", + "set(VCPKG_LINKER_FLAGS /guard:cf)") # clear buildtrees after each package installation to reduce disk space requirements $packages = ` - "openssl:x64-windows-static-release", - "zlib:x64-windows-static-release" + "openssl:x64-windows-static-md-release", + "zlib:x64-windows-static-md-release" ${{ env.RUNVCPKG_VCPKG_ROOT }}/vcpkg.exe upgrade ` - --overlay-triplets="${{ github.workspace }}/triplets_overlay" ` - --no-dry-run + --no-dry-run ` + --overlay-triplets="${{ env.vpkg_triplet_path }}" ${{ env.RUNVCPKG_VCPKG_ROOT }}/vcpkg.exe install ` - --overlay-triplets="${{ github.workspace }}/triplets_overlay" ` --clean-after-build ` + --overlay-triplets="${{ env.vpkg_triplet_path }}" ` $packages - name: Install boost @@ -104,7 +108,7 @@ jobs: -DBUILD_SHARED_LIBS=OFF ` -Ddeprecated-functions=OFF ` -Dstatic_runtime=OFF ` - -DVCPKG_TARGET_TRIPLET=x64-windows-static-release + -DVCPKG_TARGET_TRIPLET=x64-windows-static-md-release cmake --build build cmake --install build @@ -122,7 +126,7 @@ jobs: -DMSVC_RUNTIME_DYNAMIC=ON ` -DQT6=ON ` -DTESTING=ON ` - -DVCPKG_TARGET_TRIPLET=x64-windows-static-release ` + -DVCPKG_TARGET_TRIPLET=x64-windows-static-md-release ` -DVERBOSE_CONFIGURE=ON ` --graphviz=build/target_graph.dot cmake --build build --target qbt_update_translations