File indexing completed on 2025-02-16 05:12:09
0001 0002 def cross_building(conanfile=None, skip_x64_x86=False): 0003 0004 build_os, build_arch, host_os, host_arch = get_cross_building_settings(conanfile) 0005 0006 if skip_x64_x86 and host_os is not None and (build_os == host_os) and \ 0007 host_arch is not None and ((build_arch == "x86_64") and (host_arch == "x86") or 0008 (build_arch == "sparcv9") and (host_arch == "sparc") or 0009 (build_arch == "ppc64") and (host_arch == "ppc32")): 0010 return False 0011 0012 if host_os is not None and (build_os != host_os): 0013 return True 0014 if host_arch is not None and (build_arch != host_arch): 0015 return True 0016 0017 return False 0018 0019 0020 def get_cross_building_settings(conanfile): 0021 # FIXME: Develop2 this shouldn't go in develop2 where the build settings always exists 0022 # Keep the current develop2 implementation for the whole module while merging 0023 os_host = conanfile.settings.get_safe("os") 0024 arch_host = conanfile.settings.get_safe("arch") 0025 0026 if hasattr(conanfile, 'settings_build'): 0027 return (conanfile.settings_build.get_safe('os'), conanfile.settings_build.get_safe('arch'), 0028 os_host, arch_host) 0029 else: 0030 return os_host, arch_host, os_host, arch_host