Skip to content

Commit

Permalink
Use upstream vcpkg instead of our own vcpkg fork
Browse files Browse the repository at this point in the history
  • Loading branch information
dirkvdb committed Feb 12, 2025
1 parent 1313e8a commit 77c05e3
Show file tree
Hide file tree
Showing 10 changed files with 169 additions and 383 deletions.
104 changes: 54 additions & 50 deletions .github/workflows/vcpkg-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,54 +10,58 @@ jobs:
fail-fast: false
matrix:
cfg:
- { os: ubuntu-latest, triplet: x64-linux }
- { os: windows-latest, triplet: x64-windows-static-vs2022 }
- { os: macos-latest, triplet: arm64-osx }
- { os: macos-latest, triplet: x64-osx }
- { os: ubuntu-latest }
- { os: windows-latest }
- { os: macos-latest }
- { os: macos-latest }

steps:
- name: install python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Clone repository
uses: actions/checkout@v4
with:
submodules: true
- name: Install linux dependencies
if: ${{ runner.os == 'Linux' }}
run: sudo apt-get install nasm openssl ninja-build autoconf-archive
- name: Install osx dependencies
if: ${{ runner.os == 'macOS' }}
run: brew install nasm ninja automake autoconf autoconf-archive
- name: Cache vcpkg binary
id: cache-vcpkg-bin
uses: actions/cache@v4
with:
path: |
deps/vcpkg/vcpkg
deps/vcpkg/vcpkg.exe
key: ${{ runner.os }}-${{ hashFiles('deps/vcpkg/bootstrap.cmake') }}
- name: Cache vcpkg packages
id: cache-vcpkg
uses: actions/cache@v4
with:
path: |
~/.cache/vcpkg
~/AppData/Local/vcpkg/archives
key: ${{ runner.os }}-${{ matrix.cfg.triplet }}-${{ hashFiles('vcpkg.json', '.git/modules/deps/vcpkg/shallow') }}
- name: Bootstrap the ports
id: bootstrap
run: python bootstrap.py --triplet ${{ matrix.cfg.triplet }} --clean-after-build
- name: Build the code
run: python build.py --triplet ${{ matrix.cfg.triplet }} --run-tests --cpp20
- name: Archive build logs
if: ${{ failure() && steps.bootstrap.conclusion == 'failure' }}
uses: actions/upload-artifact@v4
with:
name: build-logs
path: |
deps/vcpkg/buildtrees/**/config*.log
deps/vcpkg/buildtrees/**/build*.log
deps/vcpkg/buildtrees/**/install*.log
deps/vcpkg/buildtrees/**/package*.log
env:
VCPKG_TAG: 2025.01.13

steps:
- name: Clone repository
uses: actions/checkout@v4
- name: Export GitHub Actions cache environment variables
uses: actions/github-script@v7
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- uses: seanmiddleditch/gha-setup-ninja@master
- name: Install vcpkg
run: |
git clone --depth 1 --branch ${{ env.VCPKG_TAG }} https://github.com/microsoft/vcpkg "${{ runner.TEMP }}/vcpkg"
- name: Bootstrap vcpkg windows
if: ${{ runner.os == 'Windows' }}
run: |
${{ runner.TEMP }}/vcpkg/bootstrap-vcpkg.bat
- name: Bootstrap vcpkg unix
if: ${{ runner.os == 'Linux' || runner.os == 'macOS' }}
run: |
sh ${{ runner.TEMP }}/vcpkg/bootstrap-vcpkg.sh
- uses: taiki-e/install-action@v2
with:
tool: just
- name: Install linux dependencies
if: ${{ runner.os == 'Linux' }}
run: sudo apt-get install nasm openssl
- name: Install osx dependencies
if: ${{ runner.os == 'macOS' }}
run: |
brew install nasm
- name: Bootstrap the ports
working-directory: ./cpp
run: just bootstrap
env:
VCPKG_ROOT: "${{ runner.temp }}/vcpkg"
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
- name: Build the code
env:
VCPKG_ROOT: "${{ runner.temp }}/vcpkg"
working-directory: ./cpp
run: just build
- name: Run the unit tests
env:
VCPKG_ROOT: "${{ runner.temp }}/vcpkg"
working-directory: ./cpp
run: just test
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
[submodule "deps/vcpkg"]
path = deps/vcpkg
url = https://github.com/VITObelgium/vcpkg-ports.git
8 changes: 3 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,9 @@ cmake_dependent_option(INFRA_UI_COMPONENTS_LOCATION "Location related qt ui comp
string(COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}" INFRA_IS_TOPLEVEL)

if(INFRA_IS_TOPLEVEL)
cmake_minimum_required(VERSION 3.21)
cmake_minimum_required(VERSION 3.28)

if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 20)
endif()
set(CMAKE_CXX_STANDARD 20)

if(INFRA_ENABLE_TESTS)
enable_testing()
Expand All @@ -55,7 +53,7 @@ if(INFRA_IS_TOPLEVEL)
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR})

message(STATUS "Toplevel infra build C++${CMAKE_CXX_STANDARD}")
set(CMAKE_REQUIRED_FLAGS ${CMAKE_CXX17_STANDARD_COMPILE_OPTION})
set(CMAKE_REQUIRED_FLAGS ${CMAKE_CXX20_STANDARD_COMPILE_OPTION})

