diff --git a/CMakeLists.txt b/CMakeLists.txt index 141edbcd..c590495a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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}) @@ -1159,6 +1162,9 @@ if(ENABLE_WARNINGS) -Wimplicit-fallthrough>) endif() + +include(GNUInstallDirs) + install( TARGETS goma_exe fix_exe LIBRARY DESTINATION lib diff --git a/tpls/install-tpls.py b/tpls/install-tpls.py index d97e3367..187d1f52 100755 --- a/tpls/install-tpls.py +++ b/tpls/install-tpls.py @@ -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])) @@ -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( diff --git a/tpls/tpl_tools/registry.py b/tpls/tpl_tools/registry.py index c87871b7..715d9f6f 100644 --- a/tpls/tpl_tools/registry.py +++ b/tpls/tpl_tools/registry.py @@ -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"]: @@ -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"]: