diff --git a/devito/arch/compiler.py b/devito/arch/compiler.py index 99a14704c20..7ec1d3da5b1 100644 --- a/devito/arch/compiler.py +++ b/devito/arch/compiler.py @@ -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)