if(MSVC OR(WIN32 AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "IntelLLVM"))
# avoid windows specific warnings
Expand Down
167 changes: 30 additions & 137 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,21 @@
{
"version": 5,
"cmakeMinimumRequired": {
"major": 3,
"minor": 21,
"patch": 0
},
"include": [
"deps/vcpkg/scripts/buildtools/CMakePresets.json"
],
"$schema": "https://cmake.org/cmake/help/latest/_downloads/3e2d73bff478d88a7de0de736ba5e361/schema.json",
"version": 8,
"configurePresets": [
{
"name": "multi",
"generator": "Ninja Multi-Config",
"hidden": true
"name": "vcpkg",
"cacheVariables": {
"CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
"VCPKG_MANIFEST_INSTALL": "OFF",
"VCPKG_INSTALLED_DIR": "${sourceDir}/vcpkg_installed"
}
},
{
"name": "vcpkg-base",
"inherits": "multi",
"hidden": true,
"binaryDir": "${sourceDir}/build/vcpkg",
"name": "default",
"binaryDir": "${sourceDir}/build",
"inherits": "vcpkg",
"generator": "Ninja Multi-Config",
"cacheVariables": {
"CMAKE_TOOLCHAIN_FILE": "${sourceDir}/deps/vcpkg/scripts/buildsystems/vcpkg.cmake",
"VCPKG_APPLOCAL_DEPS": "OFF",
"VCPKG_MANIFEST_MODE": "OFF",
"INFRA_LOGGING": "ON",
"INFRA_GDAL": "ON",
"INFRA_XML": "ON",
Expand All @@ -41,140 +34,40 @@
}
},
{
"name": "msvc",
"displayName": "MSVC x64",
"description": "64bit MSVC build",
"inherits": [
"vcpkg-base",
"triplet-x64-windows-static-vs2022"
],
"binaryDir": "${sourceDir}/build/vcpkg-msvc",
"name": "mac-arm",
"inherits": "default",
"cacheVariables": {
"VCPKG_INSTALLED_DIR": "${sourceDir}/vcpkgs-x64-windows-static-vs2022"
"VCPKG_TARGET_TRIPLET": "arm64-osx"
}
},
{
"name": "msvc-asan",
"displayName": "MSVC x64 ASAN",
"description": "Vcpkg build for x64 on windows with address sanitizer (MSVC)",
"inherits": [
"vcpkg-base",
"triplet-x64-windows-static-asan-vs2022"
],
"binaryDir": "${sourceDir}/build/vcpkg-msvc-asan",
"name": "mac-intel",
"inherits": "default",
"cacheVariables": {
"VCPKG_INSTALLED_DIR": "${sourceDir}/vcpkgs-x64-windows-static-asan-vs2022"
"VCPKG_TARGET_TRIPLET": "x64-osx"
}
},
{
"name": "arm64-osx",
"inherits": [
"vcpkg-base",
"triplet-arm64-osx"
],
"displayName": "Mac arm64",
"description": "Vcpkg build for arm64 on macOS",
"name": "windows",
"inherits": "default",
"generator": "Visual Studio 17 2022",
"cacheVariables": {
"VCPKG_INSTALLED_DIR": "${sourceDir}/vcpkgs-arm64-osx",
"VCPKG_ALLOW_SYSTEM_LIBS": "ON"
"VCPKG_TARGET_TRIPLET": "x64-windows-static",
"CMAKE_MSVC_RUNTIME_LIBRARY": "MultiThreaded$<$<CONFIG:Debug>:Debug>"
}
},
{
"name": "x64-osx",
"inherits": [
"vcpkg-base",
"triplet-x64-osx"
],
"displayName": "Mac x64",
"description": "Vcpkg build for x64 on mac"
},
{
"name": "arm64-linux",
"inherits": [
"vcpkg-base",
"triplet-arm64-linux"
],
"displayName": "arm64 Linux Docker",
"description": "Vcpkg build for arm64 on macOS",
"name": "linux",
"inherits": "default",
"cacheVariables": {
"VCPKG_INSTALLED_DIR": "/usr/vcpkgs-arm64-linux"
"VCPKG_TARGET_TRIPLET": "x64-linux"
}
}
],
"buildPresets": [
{
"name": "Debug Win",
"displayName": "Debug",
"configurePreset": "msvc",
"configuration": "Debug",
"inherits": [
"build-win-only"
]
},
{
"name": "Release Win",
"displayName": "Release",
"configurePreset": "msvc",
"configuration": "Release",
"inherits": [
"build-win-only"
]
},
{
"name": "ASAN",
"configurePreset": "msvc-asan",
"configuration": "Debug",
"inherits": [
"build-win-only"
]
},
{
"name": "Debug arm OSX",
"displayName": "Debug",
"configurePreset": "arm64-osx",
"configuration": "Debug",
"inherits": [
"build-mac-only"
]
},
{
"name": "Release arm OSX",
"displayName": "Release",
"configurePreset": "arm64-osx",
"configuration": "Release",
"inherits": [
"build-mac-only"
]
},
{
"name": "Debug docker arm64",
"displayName": "Debug",
"configurePreset": "arm64-linux",
"configuration": "Debug",
"inherits": [
"build-linux-only"
]
},
{
"name": "Release docker arm64",
"displayName": "Release",
"configurePreset": "arm64-linux",
"configuration": "Release",
"inherits": [
"build-linux-only"
]
}
],
"testPresets": [
{
"name": "default",
"configurePreset": "x64-windows-intel release",
"output": {
"outputOnFailure": true
},
"execution": {
"noTestsAction": "error",
"stopOnFailure": true
"name": "mac-arm-local",
"inherits": "mac-arm",
"environment": {
"VCPKG_ROOT": "${sourceDir}/../../vcpkg"
}
}
]
Expand Down
Loading

0 comments on commit 77c05e3

Please sign in to comment.