Skip to content

Commit 7cf11b2

Browse files
authored
Merge pull request #29 from qsharp-community/windows-arm
support windows arm
2 parents 04850e6 + 96dd6ab commit 7cf11b2

File tree

5 files changed

+38
-20
lines changed

5 files changed

+38
-20
lines changed

.github/workflows/ci.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,26 @@ jobs:
1010
build:
1111
strategy:
1212
matrix:
13-
os: [ ubuntu-latest, windows-latest, macos-latest ]
13+
os: [ ubuntu-latest, windows-latest, macos-latest, windows-11-arm ]
1414
runs-on: ${{ matrix.os }}
1515
steps:
1616
- name: Checkout code
1717
uses: actions/checkout@v3
1818

19+
- name: Install Rust on Windows ARM
20+
if: matrix.os == 'windows-11-arm'
21+
shell: powershell
22+
run: |
23+
Invoke-WebRequest -Uri https://win.rustup.rs/aarch64 -OutFile rustup-init.exe
24+
./rustup-init.exe -y
25+
$env:Path += ";$env:USERPROFILE\.cargo\bin"
26+
echo "$env:USERPROFILE\.cargo\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
27+
28+
- uses: actions/setup-python@v5
29+
if: matrix.os == 'windows-11-arm'
30+
with:
31+
python-version: '3.13'
32+
1933
- name: Install uniffi-bindgen-cs
2034
run: |
2135
cargo install uniffi-bindgen-cs --git https://github.com/NordSecurity/uniffi-bindgen-cs --tag v0.9.1+v0.28.3

.github/workflows/release.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,26 @@ jobs:
1313
build-wheels:
1414
strategy:
1515
matrix:
16-
os: [ubuntu-latest, windows-latest, macos-latest]
16+
os: [ubuntu-latest, windows-latest, macos-latest, windows-11-arm]
1717
runs-on: ${{ matrix.os }}
1818
steps:
1919
- name: Checkout code
2020
uses: actions/checkout@v3
2121

22+
- name: Install Rust on Windows ARM
23+
if: matrix.os == 'windows-11-arm'
24+
shell: powershell
25+
run: |
26+
Invoke-WebRequest -Uri https://win.rustup.rs/aarch64 -OutFile rustup-init.exe
27+
./rustup-init.exe -y
28+
$env:Path += ";$env:USERPROFILE\.cargo\bin"
29+
echo "$env:USERPROFILE\.cargo\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
30+
31+
- uses: actions/setup-python@v5
32+
if: matrix.os == 'windows-11-arm'
33+
with:
34+
python-version: '3.13'
35+
2236
- name: Set version from tag
2337
id: get_version
2438
run: |

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,4 @@ platforms/swift/Qsharp.Bridge/.build
3535
platforms/swift/Qsharp.Bridge/Libs/qsharp_bridge_framework.xcframework
3636
platforms/swift/Qsharp.Bridge/.swiftpm/xcode/xcuserdata/filipw.xcuserdatad/xcschemes/xcschememanagement.plist
3737
platforms/swift/Qsharp.Bridge/Sources/Qsharp.Bridge/qsharp_bridge.swift
38+
platforms/python/qsharp-bridge/__pycache__/

platforms/python/qsharp-bridge/qsharp_bridge/__init__.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,7 @@ def _load_native_lib():
1010
elif sys.platform.startswith("linux"):
1111
lib_name = "libqsharp_bridge.so"
1212
elif sys.platform.startswith("win"):
13-
machine = platform.machine().lower()
14-
if machine in ("amd64", "x86_64"):
15-
lib_name = "qsharp_bridge.dll"
16-
elif machine in ("arm64", "aarch64"):
17-
lib_name = "qsharp_bridge_arm64.dll"
18-
else:
19-
lib_name = "qsharp_bridge.dll"
13+
lib_name = "qsharp_bridge.dll"
2014
else:
2115
raise RuntimeError(f"Unsupported platform: {sys.platform}")
2216

platforms/python/qsharp-bridge/setup.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
def get_lib_filename():
2020
"""
2121
Return the platform-specific filename for the shared library.
22-
For Windows, select the binary based on the machine architecture.
2322
"""
2423
machine = platform.machine().lower()
2524
if sys.platform.startswith("darwin"):
@@ -28,13 +27,7 @@ def get_lib_filename():
2827
elif sys.platform.startswith("linux"):
2928
return "libqsharp_bridge.so"
3029
elif sys.platform.startswith("win"):
31-
# what an ambition, arm64 Windows support. maybe it will work?
32-
if machine in ("amd64", "x86_64"):
33-
return "qsharp_bridge.dll"
34-
elif machine in ("arm64", "aarch64"):
35-
return "qsharp_bridge_arm64.dll"
36-
else:
37-
return "qsharp_bridge.dll"
30+
return "qsharp_bridge.dll"
3831
else:
3932
raise RuntimeError(f"Unsupported platform: {sys.platform}")
4033

@@ -68,14 +61,16 @@ def run(self):
6861
class bdist_wheel(_bdist_wheel):
6962
def finalize_options(self):
7063
self.plat_name_supplied = True
71-
72-
# Set the platform tag based on the system
7364
if sys.platform.startswith('linux'):
7465
self.plat_name = "py3-none-linux_x86_64"
7566
elif sys.platform.startswith('darwin'):
7667
self.plat_name = "py3-none-macosx_11_0_universal2"
7768
elif sys.platform.startswith('win'):
78-
self.plat_name = "py3-none-win_amd64"
69+
machine = platform.machine().lower()
70+
if machine in ("arm64", "aarch64"):
71+
self.plat_name = "py3-none-win_arm64"
72+
else:
73+
self.plat_name = "py3-none-win_amd64"
7974
else:
8075
# Fall back to default behavior for unknown platforms
8176
self.plat_name_supplied = False

0 commit comments

Comments
 (0)