diff --git a/CMakeLists.txt b/CMakeLists.txt index a0face6..5077f46 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -119,6 +119,11 @@ if(ARTEMIS_ENABLE_ASAN) add_link_options(-fsanitize=address -fsanitize=undefined) endif() +if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") + # silence sprintf warnings on mac + add_compile_options(-Wno-deprecated-declarations) +endif() + # NOTE(@jonahm): For some reason, order still matters for including # parthenon and singularity. Likely has to do with project # includes other than Kokkos. MPI and OpenMP likely culprits. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 95133ac..5c602e5 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -144,8 +144,15 @@ if (CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) message(STATUS "Standalone mode. Adding artemis executable") add_executable(artemis main.cpp) target_link_libraries(artemis PRIVATE artemislib) - add_custom_command(TARGET artemis POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy - ${CMAKE_BINARY_DIR}/rebound/librebound.so - $) + + # Bake in rpath to rebound on mac + if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") + set_target_properties(artemis PROPERTIES + BUILD_RPATH "${CMAKE_BINARY_DIR}/rebound" + ) + add_custom_command(TARGET artemis POST_BUILD + COMMAND install_name_tool -add_rpath @executable_path/../rebound $ + COMMAND install_name_tool -change librebound.so @rpath/librebound.so $ + ) + endif() endif() diff --git a/tst/run_tests.py b/tst/run_tests.py index 5ff0866..fddb8ca 100755 --- a/tst/run_tests.py +++ b/tst/run_tests.py @@ -157,10 +157,6 @@ def main(**kwargs): # Build working directory and copy librebound.so into working directory os.makedirs(artemis.get_outputs_dir(), exist_ok=True) - reb_path = os.path.join(artemis.get_exe_dir(), "librebound.so") - if not os.path.exists(reb_path): - raise TestError(f'librebound.so not found at "{reb_path}"!') - shutil.copy(reb_path, artemis.get_outputs_dir()) # Run each test for name in test_names: @@ -294,7 +290,6 @@ def set_globals(args): if exe_path is not None: adir = os.path.join(artemis.get_artemis_dir(), "tst") out_dir = os.path.join(adir, "testing") if out_dir is None else out_dir - reb_path = os.path.join(os.path.dirname(exe_path), "librebound.so") if use_cwd: raise TestError("--cwd and --exe=PATH cannot be passed together!") @@ -302,9 +297,6 @@ def set_globals(args): if not (os.path.exists(exe_path) and os.access(exe_path, os.X_OK)): raise TestError(f'Provided exe "{exe_path}" not found or cannot be run!') - if not os.path.exists(reb_path): - raise TestError(f'librebound.so not found at "{reb_path}"!') - abs_out_dir = os.path.abspath(out_dir) abs_exe_dir = os.path.abspath(os.path.dirname(exe_path)) artemis.set_paths(abs_exe_dir, abs_out_dir) @@ -318,10 +310,6 @@ def set_globals(args): if os.path.isfile(lpath_exe) and os.access(lpath_exe, os.X_OK): exe_path = lpath_exe out_dir = os.path.join(cwd, "testing") if out_dir is None else out_dir - reb_path = os.path.join(os.path.dirname(exe_path), "librebound.so") - - if not os.path.exists(reb_path): - raise TestError(f'librebound.so not found at "{reb_path}"!') abs_out_dir = os.path.abspath(out_dir) abs_exe_dir = os.path.abspath(os.path.dirname(exe_path)) @@ -331,14 +319,10 @@ def set_globals(args): # Check if we are one level up from the executable exe_path = read_cmakecache(lpath_cache) out_dir = os.path.join(cwd, "testing") if out_dir is None else out_dir - reb_path = os.path.join(os.path.dirname(exe_path), "librebound.so") if not (os.path.exists(exe_path) and os.access(exe_path, os.X_OK)): raise TestError(f'No exe in "{exe_path}" or cannot be run!') - if not os.path.exists(reb_path): - raise TestError(f'librebound.so not found at "{reb_path}"!') - abs_out_dir = os.path.abspath(out_dir) abs_exe_dir = os.path.abspath(os.path.dirname(exe_path)) artemis.set_paths(abs_exe_dir, abs_out_dir)