conan.tools.build

conan.tools.build.cross_building()

def cross_building(conanfile=None, skip_x64_x86=False):

Check it we are cross building comparing the build and host settings. Returns True in the case that we are cross-building.

Parameters:

  • conanfile: Conanfile object, use always self.

  • skip_x64_x86: Will not consider the as cross-building the case of building in 64 bit architecture for 32 bit architecture, like build_arch=x86_64 and host_arch=x86 for example.

conan.tools.build.can_run()

def can_run(conanfile):

Validates whether is possible to run a non-native app on the same architecture. It returns the configuration value for tools.build.cross_building:can_run if exists, otherwise, it returns False if we are cross-building, else, True.

It’s an useful feature for the case your architecture can run more than one target. For instance, Mac M1 machines can run both armv8 and x86_64.

Parameters:

  • conanfile: Conanfile object, use always self.