Skip to content

Commit ab4bdc9

Browse files
authored
Add support for Windows Arm64 (#576)
1 parent ec65909 commit ab4bdc9

File tree

7 files changed

+56
-28
lines changed

7 files changed

+56
-28
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ jobs:
6161
arch: x64
6262
- os: windows-2022
6363
arch: x64
64+
- os: windows-11-arm
65+
arch: arm64
6466
fail-fast: false
6567
name: Build native ${{ matrix.arch }} library (${{ matrix.os }})
6668
runs-on: ${{ matrix.os }}
@@ -113,7 +115,7 @@ jobs:
113115
if: runner.os == 'Linux'
114116
run: |
115117
docker run -d --name centos --entrypoint tail -v $PWD:$PWD -v $VCPKG_INSTALLATION_ROOT:$VCPKG_INSTALLATION_ROOT quay.io/pypa/manylinux2014_$(uname -m) -f /dev/null
116-
docker exec centos sh -c "yum install -y devtoolset-10 rh-git227 httpd24-curl flex bison perl-Data-Dumper perl-IPC-Cmd && \
118+
docker exec centos sh -c "yum install -y devtoolset-10 rh-git227 httpd24-curl flex bison perl-Data-Dumper perl-IPC-Cmd perl-Time-Piece && \
117119
uv tool install ninja"
118120
119121
# Install vcpkg dependencies
@@ -224,12 +226,15 @@ jobs:
224226
- macos-15-intel
225227
- windows-2022
226228
- windows-2025
229+
- windows-11-arm
227230
dotnet: [net6.0, net8.0, net9.0]
228231
include:
229232
- os: windows-2022
230233
dotnet: net472
231234
- os: windows-2025
232235
dotnet: net472
236+
- os: windows-11-arm
237+
dotnet: net472
233238
fail-fast: false
234239
name: Test NuGet package (${{ matrix.dotnet }} on ${{ matrix.os }})
235240
runs-on: ${{ matrix.os }}

build_windows.ps1

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,13 @@ else {
2121
}
2222
}
2323

24-
$triplet = "x64-windows-static"
24+
switch -Regex ($env:PROCESSOR_ARCHITECTURE) {
25+
"AMD64" { $arch = "x64" }
26+
"ARM64" { $arch = "arm64" }
27+
default { throw "Unsupported architecture: $env:PROCESSOR_ARCHITECTURE" }
28+
}
29+
30+
$triplet = "$arch-windows-static"
2531

2632
$build_types = @("Debug", "Release")
2733

