Skip to content

Commit

Permalink
compiler: prevent custom compiler from removing host flags as duplict…
Browse files Browse the repository at this point in the history
…ates
  • Loading branch information
mloubout committed Nov 7, 2023
1 parent 7c155e0 commit 586ee8f
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions devito/arch/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -870,14 +870,22 @@ def __new__(cls, *args, **kwargs):
def __init_finalize__(self, **kwargs):
self._base.__init_finalize__(self, **kwargs)
# Update cflags
extrac = environ.get('CFLAGS', '').split(' ')
self.cflags = filter_ordered(self.cflags + extrac)
try:
extrac = environ.get('CFLAGS').split(' ')
self.cflags = self.cflags + extrac
except AttributeError:
pass
# Update ldflags
extrald = environ.get('LDFLAGS', '').split(' ')
self.ldflags = filter_ordered(self.ldflags + extrald)
try:
extrald = environ.get('LDFLAGS').split(' ')
self.ldflags = self.ldflags + extrald
except AttributeError:
pass

def __lookup_cmds__(self):
self._base.__lookup_cmds__(self)
# TODO: check for conflicts, for example using the nvhpc module file
# will set CXX to nvc++ breaking the cuda backend
self.CC = environ.get('CC', self.CC)
self.CXX = environ.get('CXX', self.CXX)
self.MPICC = environ.get('MPICC', self.MPICC)
Expand Down

0 comments on commit 586ee8f

Please sign in to comment.