Skip to content

Commit 4f56b2d

Browse files
committed
Compiler: append cflags and ldflags from configuration
1 parent 187f250 commit 4f56b2d

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

pyop2/compilation.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,10 @@ class Compiler(object):
5050
:arg ld: Linker executable (optional, if ``None``, we assume the compiler
5151
can build object files and link in a single invocation, can be
5252
overridden by exporting the environment variable ``LDSHARED``).
53-
:arg cppargs: A list of arguments to the C compiler (optional).
54-
:arg ldargs: A list of arguments to the linker (optional).
53+
:arg cppargs: A list of arguments to the C compiler (optional, prepended to
54+
any flags specified as the cflags configuration option)
55+
:arg ldargs: A list of arguments to the linker (optional, prepended to any
56+
flags specified as the ldflags configuration option).
5557
:arg cpp: Should we try and use the C++ compiler instead of the C
5658
compiler?.
5759
"""
@@ -60,8 +62,8 @@ def __init__(self, cc, ld=None, cppargs=[], ldargs=[],
6062
ccenv = 'CXX' if cpp else 'CC'
6163
self._cc = os.environ.get(ccenv, cc)
6264
self._ld = os.environ.get('LDSHARED', ld)
63-
self._cppargs = cppargs
64-
self._ldargs = ldargs
65+
self._cppargs = cppargs + configuration['cflags'].split()
66+
self._ldargs = ldargs + configuration['ldflags'].split()
6567

6668
@collective
6769
def get_so(self, src, extension):

0 commit comments

Comments
 (0)