Skip to content

Commit

Permalink
arch: add rpath option to include_dirs
Browse files Browse the repository at this point in the history
  • Loading branch information
mloubout committed Oct 9, 2024
1 parent 74f3496 commit 8aeca8a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 5 additions & 1 deletion devito/arch/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,8 +398,12 @@ def __getstate__(self):
def add_include_dirs(self, dirs):
self.include_dirs = filter_ordered(self.include_dirs + as_list(dirs))

def add_library_dirs(self, dirs):
def add_library_dirs(self, dirs, rpath=False):
self.library_dirs = filter_ordered(self.library_dirs + as_list(dirs))
if rpath:
# Add rpath flag to embed library dir
for d in as_list(dirs):
self.ldflags.append('-Wl,-rpath,%s' % d)

def add_libraries(self, libs):
self.libraries = filter_ordered(self.libraries + as_list(libs))
Expand Down
3 changes: 2 additions & 1 deletion devito/passes/iet/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ def apply(self, func, **kwargs):
compiler = kwargs['compiler']
compiler.add_include_dirs(as_tuple(metadata.get('include_dirs')))
compiler.add_libraries(as_tuple(metadata.get('libs')))
compiler.add_library_dirs(as_tuple(metadata.get('lib_dirs')))
compiler.add_library_dirs(as_tuple(metadata.get('lib_dirs')),
rpath=metadata.get('rpath', False))
except KeyError:
pass

Expand Down

0 comments on commit 8aeca8a

Please sign in to comment.