fn is_cross_compiling_from_to()

in include/pyo3/pyo3-build-config/src/impl_.rs [952:971]


    fn is_cross_compiling_from_to(host: &Triple, target: &Triple) -> bool {
        // Not cross-compiling if arch-vendor-os is all the same
        // e.g. x86_64-unknown-linux-musl on x86_64-unknown-linux-gnu host
        //      x86_64-pc-windows-gnu on x86_64-pc-windows-msvc host
        let mut compatible = host.architecture == target.architecture
            && host.vendor == target.vendor
            && host.operating_system == target.operating_system;

        // Not cross-compiling to compile for 32-bit Python from windows 64-bit
        compatible |= target.operating_system == OperatingSystem::Windows
            && host.operating_system == OperatingSystem::Windows
            && matches!(target.architecture, Architecture::X86_32(_))
            && host.architecture == Architecture::X86_64;

        // Not cross-compiling to compile for x86-64 Python from macOS arm64 and vice versa
        compatible |= matches!(target.operating_system, OperatingSystem::Darwin(_))
            && matches!(host.operating_system, OperatingSystem::Darwin(_));

        !compatible
    }