Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

arch: add rpath option to include_dirs #2466

Merged
merged 1 commit into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading