Skip to content

Commit 6ed895f

Browse files
committed
Added build wheels on windows ARM
1 parent ad7e694 commit 6ed895f

File tree

2 files changed

+70
-34
lines changed

2 files changed

+70
-34
lines changed

.github/workflows/build-wheels.yaml

Lines changed: 46 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
name: Build wheels
2-
32
# TODO: move into the release-deploy workflow and only run on published releases
43
# on:
54
# release:
@@ -32,12 +31,12 @@ jobs:
3231
fail-fast: false
3332
matrix:
3433
include:
35-
- os: ubuntu-latest
36-
cibw_archs: "x86_64"
37-
- os: ubuntu-24.04-arm
38-
cibw_archs: "aarch64"
39-
- os: windows-2025
40-
cibw_archs: "AMD64"
34+
#- os: ubuntu-latest
35+
# cibw_archs: "x86_64"
36+
#- os: ubuntu-24.04-arm
37+
# cibw_archs: "aarch64"
38+
#- os: windows-2025
39+
# cibw_archs: "AMD64"
4140
# # Not happy at the moment hence turned off
4241
# # It doesn't seem too far away, but something isn't quite right.
4342
# # Latest run by Zeb: https://github.com/openscm/example-fgen-basic/actions/runs/17173313157/job/48725872212
@@ -51,12 +50,12 @@ jobs:
5150
# # potentially relevant scipy issues:
5251
# # - https://github.com/scipy/scipy/issues/21716
5352
# # - https://github.com/scipy/scipy/issues/14812
54-
# - os: windows-11-arm
55-
# cibw_archs: "ARM64"
56-
- os: macos-13
57-
cibw_archs: "x86_64"
58-
- os: macos-14
59-
cibw_archs: "arm64"
53+
- os: windows-11-arm
54+
cibw_archs: "ARM64"
55+
#- os: macos-13
56+
# cibw_archs: "x86_64"
57+
#- os: macos-14
58+
# cibw_archs: "arm64"
6059

6160
steps:
6261
- uses: actions/checkout@v5
@@ -81,20 +80,44 @@ jobs:
8180
# setup-args="--vsenv"
8281
# setup-args="-Db_vscrt=mt"
8382
# setup-args="-Dcpp_link_args=['ucrt.lib','vcruntime.lib','/nodefaultlib:libucrt.lib','/nodefaultlib:libvcruntime.lib']"
84-
run: |
85-
echo 'CIBW_CONFIG_SETTINGS_WINDOWS=setup-args="--vsenv" setup-args="-Db_vscrt=mt"' >> $GITHUB_ENV
83+
# run: |
84+
# echo 'CIBW_CONFIG_SETTINGS_WINDOWS=setup-args="--vsenv" setup-args="-Db_vscrt=mt"' >> $GITHUB_ENV
8685
# TODO: figure out escaping and add back in (?)
8786
# setup-args="-Dcpp_link_args=['ucrt.lib','vcruntime.lib','/nodefaultlib:libucrt.lib','/nodefaultlib:libvcruntime.lib']"
88-
- name: Install Fortran compiler - windows-arm
89-
# When building on windows ARM, we need to use the MSVC toolchain
87+
####
9088
if: ${{ matrix.os == 'windows-11-arm' }}
91-
uses: fortran-lang/setup-fortran@v1
92-
id: setup-fortran-windows-arm
93-
with:
89+
shell: pwsh
90+
run: |
91+
echo "CC=clang-cl" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
92+
echo "CXX=clang-cl" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
93+
echo "FC=flang-new" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
94+
echo "AR=llvm-lib.exe" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
95+
96+
Invoke-WebRequest https://github.com/llvm/llvm-project/releases/download/llvmorg-20.1.8/LLVM-20.1.8-woa64.exe -OutFile LLVM-woa64.exe
97+
Start-Process -FilePath ".\LLVM-woa64.exe" -ArgumentList "/S" -Wait
98+
echo "C:\Program Files\LLVM\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
99+
$env:PATH = "C:\Program Files\LLVM\bin;" + $env:PATH
100+
101+
# $env:VCPKG_ROOT = "C:\vcpkg"
102+
#git clone https://github.com/microsoft/vcpkg $env:VCPKG_ROOT
103+
#& "$env:VCPKG_ROOT\bootstrap-vcpkg.bat"
104+
#& "$env:VCPKG_ROOT\vcpkg.exe" install pkgconf:arm64-windows
105+
#$pkgconfPath = "$env:VCPKG_ROOT\installed\arm64-windows\tools\pkgconf"
106+
#Copy-Item "$pkgconfPath\pkgconf.exe" "$pkgconfPath\pkg-config.exe" -Force
107+
#echo "$pkgconfPath" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
108+
109+
#####
110+
#- name: Install Fortran compiler - windows-arm
111+
# When building on windows ARM, we need to use the MSVC toolchain
112+
#if: ${{ matrix.os == 'windows-11-arm' }}
113+
#uses: fortran-lang/setup-fortran@v1
114+
#id: setup-fortran-windows-arm
115+
#with:
94116
# Only intel-classic supported by f2py
95-
# (https://numpy.org/devdocs/f2py/windows/intel.html#f2py-and-windows-intel-fortran)
96-
compiler: "intel-classic"
97-
version: "2021.10"
117+
# # (https://numpy.org/devdocs/f2py/windows/intel.html#f2py-and-windows-intel-fortran)
118+
# compiler: "intel-classic"
119+
#version: "2021.10"
120+
98121
- name: Build wheels
99122
uses: pypa/cibuildwheel@v3.1.4 # matplotlib had v3.1.3
100123
with:

meson.build

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -68,17 +68,30 @@ if pyprojectwheelbuild_enabled
6868
'src/example_fgen_basic/runtime_helpers.py',
6969
)
7070

71-
# The ancillary library,
72-
# i.e. all the stuff for wrapping that isn't directly exposed to Python.
73-
ancillary_lib = library(
74-
'@0@-ancillary'.format(meson.project_name()),
75-
sources: srcs_ancillary_lib,
76-
version: meson.project_version(),
77-
dependencies: [],
78-
# any other dependencies which aren't in source e.g. fgen-core
79-
# e.g. dependencies: [fgen_core_dep],
80-
install: false,
81-
)
71+
if host_machine.system() == 'windows'
72+
meson.override_find_program('ar', find_program('llvm-lib', required: true))
73+
# also tell Meson to use MSVC-compatible static library
74+
ancillary_lib = library(
75+
'@0@-ancillary'.format(meson.project_name()),
76+
sources: srcs_ancillary_lib,
77+
version: meson.project_version(),
78+
dependencies: [],
79+
install: false,
80+
override_options: ['b_vscrt=md', 'default_library=static', 'vs_library_format=lib']
81+
)
82+
else
83+
# The ancillary library,
84+
# i.e. all the stuff for wrapping that isn't directly exposed to Python.
85+
ancillary_lib = library(
86+
'@0@-ancillary'.format(meson.project_name()),
87+
sources: srcs_ancillary_lib,
88+
version: meson.project_version(),
89+
dependencies: [],
90+
# any other dependencies which aren't in source e.g. fgen-core
91+
# e.g. dependencies: [fgen_core_dep],
92+
install: false,
93+
)
94+
endif
8295

8396
ancillary_dep = declare_dependency(link_with: ancillary_lib)
8497

0 commit comments

Comments
 (0)