Skip to content

Commit

Permalink
Merge pull request #3137 from memsharded/feature/cmd_wrapper_conanfil…
Browse files Browse the repository at this point in the history
…e_arg

add conanfile arg to cmd_wrapper()
  • Loading branch information
AbrilRBS authored Mar 29, 2023
2 parents c775a9c + 7936652 commit 38c18e3
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions reference/extensions/command_wrapper.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,17 @@ which could look like:
return 'parallel-build "{}" --parallel-argument'.format(cmd)
# otherwise return same command, not modified
return cmd
The ``conanfile`` object is passed as an argument, so it is possible to customize the behavior
depending on the caller:

.. code-block:: python
def cmd_wrapper(cmd, conanfile, **kwargs):
# Let's parallelize only CMake invocations, for a few specific heavy packages
name = conanfile.ref.name
heavy_pkgs = ["qt", "boost", "abseil", "opencv", "ffmpeg"]
if cmd.startswith("cmake") and name in heavy_pkgs:
return 'parallel-build "{}" --parallel-argument'.format(cmd)
# otherwise return same command, not modified
return cmd

0 comments on commit 38c18e3

Please sign in to comment.