Skip to content

feat: Better support for cross-compilation #1050

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
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

LecrisUT
Copy link
Collaborator

Mostly the cross-compilation works out-of-the-box with crossenv + CMAKE_TOOLCHAIN_FILE. There is only one adjustment needed for Python_ROOT_DIR to point to sys.base_exec_prefix, the rest is documentation of the change and adding support for CMAKE_TOOLCHAIN_FILE where needed.

I presume that under PEP720 the same workflow will be valid, primarily sys.base_exec_prefix would point to the target's implementation, otherwise the document should be clarified on what to expect. I have raised the issue for further clarification 1

Footnotes

  1. https://discuss.python.org/t/pep-720-cross-compiling-python-packages/29988/2

`Python_ROOT_DIR` is used for the find hints for
- `Python_EXECUTABLE`: Unnecessary because we provide `Python_EXECUTABLE` as a cache variable and that has precedence
- `python-config`: should point to the target's variable. Generally this is a shell script which would be executable during cross-compilation (windows case unknown)
- `Python_LIBRARY`: should point to the target's library which would be on the

`crossenv` uses a fake environment so that `sys.base_*_prefix` variables point to the target's system. Presumably PEP720 would work the same.

Signed-off-by: Cristian Le <[email protected]>
@LecrisUT LecrisUT requested a review from henryiii April 22, 2025 15:31
@LecrisUT LecrisUT force-pushed the feat/cross-compile branch from 1acc621 to 3e906b4 Compare April 23, 2025 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant