@@ -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
5279Pop-Location
0 commit comments