Skip to content

Commit fd5c5ce

Browse files
Merge pull request #709 from ndabas/win_arm64
Add Windows ARM64 build
2 parents 1fc28ea + 614daa9 commit fd5c5ce

2 files changed

Lines changed: 42 additions & 18 deletions

File tree

‎.github/workflows/cibuildwheels.yml‎

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,12 @@ jobs:
8383
cibw_pattern: "cp311-win_amd64 cp314t-win_amd64 cp315t-win_amd64"
8484
artifact_name: "windows-x86_64"
8585

86+
# Windows ARM64 builds (native runners)
87+
- os: windows-11-arm
88+
arch: arm64
89+
cibw_pattern: "cp311-win_arm64 cp314t-win_arm64 cp315t-win_arm64"
90+
artifact_name: "windows-arm64"
91+
8692
# macOS builds (universal2)
8793
- os: macos-latest
8894
arch: x86_64
@@ -107,15 +113,6 @@ jobs:
107113
id: ninja
108114
uses: turtlesec-no/get-ninja@main
109115

110-
- name: Add LLVM to PATH (Windows)
111-
if: ${{ matrix.os == 'windows-latest' }}
112-
run: echo "C:\\Program Files\\LLVM\\bin" >> $env:GITHUB_PATH
113-
114-
- name: Install MSVC amd64
115-
uses: ilammy/msvc-dev-cmd@v1.13.0
116-
with:
117-
arch: amd64
118-
119116
- name: Build wheels
120117
uses: pypa/cibuildwheel@v4.2
121118

@@ -219,17 +216,19 @@ jobs:
219216
strategy:
220217
fail-fast: false
221218
matrix:
222-
# Both are real matrix dimensions so they cross-product (15 short jobs).
219+
# Both are real matrix dimensions so they cross-product (20 short jobs).
223220
# The `include` entries key on `os`, which is an existing dimension, so
224221
# they attach artifact_name to the matching combinations rather than
225222
# being appended as extra jobs.
226-
os: [ubuntu-latest, windows-latest, macos-latest]
223+
os: [ubuntu-latest, windows-latest, windows-11-arm, macos-latest]
227224
python-version: ["3.11", "3.12", "3.13", "3.14", "3.15"]
228225
include:
229226
- os: ubuntu-latest
230227
artifact_name: "linux-x86_64"
231228
- os: windows-latest
232229
artifact_name: "windows-x86_64"
230+
- os: windows-11-arm
231+
artifact_name: "windows-arm64"
233232
- os: macos-latest
234233
artifact_name: "macos-universal2"
235234
steps:

‎CMakeLists.txt‎

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ set(BLOSC2_BUNDLED_VERSION v3.3.4)
2222
if(WIN32 AND NOT CMAKE_C_COMPILER_ID STREQUAL "Clang")
2323
message(FATAL_ERROR "Windows builds require clang-cl. Set CC/CXX to clang-cl or configure CMake with -T ClangCL.")
2424
endif()
25+
2526
# Specifying Python version below is tricky, but if you don't specify the minimum version here,
2627
# it would not consider python3 when looking for the executable. This is problematic since Fedora
2728
# does not include a python symbolic link to python3.
@@ -131,6 +132,10 @@ set(CMAKE_INSTALL_DATADIR blosc2/share)
131132
if(EMSCRIPTEN)
132133
set(MINIEXPR_ENABLE_TCC_JIT ON CACHE BOOL "Enable TCC JIT in Emscripten builds" FORCE)
133134
set(MINIEXPR_WASM32_SIDE_MODULE ON CACHE BOOL "Use host-registered wasm32 JIT helpers" FORCE)
135+
elseif(WIN32 AND (CMAKE_VS_PLATFORM_NAME STREQUAL "ARM64"
136+
OR CMAKE_SYSTEM_PROCESSOR MATCHES "^(ARM64|AARCH64|arm64|aarch64)$"))
137+
# Keep Windows/ARM64 on interpreter mode until minicc/libtcc supports this target.
138+
set(MINIEXPR_ENABLE_TCC_JIT OFF CACHE BOOL "TinyCC lacks a Windows ARM64 backend" FORCE)
134139
endif()
135140

