Automatically generate `python3.dll` import libraries for Windows
compile targets in the build script.
Adds a new PyO3 crate feature `generate-abi3-import-lib` enabling
automatic import library generation.
Closes#2231
According to https://bugs.python.org/issue36707, this tag is useless
since version 3.4, but also the default until version 3.8.
For example, Debian 10 ships `libpython3.7m.so`.
This patch folds the `PYO3_NO_PYTHON` + `abi3` special case into
the existing native and cross compilation code paths.
The cross compilation route is now guaranteed to behave the same
whether `PYO3_NO_PYTHON` is set or not (except for sysconfigdata
discovery for the Unix targets).
The native compilation route now stores the hardcoded abi3 interpreter
configuration in place of the discovered configuration blob.
Adds a new cross-compile target interpreter configuration
environment variable.
This feature allows PyO3 to target PyPy on both Windows and Unix
cross compile targets.
Rename `$OUT_DIR/pyo3-cross-compile-config.txt` to
`$OUT_DIR/<triple>/pyo3-build-config.txt` to exclude the possibility
of using stale build configuration data when the build target changes.
Use the presence of the corresponding build configuration file
in the `pyo3-build-config` build script output directory
to detect whether we are cross compiling or not.
This patch enables cross compilation without using
any of `PYO3_CROSS_*` env variables in many cases.
Try to generalize `windows_hardcoded_cross_compile()`
to all supported target platforms (when possible).
Rename it to `default_cross_compile()` and add some unit tests.
Rewrite `load_cross_compile_config()` to fall back to
the default interpreter configuration when no other config
information sources are available.
Change the `CrossCompileConfig` structure definition and make
the public `lib_dir` field optional to support more flexible
cross-compilation configuration in the future.
FIXME: This change breaks the public `pyo3-build-config` crate API.
Update the sysconfigdata extraction functions to fall through
when `lib_dir` field is not set.
WIP: Add `unwrap()` stubs to the main cross compile switch.
Add a new public crate function `cross_compile_from_to()` using
`target_lexicon::Triple` arguments instead of plain strings
used in `cross_compile()`.
Deprecate `pyo3_build_config::cross_compile()` since v0.17.
Attempt to extract common code patterns into methods and standalone
helper functions. Add docstrings to the new private items.
Make some of the new helper functions public within the PyO3 crate
and reuse them in the build scripts.
Add PYO3_CROSS_PYTHON_VERSION parsing unit test.
Add a ChangeLog entry mentioning the new `pyo3-build-config` API.
* Initial refactor - expose cross-compiling functions and add necessary fields to InterpreterConfig
* Refactor cross_compiling to take arch/vendor/os separately.
* Address review comments.
* Update changelog with note about pyo3-build-config APIs.
* Fix panic when parsing ABI tag on Windows.
* Update parse_sysconfigdata test to best-guess values for linux.
* Revert added fields in InterpreterConfig.
* Refactor parse_sysconfigdata to return Sysconfigdata (HashMap). Add InterpreterConfig::from_sysconfigdata.
* Update BuildFlags test to use from_sysconfigdata.
* Add tests for from_sysconfigdata. Refactor Sysconfigdata API to be more open.
* Add basic tests for not cross compiling. Add some error handling.
* Address review comments.
* Update search_lib_dir to recurse into lib and pypy dirs.
* Look even harder for sysconfigdata.
* Add skip-build-config feature.
* Revert skip-build-config feature.
* Suppress cargo:rerun-if-env-changed without resolve-config feature.