mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Adapt build to CMake's CMP0167 policy
This is a little awkward because libloot only needs Boost's headers, but it doesn't supply a CMake config unless it's built, so we build the system stub to make that happen as quickly as possible.
This commit is contained in:
+40
-14
@@ -41,14 +41,27 @@ jobs:
|
||||
LIBLOOT_SAFE_DESC_REF=${LIBLOOT_DESC_REF//[\/<>\"|]/_}
|
||||
echo "version=$LIBLOOT_SAFE_DESC_REF" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Download Boost
|
||||
id: get-boost
|
||||
- name: Get Boost metadata
|
||||
id: boost-metadata
|
||||
run: |
|
||||
BOOST_BASENAME=boost_${BOOST_VERSION//./_}
|
||||
wget https://archives.boost.io/release/${BOOST_VERSION}/source/${BOOST_BASENAME}.tar.gz
|
||||
tar -xf ${BOOST_BASENAME}.tar.gz
|
||||
BOOST_ROOT="${{ github.workspace }}/boost_${BOOST_VERSION//./_}"
|
||||
echo "root=$BOOST_ROOT" >> $GITHUB_OUTPUT
|
||||
|
||||
echo "root=${BOOST_BASENAME}" >> $GITHUB_OUTPUT
|
||||
- name: Boost cache
|
||||
id: boost-cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
${{ steps.boost-metadata.outputs.root }}/boost
|
||||
${{ steps.boost-metadata.outputs.root }}/stage
|
||||
key: ${{ runner.os }}-Boost-${{ env.BOOST_VERSION }}
|
||||
|
||||
# Need to build Boost's 'system' stub to generate the CMake config file.
|
||||
- name: Download & build Boost
|
||||
run: |
|
||||
curl -sSfLO https://raw.githubusercontent.com/Ortham/ci-scripts/2.2.1/install_boost.py
|
||||
python install_boost.py --directory ${{ github.workspace }} --boost-version $BOOST_VERSION -a 64 system
|
||||
if: steps.boost-cache.outputs.cache-hit != 'true'
|
||||
|
||||
- name: Install APT package dependencies
|
||||
run: |
|
||||
@@ -64,7 +77,7 @@ jobs:
|
||||
- name: Run CMake
|
||||
run: |
|
||||
cmake \
|
||||
-DBOOST_ROOT="${{ steps.get-boost.outputs.root }}" \
|
||||
-DCMAKE_PREFIX_PATH="${{ steps.boost-metadata.outputs.root }}\stage" \
|
||||
-DCPACK_PACKAGE_VERSION="${{ steps.get-libloot-version.outputs.version }}" \
|
||||
-B build
|
||||
cmake --build build
|
||||
@@ -138,14 +151,27 @@ jobs:
|
||||
- name: Install Rust i686-pc-windows-msvc target
|
||||
run: rustup target add i686-pc-windows-msvc
|
||||
|
||||
- name: Download Boost
|
||||
id: get-boost
|
||||
- name: Get Boost metadata
|
||||
id: boost-metadata
|
||||
run: |
|
||||
$BOOST_BASENAME="boost_" + $env:BOOST_VERSION -replace "\.", "_"
|
||||
curl -sSfLO "https://archives.boost.io/release/${env:BOOST_VERSION}/source/${BOOST_BASENAME}.7z"
|
||||
7z x "${BOOST_BASENAME}.7z"
|
||||
$BOOST_ROOT="${{ github.workspace }}/boost_" + $env:BOOST_VERSION -replace "\.", "_"
|
||||
echo "root=$BOOST_ROOT" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
|
||||
|
||||
echo "root=$BOOST_BASENAME" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
|
||||
- name: Boost cache
|
||||
id: boost-cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
${{ steps.boost-metadata.outputs.root }}/boost
|
||||
${{ steps.boost-metadata.outputs.root }}/stage
|
||||
key: ${{ runner.os }}-x64-Boost-${{ env.BOOST_VERSION }}
|
||||
|
||||
# Need to build Boost's 'system' stub to generate the CMake config file.
|
||||
- name: Download & build Boost
|
||||
run: |
|
||||
curl -sSfLO https://raw.githubusercontent.com/Ortham/ci-scripts/2.2.1/install_boost.py
|
||||
python install_boost.py --directory ${{ github.workspace }} --boost-version ${{ env.BOOST_VERSION }} -a 64 system
|
||||
if: steps.boost-cache.outputs.cache-hit != 'true'
|
||||
|
||||
- name: Get descriptive libloot version
|
||||
id: get-libloot-version
|
||||
@@ -160,7 +186,7 @@ jobs:
|
||||
run: |
|
||||
cmake -G "Visual Studio 16 2019" `
|
||||
-A ${{ matrix.platform }} `
|
||||
-DBOOST_ROOT="${{ steps.get-boost.outputs.root }}" `
|
||||
-DCMAKE_PREFIX_PATH="${{ steps.boost-metadata.outputs.root }}\stage" `
|
||||
-DCPACK_PACKAGE_VERSION="${{ steps.get-libloot-version.outputs.version }}" `
|
||||
-B build
|
||||
cmake --build build --config ${{ env.MSVC_CONFIG }}
|
||||
|
||||
@@ -62,20 +62,33 @@ jobs:
|
||||
- name: Install Rust i686-pc-windows-msvc target
|
||||
run: rustup target add i686-pc-windows-msvc
|
||||
|
||||
- name: Download Boost
|
||||
id: get-boost
|
||||
- name: Get Boost metadata
|
||||
id: boost-metadata
|
||||
run: |
|
||||
$BOOST_BASENAME="boost_" + $env:BOOST_VERSION -replace "\.", "_"
|
||||
curl -sSfLO "https://archives.boost.io/release/${env:BOOST_VERSION}/source/${BOOST_BASENAME}.7z"
|
||||
7z x "${BOOST_BASENAME}.7z"
|
||||
$BOOST_ROOT="${{ github.workspace }}/boost_" + $env:BOOST_VERSION -replace "\.", "_"
|
||||
echo "root=$BOOST_ROOT" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
|
||||
|
||||
echo "root=$BOOST_BASENAME" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
|
||||
- name: Boost cache
|
||||
id: boost-cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
${{ steps.boost-metadata.outputs.root }}/boost
|
||||
${{ steps.boost-metadata.outputs.root }}/stage
|
||||
key: ${{ runner.os }}-x64-Boost-${{ env.BOOST_VERSION }}
|
||||
|
||||
# Need to build Boost's 'system' stub to generate the CMake config file.
|
||||
- name: Download & build Boost
|
||||
run: |
|
||||
curl -sSfLO https://raw.githubusercontent.com/Ortham/ci-scripts/2.2.1/install_boost.py
|
||||
python install_boost.py --directory ${{ github.workspace }} --boost-version ${{ env.BOOST_VERSION }} -a 64 system
|
||||
if: steps.boost-cache.outputs.cache-hit != 'true'
|
||||
|
||||
- name: Run CMake
|
||||
run: |
|
||||
cmake -G "Visual Studio 16 2019" `
|
||||
-A ${{ matrix.platform }} `
|
||||
-DBOOST_ROOT="${{ steps.get-boost.outputs.root }}" `
|
||||
-DCMAKE_PREFIX_PATH="${{ steps.boost-metadata.outputs.root }}\stage" `
|
||||
-DCPACK_PACKAGE_VERSION="${{ needs.create_release.outputs.git_tag }}" `
|
||||
-B build
|
||||
cmake --build build --config ${{ env.MSVC_CONFIG }}
|
||||
|
||||
+4
-2
@@ -2,6 +2,9 @@ cmake_minimum_required(VERSION 3.24)
|
||||
if(POLICY CMP0135)
|
||||
cmake_policy(SET CMP0135 NEW)
|
||||
endif()
|
||||
if(POLICY CMP0167)
|
||||
cmake_policy(SET CMP0167 NEW)
|
||||
endif()
|
||||
project(libloot)
|
||||
include(ExternalProject)
|
||||
include(FetchContent)
|
||||
@@ -46,6 +49,7 @@ configure_file("${CMAKE_SOURCE_DIR}/src/api/loot_version.cpp.in" "${CMAKE_BINARY
|
||||
set(Boost_USE_STATIC_LIBS ON)
|
||||
set(Boost_USE_MULTITHREADED ON)
|
||||
set(Boost_USE_STATIC_RUNTIME OFF)
|
||||
find_package(Boost REQUIRED CONFIG)
|
||||
|
||||
if(NOT DEFINED RUST_TARGET AND WIN32)
|
||||
if(MSVC)
|
||||
@@ -72,8 +76,6 @@ else()
|
||||
set(RUST_CLEANUP_COMMAND ${CMAKE_COMMAND} -E rm -r "target/release/build" "target/release/deps")
|
||||
endif()
|
||||
|
||||
find_package(Boost REQUIRED)
|
||||
|
||||
if(NOT CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
find_package(ICU REQUIRED COMPONENTS data uc)
|
||||
find_package(TBB REQUIRED)
|
||||
|
||||
Reference in New Issue
Block a user