File tree Expand file tree Collapse file tree 2 files changed +34
-0
lines changed
Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,23 @@ fn main() {
2929A compatible ` python3.dll ` import library will be automatically created in
3030the directory pointed by ` PYO3_CROSS_LIB_DIR ` environment variable.
3131
32+ If both 64-bit and 32-bit Windows cross-compile targets support is needed,
33+ the more generic ` generate_implib_for_target() ` function must be used:
34+
35+ ``` rust
36+ fn main () {
37+ if std :: env :: var (" CARGO_CFG_TARGET_OS" ). unwrap () == " windows"
38+ && std :: env :: var (" CARGO_CFG_TARGET_ENV" ). unwrap () == " gnu"
39+ {
40+ let libdir = std :: env :: var (" PYO3_CROSS_LIB_DIR" )
41+ . expect (" PYO3_CROSS_LIB_DIR is not set when cross-compiling" );
42+ let arch = std :: env :: var (" CARGO_CFG_TARGET_ARCH" ). unwrap ();
43+ python3_dll_a :: generate_implib_for_target (& libdir , & arch , " gnu" )
44+ . expect (" python3.dll import library generator failed" );
45+ }
46+ }
47+ ```
48+
3249Example ` cargo build ` invocation
3350--------------------------------
3451
Original file line number Diff line number Diff line change 2929//! A compatible `python3.dll` import library will be automatically created in
3030//! the directory pointed by `PYO3_CROSS_LIB_DIR` environment variable.
3131//!
32+ //! If both 64-bit and 32-bit Windows cross-compile targets support is needed,
33+ //! the more generic `generate_implib_for_target()` function must be used:
34+ //!
35+ //! ```no_run
36+ //! fn main() {
37+ //! if std::env::var("CARGO_CFG_TARGET_OS").unwrap() == "windows"
38+ //! && std::env::var("CARGO_CFG_TARGET_ENV").unwrap() == "gnu"
39+ //! {
40+ //! let libdir = std::env::var("PYO3_CROSS_LIB_DIR")
41+ //! .expect("PYO3_CROSS_LIB_DIR is not set when cross-compiling");
42+ //! let arch = std::env::var("CARGO_CFG_TARGET_ARCH").unwrap();
43+ //! python3_dll_a::generate_implib_for_target(&libdir, &arch, "gnu")
44+ //! .expect("python3.dll import library generator failed");
45+ //! }
46+ //! }
47+ //! ```
48+ //!
3249//! Example `cargo build` invocation
3350//! --------------------------------
3451//!
You can’t perform that action at this time.
0 commit comments