-
Notifications
You must be signed in to change notification settings - Fork 57
Add ARM64 Support to ParquetSharp #519
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
fa3f9e2
e2c12b3
c7c6305
449fb74
e5cec82
8766c3c
da5bb0d
fd14308
69e036b
e8da96f
f1990cc
aff1a2a
48977a5
ffde82d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
Set-StrictMode -Version 3 | ||
$ErrorActionPreference = "Stop" | ||
|
||
# Find vcpkg or download it if required | ||
if ($null -ne $Env:VCPKG_INSTALLATION_ROOT) { | ||
$vcpkgDir = $Env:VCPKG_INSTALLATION_ROOT | ||
Write-Output "Using vcpkg at $vcpkgDir from VCPKG_INSTALLATION_ROOT" | ||
} | ||
elseif ($null -ne $Env:VCPKG_ROOT) { | ||
$vcpkgDir = $Env:VCPKG_ROOT | ||
Write-Output "Using vcpkg at $vcpkgDir from VCPKG_ROOT" | ||
} | ||
else { | ||
$vcpkgDir = "$(Get-Location)/build/vcpkg" | ||
Write-Output "Using local vcpkg at $vcpkgDir" | ||
if (-not (Test-Path $vcpkgDir)) { | ||
git clone https://github.com/microsoft/vcpkg.git $vcpkgDir | ||
if (-not $?) { throw "git clone failed" } | ||
& $vcpkgDir/bootstrap-vcpkg.bat | ||
if (-not $?) { throw "bootstrap-vcpkg failed" } | ||
} | ||
} | ||
|
||
$triplet = "arm64-windows" | ||
|
||
$build_types = @("Debug", "Release") | ||
|
||
if ($null -eq $env:ARROW_HOME) { | ||
Write-Host "Error: ARROW_HOME environment variable not set." -ForegroundColor Red | ||
Write-Host "Please set it to your Arrow installation directory, for example:" -ForegroundColor Yellow | ||
Write-Host " $env:ARROW_HOME = 'C:\path\to\arrow\install\$triplet'" -ForegroundColor Yellow | ||
exit 1 | ||
} | ||
|
||
$arrow_install_dir = $env:ARROW_HOME | ||
|
||
if (-not (Test-Path "$arrow_install_dir/release") -or -not (Test-Path "$arrow_install_dir/debug")) { | ||
Write-Host "Error: ARROW_HOME directory doesn't contain expected 'debug' and 'release' subdirectories." -ForegroundColor Red | ||
Write-Host "Please ensure your Arrow installation has both debug and release builds." -ForegroundColor Yellow | ||
exit 1 | ||
} | ||
|
||
Write-Host "Using Arrow installation from: $arrow_install_dir" -ForegroundColor Green | ||
|
||
$options = @() | ||
if ($Env:GITHUB_ACTIONS -eq "true") { | ||
$build_types = @("Release") | ||
$customTripletsDir = "$(Get-Location)/build/custom-triplets" | ||
New-Item -Path $customTripletsDir -ItemType "directory" -Force > $null | ||
$sourceTripletFile = "$vcpkgDir/triplets/$triplet.cmake" | ||
$customTripletFile = "$customTripletsDir/$triplet.cmake" | ||
Copy-Item -Path $sourceTripletFile -Destination $customTripletFile | ||
Add-Content -Path $customTripletFile -Value "set(VCPKG_BUILD_TYPE release)" | ||
|
||
# Ensure vcpkg uses the same MSVC version to build dependencies as we use to build the ParquetSharp library. | ||
# By default, vcpkg uses the most recent version it can find, which might not be the same as what msbuild uses. | ||
$vsInstPath = & "${env:ProgramFiles(x86)}/Microsoft Visual Studio/Installer/vswhere.exe" -latest -property installationPath | ||
Import-Module "$vsInstPath/Common7/Tools/Microsoft.VisualStudio.DevShell.dll" | ||
Enter-VsDevShell -VsInstallPath $vsInstPath -SkipAutomaticLocation | ||
$clPath = Get-Command cl.exe | Select -ExpandProperty "Source" | ||
$toolsetVersion = $clPath.Split("\")[8] | ||
if (-not $toolsetVersion.StartsWith("14.")) { throw "Couldn't get toolset version from path '$clPath'" } | ||
Write-Output "Using platform toolset version = $toolsetVersion" | ||
Add-Content -Path $customTripletFile -Value "set(VCPKG_PLATFORM_TOOLSET_VERSION $toolsetVersion)" | ||
|
||
$options += "-D" | ||
$options += "VCPKG_OVERLAY_TRIPLETS=$customTripletsDir" | ||
} | ||
|
||
cmake -B build/$triplet -S . ` | ||
-G "Ninja Multi-Config" ` | ||
-DCMAKE_C_COMPILER=clang-cl ` | ||
-DCMAKE_CXX_COMPILER=clang-cl ` | ||
-DCMAKE_TOOLCHAIN_FILE=C:/src/vcpkg/scripts/buildsystems/vcpkg.cmake ` | ||
-DCMAKE_MAKE_PROGRAM=ninja ` | ||
-DVCPKG_TARGET_TRIPLET="$triplet" ` | ||
-DARROW_ROOT_DEBUG="$arrow_install_dir/debug" ` | ||
-DARROW_ROOT_RELEASE="$arrow_install_dir/release" ` | ||
$options | ||
|
||
if (-not $?) { throw "cmake failed" } | ||
|
||
foreach ($build_type in $build_types) { | ||
cmake --build build/$triplet --config $build_type --target ParquetSharpNative | ||
if (-not $?) { throw "ninja build failed" } | ||
} |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I refactored the native CMake configuration to reference the locally built Arrow and Parquet libraries directly. Instead of using |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This new Windows PowerShell script was introduced to support ARM64 builds, primarily targeting arm64-windows triplets instead of the previous x64-windows-static triplet.
Some of the key changes introduced:
CMAKE_C_COMPILER=clang-cl, CMAKE_CXX_COMPILER=clang-cl
).