From 50eb19afe1b3feb3b2ba45a832362da2aa3f266a Mon Sep 17 00:00:00 2001 From: Qi Chen Date: Wed, 7 Jun 2023 11:43:14 +0100 Subject: [PATCH] Clean up CMakePresets and fix Windows build * 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 --- .github/workflows/build_steps.yml | 19 +-- build_tooling/vcpkg_caching.sh | 7 +- cpp/CMakePresets.json | 213 ++++++++++-------------------- cpp/vcpkg | 2 +- cpp/vcpkg.json | 1 - 5 files changed, 84 insertions(+), 158 deletions(-) diff --git a/.github/workflows/build_steps.yml b/.github/workflows/build_steps.yml index e588903d1b..10c6e49f1e 100644 --- a/.github/workflows/build_steps.yml +++ b/.github/workflows/build_steps.yml @@ -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/sccache-action@v0.0.3 with: @@ -88,6 +80,17 @@ jobs: if: matrix.os == 'windows' uses: ilammy/msvc-dev-cmd@v1.12.1 + - 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' diff --git a/build_tooling/vcpkg_caching.sh b/build_tooling/vcpkg_caching.sh index 2974bbc97f..1e64346d40 100755 --- a/build_tooling/vcpkg_caching.sh +++ b/build_tooling/vcpkg_caching.sh @@ -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" diff --git a/cpp/CMakePresets.json b/cpp/CMakePresets.json index 556d5ecfdd..8379d60acb 100644 --- a/cpp/CMakePresets.json +++ b/cpp/CMakePresets.json @@ -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" @@ -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" }, @@ -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" } ] } diff --git a/cpp/vcpkg b/cpp/vcpkg index d4d39d71b3..7505916685 160000 --- a/cpp/vcpkg +++ b/cpp/vcpkg @@ -1 +1 @@ -Subproject commit d4d39d71b3e6dd7536592c36ab2f7e84a8a64942 +Subproject commit 75059166857a374297e5edd6e1e7a60912907a46 diff --git a/cpp/vcpkg.json b/cpp/vcpkg.json index 5392c34d4c..ed9da11bb0 100644 --- a/cpp/vcpkg.json +++ b/cpp/vcpkg.json @@ -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" },