CI: windows get boost via vcpkg

Dieser Commit ist enthalten in:
Reinder Feenstra 2024-12-18 00:01:24 +01:00
Ursprung 7f64511cc3
Commit 2da8b112b2
5 geänderte Dateien mit 59 neuen und 4 gelöschten Zeilen

Datei anzeigen

@ -164,6 +164,8 @@ jobs:
build-server:
name: server ${{matrix.config.name}}
runs-on: ${{matrix.config.os}}
env:
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
strategy:
fail-fast: false
matrix:
@ -285,6 +287,22 @@ jobs:
with:
submodules: recursive
- 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 || '');
- name: Set VCPKG_ROOT
uses: actions/github-script@v7
with:
script: |
if(core.isWindows)
{
core.exportVariable('VCPKG_ROOT', process.env.VCPKG_INSTALLATION_ROOT || '');
}
# Ubuntu only:
- name: apt update
if: startswith(matrix.config.os, 'ubuntu')

Datei anzeigen

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.9)
cmake_minimum_required(VERSION 3.15)
include(../shared/traintastic.cmake)
project(traintastic-server VERSION ${TRAINTASTIC_VERSION} DESCRIPTION "Traintastic server")
include(GNUInstallDirs)
@ -194,6 +194,15 @@ file(GLOB TEST_SOURCES
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DENABLE_LOG_DEBUG")
### VCPKG
if(DEFINED ENV{VCPKG_ROOT})
message(STATUS "Using VCPKG (VCPKG_ROOT=$ENV{VCPKG_ROOT})")
if(WIN32)
set(VCPKG_TARGET_TRIPLET "x64-windows-static-md")
endif()
include($ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake)
endif()
### OPTIONS ###
if(NO_LOCALHOST_ONLY_SETTING)
@ -285,7 +294,7 @@ if(WIN32 AND NOT MSVC)
endif()
# boost
if(LINUX)
if(LINUX OR WIN32)
find_package(Boost 1.81 REQUIRED COMPONENTS program_options)
target_include_directories(traintastic-server SYSTEM PRIVATE ${Boost_INCLUDE_DIRS})

Datei anzeigen

@ -29,7 +29,9 @@ Sha1::Digest Sha1::of(const std::string& value)
boost::uuids::detail::sha1 sha1;
sha1.process_bytes(value.c_str(), value.size());
Digest digest;
sha1.get_digest(digest.m_hash);
boost::uuids::detail::sha1::digest_type tmp;
sha1.get_digest(tmp);
std::memcpy(digest.m_hash, tmp, sizeof(tmp)); // FIXME: get rid of this copy
return digest;
}
@ -51,6 +53,8 @@ Sha1::Digest Sha1::of(const std::filesystem::path& filename)
return Digest::null();
Digest digest;
sha1.get_digest(digest.m_hash);
boost::uuids::detail::sha1::digest_type tmp;
sha1.get_digest(tmp);
std::memcpy(digest.m_hash, tmp, sizeof(tmp)); // FIXME: get rid of this copy
return digest;
}

Datei anzeigen

@ -0,0 +1,14 @@
{
"default-registry": {
"kind": "git",
"baseline": "b322364f06308bdd24823f9d8f03fe0cc86fd46f",
"repository": "https://github.com/microsoft/vcpkg"
},
"registries": [
{
"kind": "artifact",
"location": "https://github.com/microsoft/vcpkg-ce-catalog/archive/refs/heads/main.zip",
"name": "microsoft"
}
]
}

10
server/vcpkg.json Normale Datei
Datei anzeigen

@ -0,0 +1,10 @@
{
"dependencies": [
"boost-asio",
"boost-beast",
"boost-program-options",
"boost-random",
"boost-signals2",
"boost-uuid"
]
}