Skip to content

Commit

Permalink
extension: add hawkmoth_clang_c and hawkmoth_clang_cpp config options
Browse files Browse the repository at this point in the history
Add config options hawkmoth_clang_c and hawkmoth_clang_cpp to pass
arguments to clang in the C and C++ domains, respectively.

Fixes #255
  • Loading branch information
jnikula committed Sep 14, 2024
1 parent 6e79c8a commit 5f61e5d
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ Unreleased `master`_

:Date: YYYY-MM-DD

Added
~~~~~

* Domain specific config options ``hawkmoth_clang_c`` and
``hawkmoth_clang_cpp``.

Changed
~~~~~~~

Expand Down
12 changes: 12 additions & 0 deletions doc/extension.rst
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,18 @@ See also additional configuration options in the :ref:`built-in extensions
You can also pass in the compiler to use, for example
``get_include_args('gcc')``.

.. py:data:: hawkmoth_clang_c
:type: list

Arguments to pass to ``clang`` after :data:`hawkmoth_clang` in the C domain
only.

.. py:data:: hawkmoth_clang_cpp
:type: list

Arguments to pass to ``clang`` after :data:`hawkmoth_clang` in the C++ domain
only.

.. py:data:: hawkmoth_source_uri
:type: str

Expand Down
7 changes: 7 additions & 0 deletions src/hawkmoth/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ def __get_clang_args(self):

clang_args.extend(self.env.config.hawkmoth_clang.copy())

if self._domain == 'c':
clang_args.extend(self.env.config.hawkmoth_clang_c.copy())
else:
clang_args.extend(self.env.config.hawkmoth_clang_cpp.copy())

clang_args.extend(self.options.get('clang', []))

return clang_args
Expand Down Expand Up @@ -353,6 +358,8 @@ def setup(app):

app.add_config_value('hawkmoth_root', app.confdir, 'env', [str])
app.add_config_value('hawkmoth_clang', [], 'env', [list])
app.add_config_value('hawkmoth_clang_c', [], 'env', [list])
app.add_config_value('hawkmoth_clang_cpp', [], 'env', [list])

app.add_config_value('hawkmoth_transform_default', None, 'env', [str])

Expand Down

0 comments on commit 5f61e5d

Please sign in to comment.