-
-
Notifications
You must be signed in to change notification settings - Fork 487
Support Windows ARM64 #2797
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
abdnh
wants to merge
24
commits into
beeware:main
Choose a base branch
from
ankitects:windows-arm
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Support Windows ARM64 #2797
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
0affcf6
Allow running on Windows ARM64
abdnh dc9b616
Fix VS packaging root for ARM
abdnh 9a0e635
Pass platform to MSBuild
abdnh 86bd5da
Construct correct stub binary filename for ARM
abdnh 2c04b80
Refactor platform checks
abdnh aa32d1c
Add changes note
abdnh 2b9ca76
Add windows-11-arm runner
abdnh aece505
Add suffix for amd64
abdnh 209724f
Update tests
abdnh 873f553
Replace hardcoded amd64 suffix in tests
abdnh c25b340
Update platform support tables
abdnh 5adf8a4
Rename to vscode_platform and make a property
abdnh 1f923fb
Convert packaging_root to a property
abdnh c91b437
Refuse to run with a x86_64 interpreter
abdnh a2fae66
Fix non-Windows coverage
abdnh 9a81caa
Add missing space
abdnh bd2e6a9
Update release note
abdnh c660799
Detect ARM64 on older Python versions
abdnh db4b58f
Merge remote-tracking branch 'origin' into windows-arm
abdnh 9eceb52
Add a test
abdnh f435a2d
Update Visual Studio docs
abdnh a483bcb
Add additional test for more coverage
abdnh 05b5ce2
Fix spelling lint
abdnh 371794a
Add a test for Python 3.12+
abdnh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Briefcase can now build Windows apps for ARM64 devices. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -237,3 +237,4 @@ Xauth | |
| Xcode | ||
| Xr | ||
| Xs | ||
| MSVC | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -195,8 +195,8 @@ def __init__( | |||||||||||||||||||||||||||||||||||||||||
| self.base_path = Path(base_path) | ||||||||||||||||||||||||||||||||||||||||||
| self.home_path = Path(os.path.expanduser(home_path or Path.home())) | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| self.host_arch = self.platform.machine() | ||||||||||||||||||||||||||||||||||||||||||
| self.host_os = self.platform.system() | ||||||||||||||||||||||||||||||||||||||||||
| self.host_arch = self._get_host_arch() | ||||||||||||||||||||||||||||||||||||||||||
| # Python is 32bit if its pointers can only address with 32 bits or fewer | ||||||||||||||||||||||||||||||||||||||||||
| self.is_32bit_python = self.sys.maxsize <= 2**32 | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -208,6 +208,36 @@ def __init__( | |||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| def _get_host_arch(self) -> str: | ||||||||||||||||||||||||||||||||||||||||||
| arch = self.platform.machine() | ||||||||||||||||||||||||||||||||||||||||||
| # On Windows with Python < 3.12, ``platform.machine()`` returns the | ||||||||||||||||||||||||||||||||||||||||||
| # emulated architecture (e.g. "AMD64") when an x86-64 Python interpreter | ||||||||||||||||||||||||||||||||||||||||||
| # is running under ARM64. ``IsWow64Process2()`` exposes the | ||||||||||||||||||||||||||||||||||||||||||
| # native machine type. | ||||||||||||||||||||||||||||||||||||||||||
| if ( | ||||||||||||||||||||||||||||||||||||||||||
| arch == "AMD64" | ||||||||||||||||||||||||||||||||||||||||||
| and self.host_os == "Windows" | ||||||||||||||||||||||||||||||||||||||||||
| and self.sys.version_info < (3, 12) | ||||||||||||||||||||||||||||||||||||||||||
| and self.sys.getwindowsversion().build >= 16299 # Windows 10 1709 | ||||||||||||||||||||||||||||||||||||||||||
| ): | ||||||||||||||||||||||||||||||||||||||||||
| import ctypes | ||||||||||||||||||||||||||||||||||||||||||
| from ctypes import wintypes | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| IMAGE_FILE_MACHINE_ARM64 = 0xAA64 | ||||||||||||||||||||||||||||||||||||||||||
| kernel32 = ctypes.windll.kernel32 | ||||||||||||||||||||||||||||||||||||||||||
| process_machine = ctypes.c_ushort(0) | ||||||||||||||||||||||||||||||||||||||||||
| native_machine = ctypes.c_ushort(0) | ||||||||||||||||||||||||||||||||||||||||||
| if ( | ||||||||||||||||||||||||||||||||||||||||||
| kernel32.IsWow64Process2( | ||||||||||||||||||||||||||||||||||||||||||
| wintypes.HANDLE(kernel32.GetCurrentProcess()), | ||||||||||||||||||||||||||||||||||||||||||
| ctypes.byref(process_machine), | ||||||||||||||||||||||||||||||||||||||||||
| ctypes.byref(native_machine), | ||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||
| and native_machine.value == IMAGE_FILE_MACHINE_ARM64 | ||||||||||||||||||||||||||||||||||||||||||
| ): | ||||||||||||||||||||||||||||||||||||||||||
| return "ARM64" | ||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+221
to
+238
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is clever - but I've found an even easier way that doesn't need system calls:
Suggested change
AFAICT, |
||||||||||||||||||||||||||||||||||||||||||
| return arch | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| @cached_property | ||||||||||||||||||||||||||||||||||||||||||
| def system_encoding(self) -> str: | ||||||||||||||||||||||||||||||||||||||||||
| """The character encoding for the system's locale. | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's also a mention of this in
integrations/visualstudio.py, as part of the error message that is displayed if VSCode can't be found.