Skip to content

Commit

Permalink
Clean up CMakePresets and fix Windows build
Browse files Browse the repository at this point in the history
* Removed duplication in CMakePresets conda stuff
* Made the inheritance logic in CMakePresets clear
* Explicit set VCPKG_ROOT and add our vcpkg directory to PATH due to changes in Visual Studio 17.6
  • Loading branch information
qc00 committed Jun 7, 2023
1 parent b751626 commit 5bd1244
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 158 deletions.
19 changes: 11 additions & 8 deletions .github/workflows/build_steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,6 @@ jobs:
version: "~= 22.8"
src: "./python"

- name: Extra envs
run: |
. build_tooling/vcpkg_caching.sh # Linux follower needs another call in CIBW
echo -e "VCPKG_BINARY_SOURCES=$VCPKG_BINARY_SOURCES\n${{matrix.envs || ''}}" | tee -a $GITHUB_ENV
cmake -P cpp/CMake/CpuCount.cmake | sed 's/^-- //' | tee -a $GITHUB_ENV
env:
CMAKE_BUILD_PARALLEL_LEVEL: ${{vars.CMAKE_BUILD_PARALLEL_LEVEL}}

- name: Configure sccache
uses: mozilla-actions/[email protected]
with:
Expand All @@ -88,6 +80,17 @@ jobs:
if: matrix.os == 'windows'
uses: ilammy/[email protected]

- name: Extra envs
# This has to come after msvc-dev-cmd to overwrite the bad VCPKG_ROOT it sets
run: |
. build_tooling/vcpkg_caching.sh # Linux follower needs another call in CIBW
echo -e "VCPKG_BINARY_SOURCES=$VCPKG_BINARY_SOURCES
VCPKG_ROOT=$PLATFORM_VCPKG_ROOT
${{matrix.envs || ''}}" | tee -a $GITHUB_ENV
cmake -P cpp/CMake/CpuCount.cmake | sed 's/^-- //' | tee -a $GITHUB_ENV
env:
CMAKE_BUILD_PARALLEL_LEVEL: ${{vars.CMAKE_BUILD_PARALLEL_LEVEL}}

# ========================= Leader steps =========================
- name: Prepare C++ compilation env
if: inputs.job_type != 'follower'
Expand Down
7 changes: 5 additions & 2 deletions build_tooling/vcpkg_caching.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
#!/bin/bash

pushd $(realpath $(dirname $BASH_SOURCE))/../cpp/vcpkg
export VCPKG_ROOT=`realpath $(dirname $BASH_SOURCE)/../cpp/vcpkg`

pushd $VCPKG_ROOT
PLATFORM_VCPKG_ROOT=`cygpath -wa . 2>/dev/null || pwd`

[[ -x vcpkg ]] || ./bootstrap-vcpkg.sh -disableMetrics
nuget="`which mono` `./vcpkg fetch nuget | tail -n 1`" # which mono will return empty on windows
nuget="`which mono 2>/dev/null` `./vcpkg fetch nuget | tail -n 1`" # which mono will return empty on windows
echo "Using nuget=$nuget"

