Skip to content

Commit

Permalink
Make LD_LIBRARY_PATH optional, set RPATH LINK PATH to True
Browse files Browse the repository at this point in the history
  • Loading branch information
wortiz committed Nov 12, 2024
1 parent 9908a20 commit 5aae464
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1043,6 +1043,9 @@ set_source_files_properties(
src/dp_ghost.cpp src/sl_epetra_util.cpp src/adapt/omega_h_interface.cpp
PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON)

# Most people probably want this for use with Goma TPLs
set( CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE )

add_library(goma_user ${GOMA_USER_SOURCES} ${GOMA_USER_INCLUDES})
target_include_directories(goma_user PUBLIC include)
target_include_directories(goma_user SYSTEM PRIVATE ${GOMA_TPL_INCLUDES})
Expand Down Expand Up @@ -1159,6 +1162,9 @@ if(ENABLE_WARNINGS)
-Wimplicit-fallthrough>)
endif()


include(GNUInstallDirs)

install(
TARGETS goma_exe fix_exe
LIBRARY DESTINATION lib
Expand Down
11 changes: 9 additions & 2 deletions tpls/install-tpls.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,13 @@
action="store_true",
)
parser.set_defaults(skip_ssl_verify=False)
parser.add_argument(
"--write-dynamic-library-path",
help="Writes (DY)LD_LIBRARY_PATH to config, default is off",
dest="write_dynamic_library_path",
action="store_true",
)
parser.set_defaults(write_dynamic_library_path=False)

for p in packages:
pm = importlib.import_module("tpl_tools." + ".".join(["packages", p]))
Expand Down Expand Up @@ -249,12 +256,12 @@
tpl_registry.config.write_config(os.path.join(install_dir, "config.sh"))
logger.log(
"Bash config written to {}, source with bash".format(
os.path.join(install_dir, "config.sh")
os.path.join(install_dir, "config.sh"), args.write_dynamic_library_path
)
)

tpl_registry.config.write_config(
os.path.join(install_dir, "config.fish"), shell="fish"
os.path.join(install_dir, "config.fish"), shell="fish", args.write_dynamic_library_path
)
logger.log(
"Fish config written to {}, source with fish".format(
Expand Down
6 changes: 3 additions & 3 deletions tpls/tpl_tools/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ def append_environment_variable(self, variable, value):
else:
self.environment[variable] = value

def write_config(self, file, shell="bash"):
def write_config(self, file, shell="bash", write_dynamic_library_path=True):
with open(file, "w") as f:
if shell == "bash":
for k in self.environment.keys():
if k == dynamic_library_path():
continue
if k == "CMAKE_PREFIX_PATH":
if k == "CMAKE_PREFIX_PATH" and write_dynamic_library_path:
f.write("export {}=".format(dynamic_library_path()))
for item in self.environment[k]:
for lib in ["lib", "lib64"]:
Expand All @@ -57,7 +57,7 @@ def write_config(self, file, shell="bash"):
for k in self.environment.keys():
if k == dynamic_library_path():
continue
if k == "CMAKE_PREFIX_PATH":
if k == "CMAKE_PREFIX_PATH" and write_dynamic_library_path:
f.write("set -x {} ".format(dynamic_library_path()))
for item in self.environment[k]:
for lib in ["lib", "lib64"]:
Expand Down

0 comments on commit 5aae464

Please sign in to comment.