in include/pyo3/pyo3-build-config/src/impl_.rs [1545:1607]
fn default_cross_compile(cross_compile_config: &CrossCompileConfig) -> Result<InterpreterConfig> {
let version = cross_compile_config
.version
.or_else(get_abi3_version)
.ok_or_else(||
format!(
"PYO3_CROSS_PYTHON_VERSION or an abi3-py3* feature must be specified \
when cross-compiling and PYO3_CROSS_LIB_DIR is not set.\n\
= help: see the PyO3 user guide for more information: https://pyo3.rs/v{}/building-and-distribution.html#cross-compiling",
env!("CARGO_PKG_VERSION")
)
)?;
let abi3 = is_abi3();
let implementation = cross_compile_config
.implementation
.unwrap_or(PythonImplementation::CPython);
let gil_disabled = cross_compile_config.abiflags.as_deref() == Some("t");
let lib_name = default_lib_name_for_target(
version,
implementation,
abi3,
gil_disabled,
&cross_compile_config.target,
);
let mut lib_dir = cross_compile_config.lib_dir_string();
// Auto generate python3.dll import libraries for Windows targets.
#[cfg(feature = "python3-dll-a")]
if lib_dir.is_none() {
let py_version = if implementation == PythonImplementation::CPython && abi3 && !gil_disabled
{
None
} else {
Some(version)
};
lib_dir = self::import_lib::generate_import_lib(
&cross_compile_config.target,
cross_compile_config
.implementation
.unwrap_or(PythonImplementation::CPython),
py_version,
None,
)?;
}
Ok(InterpreterConfig {
implementation,
version,
shared: true,
abi3,
lib_name,
lib_dir,
executable: None,
pointer_width: None,
build_flags: BuildFlags::default(),
suppress_build_script_link_lines: false,
extra_build_script_lines: vec![],
python_framework_prefix: None,
})
}