From 2a6474c04cce4f599e506e9f60eacf091875eaf7 Mon Sep 17 00:00:00 2001 From: Theodore Tsirpanis Date: Tue, 27 Feb 2024 12:18:25 +0200 Subject: [PATCH 1/2] Use Ninja in Windows CI and explicitly set the VS toolset version. --- .github/workflows/build-windows.yml | 34 +++++++++++++++++++---------- bootstrap.ps1 | 11 +++++++++- 2 files changed, 33 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index 0c896c58b05..cf99025834d 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -61,8 +61,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 @@ -142,7 +156,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 } @@ -244,9 +258,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) { @@ -277,7 +289,7 @@ 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) { @@ -285,7 +297,7 @@ jobs: $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 @@ -307,7 +319,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 @@ -340,7 +352,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 @@ -383,12 +395,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 diff --git a/bootstrap.ps1 b/bootstrap.ps1 index 48e1533f6bd..4ee0cb923d7 100644 --- a/bootstrap.ps1 +++ b/bootstrap.ps1 @@ -16,6 +16,9 @@ Installs files in tree rooted at PREFIX (defaults to TileDB\dist). .PARAMETER Dependency Semicolon separated list to binary dependencies. +.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. @@ -113,6 +116,7 @@ https://github.com/TileDB-Inc/TileDB Param( [string]$Prefix, [string]$Dependency, + [string]$Architecture, [string]$CMakeGenerator, [switch]$EnableAssert, [switch]$EnableDebug, @@ -287,6 +291,11 @@ if (![string]::IsNullOrEmpty($Dependency)) { $DependencyDir = $Dependency } +$ArchFlag = "" +if ($PSBoundParameters.ContainsKey("Architecture")) { + $ArchFlag = "-A $Architecture" +} + # Set CMake generator type. $GeneratorFlag = "" if ($PSBoundParameters.ContainsKey("CMakeGenerator")) { @@ -308,7 +317,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"" -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 -DTILEDB_STATIC=$TileDBStatic -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"" -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 -DTILEDB_STATIC=$TileDBStatic -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" From 998d7a6ece079665c2a46a7922d7c6fb88806fbb Mon Sep 17 00:00:00 2001 From: Theodore Tsirpanis Date: Tue, 27 Feb 2024 13:11:17 +0200 Subject: [PATCH 2/2] Fix CI. --- .github/workflows/build-windows.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index cf99025834d..4b09bfd5a83 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -404,8 +404,8 @@ jobs: Write-Host "cmd: '$cmd'" Invoke-Expression $cmd - #.\$CMakeBuildType\ExampleExe_static.exe - $cmd = ".\$CMakeBuildType\ExampleExe_static.exe" + #.\$env:CONFIG_PATH_FIXUP\ExampleExe_static.exe + $cmd = ".\$env:CONFIG_PATH_FIXUP\ExampleExe_static.exe" Write-Host "cmd: '$cmd'" Invoke-Expression $cmd