beeware / briefcase

Tools to support converting a Python project into a standalone native application.
https://briefcase.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
2.47k stars 350 forks source link

Add support for Windows on ARM #1887

Open rmartin16 opened 6 days ago

rmartin16 commented 6 days ago

What is the problem or limitation you are having?

Briefcase can currently only target Windows on x86. With the growing support for Windows on ARM, Briefcase should support targeting ARM.

Describe the solution you'd like

The current stub should be built for ARM and the Visual Studio template should support targeting ARM.

The embedded Python should be the arm64 version. Although, this is only available back to Python 3.11.

Describe alternatives you've considered

Similar to macOS on Apple Silicon, Windows can run x86 binaries on ARM. I still need to actually try it but this may allow a Briefcase app built for x86 to run on ARM.

Additional context

No response

freakboy3742 commented 6 days ago

Also worth note: Github has introduced native Windows ARM runners; they're not available on free tier yet, but if the experience with macOS ARM runners is indicative, they might be available on free tier later this year/early next year.

rmartin16 commented 6 days ago

To confirm, after installing the MSI for an app packaged for x86, the app does run on ARM (albeit virtualized): image

However, the zip package logs an error; perhaps unrelated to x86 on ARM since the same thing happens when I try to run the zip on another x86 install...maybe https://github.com/beeware/briefcase/discussions/1881 is related...

ZIP Traceback ```python Traceback (most recent call last): File "\app\helloworld\__main__.py", line 4, in main().main_loop() ^^^^^^ File "\app\helloworld\app.py", line 26, in main return HelloWorld() ^^^^^^^^^^^^ File "\app_packages\toga\app.py", line 464, in __init__ self.factory = get_platform_factory() ^^^^^^^^^^^^^^^^^^^^^^ File "\app_packages\toga\platform.py", line 114, in get_platform_factory factory = importlib.import_module(f"{backend.value}.factory") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "importlib\__init__.py", line 90, in import_module File "", line 1387, in _gcd_import File "", line 1360, in _find_and_load File "", line 1310, in _find_and_load_unlocked File "", line 488, in _call_with_frames_removed File "", line 1387, in _gcd_import File "", line 1360, in _find_and_load File "", line 1331, in _find_and_load_unlocked File "", line 935, in _load_unlocked File "", line 994, in exec_module File "", line 488, in _call_with_frames_removed File "\app_packages\toga_winforms\__init__.py", line 1, in import clr File "\app_packages\clr.py", line 6, in load() File "\app_packages\pythonnet\__init__.py", line 143, in load func = assembly.get_function("Python.Runtime.Loader.Initialize") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "\app_packages\clr_loader\types.py", line 94, in get_function return ClrFunction(self._runtime, self._path, name, func) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "\app_packages\clr_loader\types.py", line 58, in __init__ self._callable = runtime._get_callable(assembly, typename, func_name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "\app_packages\clr_loader\netfx.py", line 47, in _get_callable raise RuntimeError( RuntimeError: Failed to resolve Python.Runtime.Loader.Initialize from \app_packages\pythonnet\runtime\Python.Runtime.dll ```

Hello World-0.0.1.zip