Skip to content

Latest commit

 

History

History
127 lines (71 loc) · 3.85 KB

build.rst

File metadata and controls

127 lines (71 loc) · 3.85 KB

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.

conan.tools.build.check_min_cppstd

def check_min_cppstd(conanfile, cppstd, gnu_extensions=False)

Check if current cppstd fits the minimal version required. In case the current cppstd doesn't fit the minimal version required by cppstd, a ConanInvalidConfiguration exception will be raised.

  1. If settings.compiler.cppstd, the tool will use settings.compiler.cppstd to compare
  2. It not settings.compiler.cppstd, the tool will use compiler to compare (reading the default from cppstd_default)
  3. If not settings.compiler is present (not declared in settings) will raise because it cannot compare.
  4. If can not detect the default cppstd for settings.compiler, a exception will be raised.

Parameters:

  • conanfile: The current recipe object. Always use self.
  • cppstd: Minimal cppstd version required.
  • gnu_extensions: GNU extension is required (e.g gnu17).

conan.tools.build.valid_min_cppstd

def valid_min_cppstd(conanfile, cppstd, gnu_extensions=False)

Validate if current cppstd fits the minimal version required. Return True, if current cppstd matches the required cppstd version. Otherwise, False.

Parameters:

  • conanfile: The current recipe object. Always use self.
  • cppstd: Minimal cppstd version required
  • gnu_extensions: GNU extension is required (e.g gnu17). This option ONLY works on Linux.

conan.tools.build.default_cppstd

def default_cppstd(conanfile, compiler=None, compiler_version=None):

Get the default compiler.cppstd for the "conanfile.settings.compiler" and "conanfile settings.compiler_version" or for the parameters "compiler" and "compiler_version" if specified. Returns the default compiler.cppstd for the specified compiler.

Parameters:

  • conanfile: The current recipe object. Always use self.
  • compiler: Name of the compiler e.g. gcc
  • compiler_version: Version of the compiler e.g. 12

conan.tools.build.supported_cppstd

def supported_cppstd(conanfile, compiler=None, compiler_version=None):

Get the a list of supported compiler.cppstd for the "conanfile.settings.compiler" and "conanfile.settings.compiler_version" or for the parameters "compiler" and "compiler_version" if specified. Returns a list of supported cppstd values.

Parameters:

  • conanfile: The current recipe object. Always use self.
  • compiler: Name of the compiler e.g: gcc
  • compiler_version: Version of the compiler e.g: 12