Skip to content

Commit 0cc2702

Browse files
committed
try setting Debug and cxx standard on windows.
1 parent a5d9618 commit 0cc2702

File tree

2 files changed

+41
-14
lines changed

2 files changed

+41
-14
lines changed

.github/workflows/cmake_install.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
runs-on: windows-2022
1414
env:
1515
CXX_STANDARD: '17'
16-
VCPKG_BUILD_TYPE: "debug"
16+
VCPKG_BUILD_TYPE: "Debug"
1717
steps:
1818
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1919
with:
@@ -32,7 +32,7 @@ jobs:
3232
runs-on: windows-2019
3333
env:
3434
CXX_STANDARD: '14'
35-
VCPKG_BUILD_TYPE: "debug"
35+
VCPKG_BUILD_TYPE: "Debug"
3636
steps:
3737
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3838
with:

ci/setup_windows_ci_environment.ps1

Lines changed: 39 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,54 @@ $VCPKG_DIR = (Get-Item -Path ".\").FullName
1111
./bootstrap-vcpkg.bat
1212
./vcpkg integrate install
1313

14-
$buildType = $env:VCPKG_BUILD_TYPE
15-
if ($buildType) {
16-
Write-Host "Using build type: $buildType"
17-
$VCPKG_BUILD_TYPE_ARG = "-DVCPKG_BUILD_TYPE=$buildType"
14+
if ($env:CXX_STANDARD) {
15+
[int]$CXX_STANDARD = [int]$env:CXX_STANDARD
16+
Write-Host "CXX_STANDARD environment variable set: using $CXX_STANDARD"
1817
} else {
19-
Write-Host "No build type provided; using default multi-config build."
20-
$VCPKG_BUILD_TYPE_ARG = ""
18+
[int]$CXX_STANDARD = 14
19+
Write-Host "CXX_STANDARD not set: defaulting to $CXX_STANDARD"
20+
}
21+
22+
[string]$BUILD_TYPE = $null
23+
24+
if ($env:BUILD_TYPE) {
25+
$BUILD_TYPE = $env:BUILD_TYPE
26+
Write-Host "BUILD_TYPE environment variable set: using $BUILD_TYPE"
27+
} else {
28+
Write-Host "BUILD_TYPE not set: defaulting to multi-config"
29+
}
30+
31+
# Assemble common CMake options
32+
$CMAKE_OPTIONS = @(
33+
"-DCMAKE_CXX_STANDARD=$CXX_STANDARD",
34+
"-DCMAKE_CXX_STANDARD_REQUIRED=ON",
35+
"-DCMAKE_CXX_EXTENSIONS=OFF"
36+
)
37+
38+
# Add build-type flags if single-config is requested
39+
if ($BUILD_TYPE) {
40+
$CMAKE_OPTIONS += "-DVCPKG_BUILD_TYPE=$BUILD_TYPE"
41+
$CMAKE_OPTIONS += "-DCMAKE_BUILD_TYPE=$BUILD_TYPE"
42+
}
43+
44+
# Display final CMake arguments
45+
Write-Host "CMake arguments to pass:"
46+
foreach ($opt in $CMAKE_OPTIONS) {
47+
Write-Host " $opt"
2148
}
2249

2350
# Google Benchmark
24-
./vcpkg "--vcpkg-root=$VCPKG_DIR" install benchmark:x64-windows --x-cmake-args="$VCPKG_BUILD_TYPE_ARG"
51+
./vcpkg "--vcpkg-root=$VCPKG_DIR" install benchmark:x64-windows --x-cmake-args="$CMAKE_OPTIONS"
2552

2653
# Google Test
27-
./vcpkg "--vcpkg-root=$VCPKG_DIR" install gtest:x64-windows --x-cmake-args="$VCPKG_BUILD_TYPE_ARG"
54+
./vcpkg "--vcpkg-root=$VCPKG_DIR" install gtest:x64-windows --x-cmake-args="$CMAKE_OPTIONS"
2855

2956
# nlohmann-json
30-
./vcpkg "--vcpkg-root=$VCPKG_DIR" install nlohmann-json:x64-windows --x-cmake-args="$VCPKG_BUILD_TYPE_ARG"
57+
./vcpkg "--vcpkg-root=$VCPKG_DIR" install nlohmann-json:x64-windows --x-cmake-args="$CMAKE_OPTIONS"
3158

3259
# grpc with custom CMake arguments
3360
./vcpkg "--vcpkg-root=$VCPKG_DIR" install grpc:x64-windows `
34-
--x-cmake-args="$VCPKG_BUILD_TYPE_ARG `
61+
--x-cmake-args="$CMAKE_OPTIONS `
3562
-DgRPC_INSTALL=ON `
3663
-DgRPC_BUILD_TESTS=OFF `
3764
-DgRPC_BUILD_GRPC_CPP_PLUGIN=ON `
@@ -44,9 +71,9 @@ if ($buildType) {
4471
-DgRPC_BUILD_GRPCPP_OTEL_PLUGIN=OFF"
4572

4673
# curl
47-
./vcpkg "--vcpkg-root=$VCPKG_DIR" install curl:x64-windows --x-cmake-args="$VCPKG_BUILD_TYPE_ARG"
74+
./vcpkg "--vcpkg-root=$VCPKG_DIR" install curl:x64-windows --x-cmake-args="$CMAKE_OPTIONS"
4875

4976
# prometheus-cpp
50-
./vcpkg "--vcpkg-root=$VCPKG_DIR" install prometheus-cpp:x64-windows --x-cmake-args="$VCPKG_BUILD_TYPE_ARG"
77+
./vcpkg "--vcpkg-root=$VCPKG_DIR" install prometheus-cpp:x64-windows --x-cmake-args="$CMAKE_OPTIONS"
5178

5279
Pop-Location

0 commit comments

Comments
 (0)