VCPKG_BINARY_SOURCES="clear;nuget,github,readwrite"
Expand Down
213 changes: 67 additions & 146 deletions cpp/CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,71 +5,68 @@
"name": "common",
"hidden": true,
"description": "OS-agnostic config",
"toolchainFile": "vcpkg/scripts/buildsystems/vcpkg.cmake",
"binaryDir": "${sourceDir}/out/${presetName}-build",
"installDir": "${sourceDir}/out/install"
},
{
"name": "common_conda",
"hidden": true,
"description": "OS-agnostic config",
"binaryDir": "${sourceDir}/out/${presetName}-build",
"installDir": "${sourceDir}/out/install",
"cacheVariables": {
"ARCTICDB_USING_CONDA": "ON"
"CMAKE_BUILD_TYPE": "Debug"
}
},
{
"name": "windows-cl-release",
"displayName": "Windows x64 Release Cl",
"description": "Target Windows with the Visual Studio development environment.",
"name": "common_vcpkg",
"hidden": true,
"inherits": "common",
"generator": "Ninja",
"architecture": {
"value": "x64",
"strategy": "external"
},
"toolset": {
"value": "host=x64",
"strategy": "external"
},
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"CMAKE_C_COMPILER": "cl",
"CMAKE_CXX_COMPILER": "cl",
"VCPKG_TARGET_TRIPLET": "x64-windows-static"
},
"condition" : {
"type" : "allOf",
"conditions" : [
"toolchainFile": "vcpkg/scripts/buildsystems/vcpkg.cmake",
"condition": {
"type": "allOf",
"conditions": [
{
"type" : "equals",
"lhs" : "${hostSystemName}",
"rhs" : "Windows"
"lhs": "$env{ARCTICDB_USING_CONDA}",
"type": "notEquals",
"rhs": "1"
},
{
"type" : "notEquals",
"lhs" : "$env{ARCTICDB_USING_CONDA}",
"rhs" : "1"
"lhs": "${hostSystemName}",
"type": "equals",
"rhs": "$env{cmakepreset_expected_host_system}"
}
]
}
},
{
"name": "windows-cl-debug",
"displayName": "Windows x64 Debug",
"description": "Debug features enabled, but linked against release Python",
"inherits": "windows-cl-release",
"name": "common_conda",
"hidden": true,
"inherits": "common",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
"ARCTICDB_USING_CONDA": "ON"
},
"condition": {
"type": "allOf",
"conditions": [
{
"lhs": "$env{ARCTICDB_USING_CONDA}",
"type": "equals",
"rhs": "1"
},
{
"lhs": "${hostSystemName}",
"type": "equals",
"rhs": "$env{cmakepreset_expected_host_system}"
}
]
}
},


{
"name": "windows-cl-conda-release",
"displayName": "Windows x64 Release Cl",
"description": "Target Windows with the Visual Studio development environment.",
"inherits": "common_conda",
"name": "windows",
"hidden": true,
"generator": "Ninja",
"environment": {"cmakepreset_expected_host_system": "Windows"}
},
{
"name": "windows-cl-debug",
"inherits": ["common_vcpkg", "windows"],
"description": "Debug features enabled, but linked against release Python",
"architecture": {
"value": "x64",
"strategy": "external"
Expand All @@ -79,135 +76,59 @@
"strategy": "external"
},
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"CMAKE_C_COMPILER": "cl",
"CMAKE_CXX_COMPILER": "cl",
"VCPKG_TARGET_TRIPLET": "x64-windows-static"
},
"condition" : {
"type" : "allOf",
"conditions" : [
{
"type" : "equals",
"lhs" : "${hostSystemName}",
"rhs" : "Windows"
},
{
"type" : "equals",
"lhs" : "$env{ARCTICDB_USING_CONDA}",
"rhs" : "1"
}
]
}
},
{
"name": "windows-cl-conda-debug",
"displayName": "Windows x64 Debug",
"description": "Debug features enabled, but linked against release Python",
"inherits": "windows-cl-conda-release",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
}
"inherits": ["common_conda", "windows"]
},


{
"name": "linux-debug",
"displayName": "Linux x64 Debug",
"inherits": "common",
"name": "linux",
"hidden": true,
"generator": "Unix Makefiles",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_MAKE_PROGRAM": "make"
},
"condition" : {
"type" : "allOf",
"conditions" : [
{
"type" : "equals",
"lhs" : "${hostSystemName}",
"rhs" : "Linux"
},
{
"type" : "notEquals",
"lhs" : "$env{ARCTICDB_USING_CONDA}",
"rhs" : "1"
}
]
}
"environment": {"cmakepreset_expected_host_system": "Linux"}
},
{
"name": "linux-release",
"inherits": "linux-debug",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "RelWithDebInfo"
}
"name": "linux-debug",
"inherits": ["common_vcpkg", "linux"]
},
{
"name": "linux-conda-debug",
"displayName": "Linux x64 Debug",
"inherits": "common_conda",
"generator": "Unix Makefiles",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_MAKE_PROGRAM": "make"
},
"condition" : {
"type" : "allOf",
"conditions" : [
{
"type" : "equals",
"lhs" : "${hostSystemName}",
"rhs" : "Linux"
},
{
"type" : "equals",
"lhs" : "$env{ARCTICDB_USING_CONDA}",
"rhs" : "1"
}
]
}
"inherits": ["common_conda", "linux"]
},


