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.
This commit is contained in:
Chocobo1 2023-11-18 15:05:35 +08:00
parent ba5229a069
commit 0990c2632b

View file

@ -22,6 +22,7 @@ jobs:
env: env:
boost_path: "${{ github.workspace }}/../boost" boost_path: "${{ github.workspace }}/../boost"
libtorrent_path: "${{ github.workspace }}/libtorrent" libtorrent_path: "${{ github.workspace }}/libtorrent"
vpkg_triplet_path: "${{ github.workspace }}/../triplets_overlay"
steps: steps:
- name: Checkout repository - name: Checkout repository
@ -42,29 +43,32 @@ jobs:
vcpkgDirectory: C:/vcpkg vcpkgDirectory: C:/vcpkg
doNotUpdateVcpkg: true # the preinstalled vcpkg is updated regularly doNotUpdateVcpkg: true # the preinstalled vcpkg is updated regularly
- name: Install dependencies from vcpkg - name: Install dependencies with vcpkg
run: | run: |
# tell vcpkg to only build Release variants of the dependencies # create our own triplet
New-Item ` New-Item `
-Path "${{ github.workspace }}" ` -Force `
-Name "triplets_overlay" ` -ItemType File `
-ItemType Directory -Path "${{ env.vpkg_triplet_path }}/x64-windows-static-md-release.cmake"
Copy-Item `
"${{ env.RUNVCPKG_VCPKG_ROOT }}/triplets/x64-windows-static.cmake" `
"${{ github.workspace }}/triplets_overlay/x64-windows-static-release.cmake"
Add-Content ` Add-Content `
"${{ github.workspace }}/triplets_overlay/x64-windows-static-release.cmake" ` -Path "${{ env.vpkg_triplet_path }}/x64-windows-static-md-release.cmake" `
-Value "set(VCPKG_BUILD_TYPE release)" -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 # clear buildtrees after each package installation to reduce disk space requirements
$packages = ` $packages = `
"openssl:x64-windows-static-release", "openssl:x64-windows-static-md-release",
"zlib:x64-windows-static-release" "zlib:x64-windows-static-md-release"
${{ env.RUNVCPKG_VCPKG_ROOT }}/vcpkg.exe upgrade ` ${{ 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 ` ${{ env.RUNVCPKG_VCPKG_ROOT }}/vcpkg.exe install `
--overlay-triplets="${{ github.workspace }}/triplets_overlay" `
--clean-after-build ` --clean-after-build `
--overlay-triplets="${{ env.vpkg_triplet_path }}" `
$packages $packages
- name: Install boost - name: Install boost
@ -104,7 +108,7 @@ jobs:
-DBUILD_SHARED_LIBS=OFF ` -DBUILD_SHARED_LIBS=OFF `
-Ddeprecated-functions=OFF ` -Ddeprecated-functions=OFF `
-Dstatic_runtime=OFF ` -Dstatic_runtime=OFF `
-DVCPKG_TARGET_TRIPLET=x64-windows-static-release -DVCPKG_TARGET_TRIPLET=x64-windows-static-md-release
cmake --build build cmake --build build
cmake --install build cmake --install build
@ -122,7 +126,7 @@ jobs:
-DMSVC_RUNTIME_DYNAMIC=ON ` -DMSVC_RUNTIME_DYNAMIC=ON `
-DQT6=ON ` -DQT6=ON `
-DTESTING=ON ` -DTESTING=ON `
-DVCPKG_TARGET_TRIPLET=x64-windows-static-release ` -DVCPKG_TARGET_TRIPLET=x64-windows-static-md-release `
-DVERBOSE_CONFIGURE=ON ` -DVERBOSE_CONFIGURE=ON `
--graphviz=build/target_graph.dot --graphviz=build/target_graph.dot
cmake --build build --target qbt_update_translations cmake --build build --target qbt_update_translations