@@ -30,27 +36,30 @@ if ($Env:GITHUB_ACTIONS -eq "true") {
3036
$build_types = @("Release")
3137
$customTripletsDir = "$(Get-Location)/build/custom-triplets"
3238
New-Item -Path $customTripletsDir -ItemType "directory" -Force > $null
33-
$sourceTripletFile = "$vcpkgDir/triplets/$triplet.cmake"
34-
$customTripletFile = "$customTripletsDir/$triplet.cmake"
35-
Copy-Item -Path $sourceTripletFile -Destination $customTripletFile
36-
Add-Content -Path $customTripletFile -Value "set(VCPKG_BUILD_TYPE release)"
37-
38-
# Ensure vcpkg uses the same MSVC version to build dependencies as we use to build the ParquetSharp library.
39-
# By default, vcpkg uses the most recent version it can find, which might not be the same as what msbuild uses.
40-
$vsInstPath = & "${env:ProgramFiles(x86)}/Microsoft Visual Studio/Installer/vswhere.exe" -latest -property installationPath
41-
Import-Module "$vsInstPath/Common7/Tools/Microsoft.VisualStudio.DevShell.dll"
42-
Enter-VsDevShell -VsInstallPath $vsInstPath -SkipAutomaticLocation
43-
$clPath = Get-Command cl.exe | Select -ExpandProperty "Source"
44-
$toolsetVersion = $clPath.Split("\")[8]
45-
if (-not $toolsetVersion.StartsWith("14.")) { throw "Couldn't get toolset version from path '$clPath'" }
46-
Write-Output "Using platform toolset version = $toolsetVersion"
47-
Add-Content -Path $customTripletFile -Value "set(VCPKG_PLATFORM_TOOLSET_VERSION $toolsetVersion)"
39+
foreach ($subdir in @("", "community")) {
40+
$sourceTripletFile = "$vcpkgDir/triplets/$subdir/$triplet.cmake"
41+
if (Test-Path $sourceTripletFile) {
42+
$customTripletFile = "$customTripletsDir/$triplet.cmake"
43+
Copy-Item -Path $sourceTripletFile -Destination $customTripletFile
44+
Add-Content -Path $customTripletFile -Value "set(VCPKG_BUILD_TYPE release)"
4845

46+
# Ensure vcpkg uses the same MSVC version to build dependencies as we use to build the ParquetSharp library.
47+
# By default, vcpkg uses the most recent version it can find, which might not be the same as what msbuild uses.
48+
$vsInstPath = & "${env:ProgramFiles(x86)}/Microsoft Visual Studio/Installer/vswhere.exe" -latest -property installationPath
49+
Import-Module "$vsInstPath/Common7/Tools/Microsoft.VisualStudio.DevShell.dll"
50+
Enter-VsDevShell -VsInstallPath $vsInstPath -SkipAutomaticLocation
51+
$clPath = Get-Command cl.exe | Select -ExpandProperty "Source"
52+
$toolsetVersion = $clPath.Split("\")[8]
53+
if (-not $toolsetVersion.StartsWith("14.")) { throw "Couldn't get toolset version from path '$clPath'" }
54+
Write-Output "Using platform toolset version = $toolsetVersion"
55+
Add-Content -Path $customTripletFile -Value "set(VCPKG_PLATFORM_TOOLSET_VERSION $toolsetVersion)"
56+
}
57+
}
4958
$options += "-D"
5059
$options += "VCPKG_OVERLAY_TRIPLETS=$customTripletsDir"
5160
}
5261

53-
cmake -B build/$triplet -S . -D VCPKG_TARGET_TRIPLET=$triplet -D CMAKE_TOOLCHAIN_FILE=$vcpkgDir/scripts/buildsystems/vcpkg.cmake -G "Visual Studio 17 2022" -A "x64" $options
62+
cmake -B build/$triplet -S . -D VCPKG_TARGET_TRIPLET=$triplet -D CMAKE_TOOLCHAIN_FILE=$vcpkgDir/scripts/buildsystems/vcpkg.cmake -G "Visual Studio 17 2022" -A $arch $options
5463
if (-not $?) { throw "cmake failed" }
5564

5665
foreach ($build_type in $build_types) {

csharp.test/ParquetSharp.Test.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
<Nullable>enable</Nullable>
1111
<AssemblyName>ParquetSharp.Test</AssemblyName>
1212
<RootNamespace>ParquetSharp.Test</RootNamespace>
13-
<PlatformTarget Condition="'$(TargetFramework)'=='net472'">x64</PlatformTarget>
1413
<GenerateProgramFile>false</GenerateProgramFile>
1514
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
1615
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>

csharp/ParquetSharp.csproj

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
<Nullable>enable</Nullable>
77
<AssemblyName>ParquetSharp</AssemblyName>
88
<RootNamespace>ParquetSharp</RootNamespace>
9-
<PlatformTarget Condition="'$(TargetFramework)'=='net471'">x64</PlatformTarget>
109
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
1110
<GenerateDocumentationFile>true</GenerateDocumentationFile>
1211
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
@@ -38,13 +37,22 @@
3837
</PropertyGroup>
3938

4039
<ItemGroup Label="Native Library">
41-
<Content Include="..\bin\x64-windows-static\ParquetSharpNatived.dll" Link="ParquetSharpNatived.dll" PackagePath="runtimes/win-x64/native" Condition="'$(Configuration)'=='Debug' AND ('$(IsWindows)'=='true' OR Exists('..\bin\x64-windows-static\ParquetSharpNatived.dll'))">
40+
<Content Include="..\bin\x64-windows-static\ParquetSharpNatived.dll" Link="ParquetSharpNatived.dll" PackagePath="runtimes/win-x64/native" Condition="'$(Configuration)'=='Debug' AND (('$(IsWindows)'=='true' AND '$(OSArchitecture)'=='X64') OR Exists('..\bin\x64-windows-static\ParquetSharpNatived.dll'))">
4241
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
4342
</Content>
44-
<Content Include="..\bin\x64-windows-static\ParquetSharpNatived.pdb" Link="ParquetSharpNatived.pdb" PackagePath="runtimes/win-x64/native" Condition="'$(Configuration)'=='Debug' AND ('$(IsWindows)'=='true' OR Exists('..\bin\x64-windows-static\ParquetSharpNatived.pdb'))">
43+
<Content Include="..\bin\x64-windows-static\ParquetSharpNatived.pdb" Link="ParquetSharpNatived.pdb" PackagePath="runtimes/win-x64/native" Condition="'$(Configuration)'=='Debug' AND (('$(IsWindows)'=='true' AND '$(OSArchitecture)'=='X64') OR Exists('..\bin\x64-windows-static\ParquetSharpNatived.pdb'))">
4544
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
4645
</Content>
47-
<Content Include="..\bin\x64-windows-static\ParquetSharpNative.dll" Link="ParquetSharpNative.dll" PackagePath="runtimes/win-x64/native" Condition="'$(Configuration)'=='Release' AND ('$(IsWindows)'=='true' OR Exists('..\bin\x64-windows-static\ParquetSharpNative.dll'))">
46+
<Content Include="..\bin\x64-windows-static\ParquetSharpNative.dll" Link="ParquetSharpNative.dll" PackagePath="runtimes/win-x64/native" Condition="'$(Configuration)'=='Release' AND (('$(IsWindows)'=='true' AND '$(OSArchitecture)'=='X64') OR Exists('..\bin\x64-windows-static\ParquetSharpNative.dll'))">
47+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
48+
</Content>
49+
<Content Include="..\bin\arm64-windows-static\ParquetSharpNatived.dll" Link="ParquetSharpNatived.dll" PackagePath="runtimes/win-arm64/native" Condition="'$(Configuration)'=='Debug' AND (('$(IsWindows)'=='true' AND '$(OSArchitecture)'=='Arm64') OR Exists('..\bin\arm64-windows-static\ParquetSharpNatived.dll'))">
50+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
51+
</Content>
52+
<Content Include="..\bin\arm64-windows-static\ParquetSharpNatived.pdb" Link="ParquetSharpNatived.pdb" PackagePath="runtimes/win-arm64/native" Condition="'$(Configuration)'=='Debug' AND (('$(IsWindows)'=='true' AND '$(OSArchitecture)'=='Arm64') OR Exists('..\bin\arm64-windows-static\ParquetSharpNatived.pdb'))">
53+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
54+
</Content>
55+
<Content Include="..\bin\arm64-windows-static\ParquetSharpNative.dll" Link="ParquetSharpNative.dll" PackagePath="runtimes/win-arm64/native" Condition="'$(Configuration)'=='Release' AND (('$(IsWindows)'=='true' AND '$(OSArchitecture)'=='Arm64') OR Exists('..\bin\arm64-windows-static\ParquetSharpNative.dll'))">
4856
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
4957
</Content>
5058
<Content Include="..\bin\x64-linux\ParquetSharpNatived.so" Link="ParquetSharpNatived.so" PackagePath="runtimes/linux-x64/native" Condition="'$(Configuration)'=='Debug' AND (('$(IsLinux)'=='true' AND '$(OSArchitecture)'=='X64') OR Exists('..\bin\x64-linux\ParquetSharpNatived.so'))">

csharp/ParquetSharp.targets

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,16 @@
22

33
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
44
<!-- Inspired by https://stackoverflow.com/questions/40104838/automatic-native-and-managed-dlls-extracting-from-nuget-package -->
5-
<ItemGroup>
6-
<Content Include="$(MSBuildThisFileDirectory)..\runtimes\win-x64\native\ParquetSharpNative.dll" Condition="'$(TargetFrameworkIdentifier)'=='.NETFramework'">
5+
<PropertyGroup>
6+
<OSArchitecture Condition="'$(OSArchitecture)' == ''">$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture)</OSArchitecture>
7+
</PropertyGroup>
8+
<ItemGroup Condition="'$(TargetFrameworkIdentifier)'=='.NETFramework'">
9+
<Content Include="$(MSBuildThisFileDirectory)..\runtimes\win-x64\native\ParquetSharpNative.dll" Condition="'$(OSArchitecture)'=='X64'">
10+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
11+
<Link>ParquetSharpNative.dll</Link>
12+
<Visible>False</Visible>
13+
</Content>
14+
<Content Include="$(MSBuildThisFileDirectory)..\runtimes\win-arm64\native\ParquetSharpNative.dll" Condition="'$(OSArchitecture)'=='Arm64'">
715
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
816
<Link>ParquetSharpNative.dll</Link>
917
<Visible>False</Visible>

fsharp.test/ParquetSharp.Test.FSharp.fsproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
<!-- This is to speed up the build process and avoid errors when the required runtimes are not installed. -->
77
<TargetFrameworks Condition="'$(CI)' == 'true'">$(TargetFrameworks);net6.0;net9.0</TargetFrameworks>
88
<TargetFrameworks Condition="'$(CI)' == 'true' AND '$(OS)'=='Windows_NT'">$(TargetFrameworks);net472</TargetFrameworks>
9-
<PlatformTarget Condition="'$(TargetFramework)'=='net472'">x64</PlatformTarget>
109
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
1110
</PropertyGroup>
1211

vcpkg.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json",
33
"name": "parquetsharp",
44
"version-string": "undefined",
5-
"builtin-baseline": "8485f14efb70fc778b96b3d3681b285e3f10b104",
5+
"builtin-baseline": "71f123418c6cdc00258964629b0ede4317ba1a36",
66
"dependencies": [
77
{
88
"name": "arrow",
@@ -21,7 +21,7 @@
2121
"overrides": [
2222
{
2323
"name": "arrow",
24-
"version": "21.0.0"
24+
"version": "21.0.0#1"
2525
}
2626
]
2727
}

0 commit comments

Comments
 (0)