Skip to content

Commit 936cf6f

Browse files
authored
chore: add Windows ARM support (#169)
* chore: add Windows ARM support * WIP: try scikit-build PR * Update build.yml * fix: avoid strip when cross-compiling * Update CMakeLists.txt * fix: turn off testing when cross compiling * chore: reduce warnings * Apply suggestions from code review * Update pyproject.toml * Update pyproject.toml
1 parent 62809e3 commit 936cf6f

File tree

4 files changed

+28
-21
lines changed

4 files changed

+28
-21
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ jobs:
4242
arch: "s390x"
4343
- os: windows-2019
4444
arch: "AMD64"
45+
- os: windows-2022
46+
arch: "ARM64"
4547
- os: windows-2019
4648
arch: "x86"
4749
- os: macos-11

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,4 @@ docs/_build
5858
# IDE junk
5959
.idea/*
6060
*.swp
61+
*~

CMakeLists.txt

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -120,26 +120,29 @@ ExternalProject_add(build_ninja
120120
set(ninja_executable ${Ninja_BINARY_DIR}/ninja${CMAKE_EXECUTABLE_SUFFIX})
121121
set(NINJA_BUILD_LAST_STEP "build")
122122

123-
find_program(STRIP_EXECUTABLE strip)
124-
if(STRIP_EXECUTABLE)
125-
ExternalProject_Add_Step(build_ninja strip_executables
126-
DEPENDEES ${NINJA_BUILD_LAST_STEP}
127-
COMMENT "Stripping CMake executables"
128-
COMMAND ${STRIP_EXECUTABLE} ${ninja_executable}
129-
USES_TERMINAL 1
130-
)
131-
set(NINJA_BUILD_LAST_STEP "strip_executables")
132-
endif()
123+
# This should not be stripped or tested if cross-compiling on Windows
124+
if(CMAKE_CROSS_COMPILE OR NOT DEFINED ENV{DIST_EXTRA_CONFIG})
125+
find_program(STRIP_EXECUTABLE strip)
126+
if(STRIP_EXECUTABLE)
127+
ExternalProject_Add_Step(build_ninja strip_executables
128+
DEPENDEES ${NINJA_BUILD_LAST_STEP}
129+
COMMENT "Stripping CMake executables"
130+
COMMAND ${STRIP_EXECUTABLE} ${ninja_executable}
131+
USES_TERMINAL 1
132+
)
133+
set(NINJA_BUILD_LAST_STEP "strip_executables")
134+
endif()
133135

134-
if(RUN_NINJA_TEST)
135-
ExternalProject_Add_Step(build_ninja run_ninja_test_suite
136-
DEPENDEES ${NINJA_BUILD_LAST_STEP}
137-
COMMENT "Running Ninja test suite"
138-
COMMAND ${Ninja_BINARY_DIR}/ninja_test${CMAKE_EXECUTABLE_SUFFIX}
139-
WORKING_DIRECTORY ${Ninja_BINARY_DIR}
140-
USES_TERMINAL 1
141-
)
142-
set(NINJA_BUILD_LAST_STEP "run_ninja_test_suite")
136+
if(RUN_NINJA_TEST)
137+
ExternalProject_Add_Step(build_ninja run_ninja_test_suite
138+
DEPENDEES ${NINJA_BUILD_LAST_STEP}
139+
COMMENT "Running Ninja test suite"
140+
COMMAND ${Ninja_BINARY_DIR}/ninja_test${CMAKE_EXECUTABLE_SUFFIX}
141+
WORKING_DIRECTORY ${Ninja_BINARY_DIR}
142+
USES_TERMINAL 1
143+
)
144+
set(NINJA_BUILD_LAST_STEP "run_ninja_test_suite")
145+
endif()
143146
endif()
144147

145148
install(FILES ${Ninja_SOURCE_DIR}/misc/ninja_syntax.py DESTINATION src/ninja)

pyproject.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[build-system]
22
requires = [
3-
"setuptools>=42",
4-
"scikit-build>=0.12",
3+
"setuptools >=42",
4+
"scikit-build",
55
]
66
build-backend = "setuptools.build_meta"
77

@@ -16,6 +16,7 @@ before-build = "pip install -r requirements-repair.txt"
1616
repair-wheel-command = "python scripts/repair_wheel.py -w {dest_dir} {wheel}"
1717
test-extras = "test"
1818
test-command = "pytest {project}/tests"
19+
test-skip = ["*-win_arm64", "*-macosx_universal2:arm64"]
1920

2021
[[tool.cibuildwheel.overrides]]
2122
select = "*-manylinux_{x86_64,i686}"

0 commit comments

Comments
 (0)