Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cppstd ported tools #2616

Merged
merged 2 commits into from Jun 29, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
89 changes: 88 additions & 1 deletion reference/conanfile/tools/build.rst
Expand Up @@ -23,7 +23,7 @@ Parameters:


conan.tools.build.can_run()
----------------------------------
---------------------------

.. code-block:: python

Expand All @@ -38,3 +38,90 @@ It's an useful feature for the case your architecture can run more than one targ
Parameters:

- **conanfile**: Conanfile object, use always ``self``.


conan.tools.build.check_min_cppstd
----------------------------------


.. code-block:: python

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
lasote marked this conversation as resolved.
Show resolved Hide resolved
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.
lasote marked this conversation as resolved.
Show resolved Hide resolved

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
----------------------------------


.. code-block:: python

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
lasote marked this conversation as resolved.
Show resolved Hide resolved
----------------------------------

.. code-block:: python

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
----------------------------------

.. code-block:: python

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