Skip to content

Commit

Permalink
Use Ninja in Windows CI and explicitly set the VS toolset version.
Browse files Browse the repository at this point in the history
  • Loading branch information
teo-tsirpanis committed Feb 27, 2024
1 parent a99e86c commit ee5b8c7
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 12 deletions.
34 changes: 23 additions & 11 deletions .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,22 @@ jobs:
TILEDB_ARROW_TESTS: ${{ matrix.TILEDB_ARROW_TESTS }}
TILEDB_WEBP: ${{ matrix.TILEDB_WEBP }}
TILEDB_CMAKE_BUILD_TYPE: 'Release'
# On windows-2019 we are using the Visual Studio generator, which is multi-config and places the build artifacts in a subdirectory
CONFIG_PATH_FIXUP: ${{ matrix.os == 'windows-2019' && 'Release' || '' }}
VCPKG_BINARY_SOURCES: 'clear;x-gha,readwrite'
steps:
# By default Visual Studio chooses the earliest installed toolset version
# for the main build and vcpkg chooses the latest. Force it to use the
# latest (14.39 currently).
- name: Setup MSVC toolset (VS 2022)
uses: TheMrMilchmann/setup-msvc-dev@v3
if: matrix.os == 'windows-2022'
with:
arch: x64
toolset: 14.39
- name: Install Ninja (VS 2022)
uses: seanmiddleditch/gha-setup-ninja@v4
if: matrix.os == 'windows-2022'
- name: 'tiledb env prep'
run: |
$env:BUILD_BUILDDIRECTORY = $env:GITHUB_WORKSPACE.replace("TileDB\TileDB","tdbbd") # 't'ile'db' 'b'uild 'd'ir
Expand Down Expand Up @@ -141,7 +155,7 @@ jobs:
# allow double-checking path
cmd /c "echo $PATH"
$bootstrapOptions = $env:TILEDB_BASE_BOOTSTRAP_OPTIONS
$bootstrapOptions = $env:TILEDB_BASE_BOOTSTRAP_OPTIONS + " -CMakeGenerator ${{ matrix.os == 'windows-2022' && 'Ninja' || '`"Visual Studio 16 2019`"' }}"
if ($env:TILEDB_S3 -eq "ON") {
$bootstrapOptions = "-EnableS3 " + $bootstrapOptions
}
Expand Down Expand Up @@ -239,9 +253,7 @@ jobs:
}
# CMake exits with non-0 status if there are any warnings during the build, so
cmake --build $env:BUILD_BUILDDIRECTORY\tiledb -j --target tiledb_unit --config $CMakeBuildType -- /verbosity:minimal
cmake --build $env:BUILD_BUILDDIRECTORY\tiledb -j --target tiledb_regression --config $CMakeBuildType -- /verbosity:minimal
cmake --build $env:BUILD_BUILDDIRECTORY\tiledb -j --target all_link_complete --config $CMakeBuildType -- /verbosity:minimal
cmake --build $env:BUILD_BUILDDIRECTORY\tiledb -j --target tiledb_unit tiledb_regression all_link_complete --config $CMakeBuildType
if ($env:TILEDB_AZURE -eq "ON") {
if($env.TILEDB_USE_CUSTOM_NODE_JS) {
Expand Down Expand Up @@ -272,15 +284,15 @@ jobs:
# Actually run tests
$cmds = "$env:BUILD_BUILDDIRECTORY\tiledb\test\$CMakeBuildType\tiledb_unit.exe -d=yes"
$cmds = "$env:BUILD_BUILDDIRECTORY\tiledb\test\$env:CONFIG_PATH_FIXUP\tiledb_unit.exe -d=yes"
Write-Host "cmds: '$cmds'"
Invoke-Expression $cmds
if ($LastExitCode -ne 0) {
Write-Host "Tests failed. tiledb_unit exit status: " $LastExitCocde
$host.SetShouldExit($LastExitCode)
}
$cmds = "$env:BUILD_BUILDDIRECTORY\tiledb\test\ci\$CMakeBuildType\test_assert.exe -d=yes"
$cmds = "$env:BUILD_BUILDDIRECTORY\tiledb\test\ci\$env:CONFIG_PATH_FIXUP\test_assert.exe -d=yes"
Invoke-Expression $cmds
if ($LastExitCode -ne 0) {
Write-Host "Tests failed. test_assert exit status: " $LastExitCocde
Expand All @@ -302,7 +314,7 @@ jobs:
$TestAppDir = (Join-Path $env:BUILD_BUILDDIRECTORY "tiledb\examples\c_api")
$TestAppDataDir = (Join-Path $env:BUILD_BUILDDIRECTORY "tiledb\examples\c_api\test_app_data")
Get-ChildItem (Join-Path $env:BUILD_BUILDDIRECTORY "tiledb\examples\c_api\$CMakeBuildType") -Filter *.exe |
Get-ChildItem (Join-Path $env:BUILD_BUILDDIRECTORY "tiledb\examples\c_api\$env:CONFIG_PATH_FIXUP\") -Filter *.exe |
Foreach-Object {
try {
Set-Location -path $TestAppDir
Expand Down Expand Up @@ -335,7 +347,7 @@ jobs:
$TestAppDir = (Join-Path $env:BUILD_BUILDDIRECTORY "tiledb\examples\cpp_api")
$TestAppDataDir = (Join-Path $env:BUILD_BUILDDIRECTORY "tiledb\examples\cpp_api\test_app_data")
Get-ChildItem (Join-Path $env:BUILD_BUILDDIRECTORY "tiledb\examples\cpp_api\$CMakeBuildType") -Filter *.exe |
Get-ChildItem (Join-Path $env:BUILD_BUILDDIRECTORY "tiledb\examples\cpp_api\$env:CONFIG_PATH_FIXUP\") -Filter *.exe |
Foreach-Object {
try {
Set-Location -path $TestAppDir
Expand Down Expand Up @@ -380,12 +392,12 @@ jobs:
cd build
# Build zip artifact
cmake -A X64 -DCMAKE_PREFIX_PATH="$env:BUILD_BUILDDIRECTORY\dist;$env:BUILD_BUILDDIRECTORY\vcpkg_installed\x64-windows" ..
cmake ${{ matrix.os != 'windows-2019' && '-G Ninja' || '' }} -DCMAKE_BUILD_TYPE="$CMakeBuildType" -DCMAKE_PREFIX_PATH="$env:BUILD_BUILDDIRECTORY\dist;$env:BUILD_BUILDDIRECTORY\vcpkg_installed\x64-windows" ..
cmake --build . --config $CMakeBuildType -v
#.\$CMakeBuildType\ExampleExe.exe
$cmd = ".\$CMakeBuildType\ExampleExe.exe"
#.\$env:CONFIG_PATH_FIXUP\ExampleExe.exe
$cmd = ".\$env:CONFIG_PATH_FIXUP\ExampleExe.exe"
Write-Host "cmd: '$cmd'"
Invoke-Expression $cmd
Expand Down
11 changes: 10 additions & 1 deletion bootstrap.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ Specify the linkage type to build TileDB with. Valid values are
.PARAMETER RemoveDeprecations
Build TileDB without any deprecated APIs.
.PARAMETER Architecture
Specify the architecture to configure for.
.PARAMETER CMakeGenerator
Optionally specify the CMake generator string, e.g. "Visual Studio 15
2017". Check 'cmake --help' for a list of supported generators.
Expand Down Expand Up @@ -128,6 +131,7 @@ Param(
[string]$Dependency,
[string]$Linkage = "shared",
[switch]$RemoveDeprecations,
[string]$Architecture,
[string]$CMakeGenerator,
[switch]$EnableAssert,
[switch]$EnableDebug,
Expand Down Expand Up @@ -327,6 +331,11 @@ if (![string]::IsNullOrEmpty($Dependency)) {
$DependencyDir = $Dependency
}

$ArchFlag = ""
if ($PSBoundParameters.ContainsKey("Architecture")) {
$ArchFlag = "-A $Architecture"
}

# Set CMake generator type.
$GeneratorFlag = ""
if ($PSBoundParameters.ContainsKey("CMakeGenerator")) {
Expand All @@ -348,7 +357,7 @@ if ($CMakeGenerator -eq $null) {

# Run CMake.
# We use Invoke-Expression so we can echo the command to the user.
$CommandString = "cmake -A X64 -DTILEDB_VCPKG=$UseVcpkg -DCMAKE_BUILD_TYPE=$BuildType -DCMAKE_INSTALL_PREFIX=""$InstallPrefix"" $VcpkgBaseTriplet -DCMAKE_PREFIX_PATH=""$DependencyDir"" -DMSVC_MP_FLAG=""/MP$BuildProcesses"" -DTILEDB_ASSERTIONS=$AssertionMode -DTILEDB_VERBOSE=$Verbosity -DTILEDB_AZURE=$UseAzure -DTILEDB_S3=$UseS3 -DTILEDB_GCS=$UseGcs -DTILEDB_SERIALIZATION=$UseSerialization -DTILEDB_WERROR=$Werror -DTILEDB_CPP_API=$CppApi -DTILEDB_TESTS=$Tests -DTILEDB_STATS=$Stats -DBUILD_SHARED_LIBS=$BuildSharedLibs -DTILEDB_FORCE_ALL_DEPS=$TileDBBuildDeps -DTILEDB_REMOVE_DEPRECATIONS=$_RemoveDeprecations -DTILEDB_TOOLS=$TileDBTools -DTILEDB_EXPERIMENTAL_FEATURES=$TileDBExperimentalFeatures -DTILEDB_WEBP=$BuildWebP -DTILEDB_CRC32=$BuildCrc32 -DTILEDB_ARROW_TESTS=$ArrowTests -DTILEDB_TESTS_ENABLE_REST=$RestTests -DTILEDB_TESTS_AWS_S3_CONFIG=$ConfigureS3 $GeneratorFlag ""$SourceDirectory"""
$CommandString = "cmake $ArchFlag -DTILEDB_VCPKG=$UseVcpkg -DCMAKE_BUILD_TYPE=$BuildType -DCMAKE_INSTALL_PREFIX=""$InstallPrefix"" $VcpkgBaseTriplet -DCMAKE_PREFIX_PATH=""$DependencyDir"" -DMSVC_MP_FLAG=""/MP$BuildProcesses"" -DTILEDB_ASSERTIONS=$AssertionMode -DTILEDB_VERBOSE=$Verbosity -DTILEDB_AZURE=$UseAzure -DTILEDB_S3=$UseS3 -DTILEDB_GCS=$UseGcs -DTILEDB_SERIALIZATION=$UseSerialization -DTILEDB_WERROR=$Werror -DTILEDB_CPP_API=$CppApi -DTILEDB_TESTS=$Tests -DTILEDB_STATS=$Stats -DBUILD_SHARED_LIBS=$BuildSharedLibs -DTILEDB_FORCE_ALL_DEPS=$TileDBBuildDeps -DTILEDB_REMOVE_DEPRECATIONS=$_RemoveDeprecations -DTILEDB_TOOLS=$TileDBTools -DTILEDB_EXPERIMENTAL_FEATURES=$TileDBExperimentalFeatures -DTILEDB_WEBP=$BuildWebP -DTILEDB_CRC32=$BuildCrc32 -DTILEDB_ARROW_TESTS=$ArrowTests -DTILEDB_TESTS_ENABLE_REST=$RestTests -DTILEDB_TESTS_AWS_S3_CONFIG=$ConfigureS3 $GeneratorFlag ""$SourceDirectory"""
Write-Host $CommandString
Write-Host
Invoke-Expression "$CommandString"
Expand Down

0 comments on commit ee5b8c7

Please sign in to comment.