136141
FetchContent_Declare(miniexpr
@@ -158,15 +163,29 @@ if(WIN32 AND CMAKE_C_COMPILER_ID STREQUAL "Clang")
158163
ERROR_QUIET
159164
)
160165
if(_clang_resource_dir)
161-
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
162-
set(_clang_builtins "${_clang_resource_dir}/lib/windows/clang_rt.builtins-x86_64.lib")
163-
else()
164-
set(_clang_builtins "${_clang_resource_dir}/lib/windows/clang_rt.builtins-i386.lib")
165-
endif()
166-
if(EXISTS "${_clang_builtins}")
167-
target_link_libraries(blosc2_ext PRIVATE "${_clang_builtins}")
166+
set(_clang_builtins_names)
167+
if(CMAKE_VS_PLATFORM_NAME STREQUAL "ARM64"
168+
OR CMAKE_SYSTEM_PROCESSOR MATCHES "^(ARM64|AARCH64|arm64|aarch64)$")
169+
list(APPEND _clang_builtins_names
170+
clang_rt.builtins-aarch64
171+
clang_rt.builtins-arm64)
172+
elseif(CMAKE_VS_PLATFORM_NAME STREQUAL "x64"
173+
OR CMAKE_SYSTEM_PROCESSOR MATCHES "^(AMD64|X86_64|amd64|x86_64)$")
174+
list(APPEND _clang_builtins_names clang_rt.builtins-x86_64)
175+
elseif(CMAKE_VS_PLATFORM_NAME STREQUAL "Win32"
176+
OR CMAKE_SYSTEM_PROCESSOR MATCHES "^(X86|x86|i[3-6]86)$")
177+
list(APPEND _clang_builtins_names clang_rt.builtins-i386)
168178
endif()
179+
foreach(_clang_builtins_name IN LISTS _clang_builtins_names)
180+
set(_clang_builtins "${_clang_resource_dir}/lib/windows/${_clang_builtins_name}.lib")
181+
if(EXISTS "${_clang_builtins}")
182+
target_link_libraries(blosc2_ext PRIVATE "${_clang_builtins}")
183+
break()
184+
endif()
185+
endforeach()
169186
unset(_clang_builtins)
187+
unset(_clang_builtins_name)
188+
unset(_clang_builtins_names)
170189
endif()
171190
unset(_clang_resource_dir)
172191
endif()
@@ -187,6 +206,12 @@ else()
187206
set(BUILD_EXAMPLES OFF CACHE BOOL "Build C-Blosc2 examples")
188207
set(BUILD_BENCHMARKS OFF CACHE BOOL "Build C-Blosc2 benchmarks")
189208
set(BUILD_FUZZERS OFF CACHE BOOL "Build C-Blosc2 fuzzers")
209+
if(WIN32 AND (CMAKE_VS_PLATFORM_NAME STREQUAL "ARM64"
210+
OR CMAKE_SYSTEM_PROCESSOR MATCHES "^(ARM64|AARCH64|arm64|aarch64)$"))
211+
# Build failure fixed in https://github.com/zlib-ng/zlib-ng/pull/2274
212+
# This can be removed when we update to the next zlib-ng release.
213+
set(WITH_ZLIB_OPTIM OFF CACHE BOOL "zlib-ng ARM paths need zlib-ng#2274" FORCE)
214+
endif()
190215
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
191216
set(Blosc2_INSTALL_CMAKEDIR ${CMAKE_INSTALL_LIBDIR}/cmake/blosc2) # directory for cmake files
192217
set(CMAKE_INSTALL_BINDIR blosc2/lib) # directory for libblosc2.dll on windows

0 commit comments

Comments
 (0)