{
"name": "linux-conda-release",
"inherits": "linux-conda-debug",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "RelWithDebInfo"
}
},
{
"name": "darwin-conda-debug",
"displayName": "Darwin Conda",
"inherits": "common_conda",
"name": "darwin",
"hidden": true,
"generator": "Unix Makefiles",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_MAKE_PROGRAM": "make",
"CMAKE_C_COMPILER": "clang",
"CMAKE_CXX_COMPILER": "clang",
"STATIC_LINK_STD_LIB": "OFF"
},
"condition" : {
"type" : "allOf",
"conditions" : [
{
"type" : "equals",
"lhs" : "${hostSystemName}",
"rhs" : "Darwin"
},
{
"type" : "equals",
"lhs" : "$env{ARCTICDB_USING_CONDA}",
"rhs" : "1"
}
]
}
"environment": {"cmakepreset_expected_host_system": "Darwin"}
},
{
"name": "darwin-conda-release",
"inherits": "darwin-conda-debug",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "RelWithDebInfo"
}
}
"name": "darwin-conda-debug",
"inherits": ["common_conda", "darwin"]
},


{ "name": "windows-cl-release", "inherits": "windows-cl-debug", "cacheVariables": { "CMAKE_BUILD_TYPE": "Release" }},
{ "name": "windows-cl-conda-release", "inherits": "windows-cl-conda-debug", "cacheVariables": { "CMAKE_BUILD_TYPE": "Release" } },
{ "name": "linux-release", "inherits": "linux-debug", "cacheVariables": { "CMAKE_BUILD_TYPE": "RelWithDebInfo" } },
{ "name": "linux-conda-release", "inherits": "linux-conda-debug", "cacheVariables": { "CMAKE_BUILD_TYPE": "RelWithDebInfo" } },
{ "name": "darwin-conda-release", "inherits": "darwin-conda-debug", "cacheVariables": { "CMAKE_BUILD_TYPE": "RelWithDebInfo" } }
],
"buildPresets": [
{"name": "windows-cl-debug", "configurePreset": "windows-cl-debug", "targets": "arcticdb_ext" },
Expand All @@ -219,6 +140,6 @@
{"name": "linux-conda-debug", "configurePreset": "linux-conda-debug", "targets": "arcticdb_ext" },
{"name": "linux-conda-release", "configurePreset": "linux-conda-release", "targets": "arcticdb_ext" },
{"name": "darwin-conda-debug", "configurePreset": "darwin-conda-debug", "targets": "arcticdb_ext" },
{"name": "darwin-codda-release", "configurePreset": "darwin-conda-release", "targets": "arcticdb_ext" }
{"name": "darwin-conda-release", "configurePreset": "darwin-conda-release", "targets": "arcticdb_ext" }
]
}
2 changes: 1 addition & 1 deletion cpp/vcpkg
Submodule vcpkg updated 979 files
1 change: 0 additions & 1 deletion cpp/vcpkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@
"name": "bitmagic",
"version": "7.12.3"
},
{ "name": "arrow", "version": "12.0.0" },
{ "name": "boost-algorithm", "version": "1.80.0#1" },
{ "name": "boost-align", "version": "1.80.0#1" },
{ "name": "boost-any", "version": "1.80.0#1" },
Expand Down

0 comments on commit 5bd1244

Please sign in to comment.