diff --git a/CHANGELOG.md b/CHANGELOG.md index 62b1ea9c5c78..edf4b18a8011 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Current develop +### Added (new features/APIs/variables/...) +- [[PR 1171]](https://github.com/parthenon-hpc-lab/parthenon/pull/1171) Add PARTHENON_USE_SYSTEM_PACKAGES build option + + ### Changed (changing behavior/API/variables/...) diff --git a/CMakeLists.txt b/CMakeLists.txt index c398d34eae29..24a7a3b2ebfb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ # Copyright(C) 2020-2024 The Parthenon collaboration # Licensed under the 3-clause BSD License, see LICENSE file for details #========================================================================================= -# (C) (or copyright) 2020-2023. Triad National Security, LLC. All rights reserved. +# (C) (or copyright) 2020-2024. Triad National Security, LLC. All rights reserved. # # This program was produced under U.S. Government contract 89233218CNA000001 for Los # Alamos National Laboratory (LANL), which is operated by Triad National Security, LLC @@ -60,6 +60,17 @@ option(CODE_COVERAGE "Enable code coverage reporting" OFF) option(ENABLE_ASAN "Turn on ASAN" OFF) option(ENABLE_HWASAN "Turn on HWASAN (currently ARM-only)" OFF) +option(PARTHENON_USE_SYSTEM_PACKAGES "Enables search for system packages when available" OFF) +if (PARTHENON_USE_SYSTEM_PACKAGES) + option(PARTHENON_IMPORT_KOKKOS + "If ON, attempt to link to an external Kokkos library. If OFF, build Kokkos from source and package with Parthenon" + ON) +else() + option(PARTHENON_IMPORT_KOKKOS + "If ON, attempt to link to an external Kokkos library. If OFF, build Kokkos from source and package with Parthenon" + OFF) +endif() + include(cmake/Format.cmake) include(cmake/Lint.cmake) @@ -204,7 +215,6 @@ endif() set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD 17) -option(PARTHENON_IMPORT_KOKKOS "If ON, attempt to link to an external Kokkos library. If OFF, build Kokkos from source and package with Parthenon" OFF) if (NOT TARGET Kokkos::kokkos) if (PARTHENON_IMPORT_KOKKOS) find_package(Kokkos 4) @@ -367,7 +377,11 @@ if (PARTHENON_ENABLE_UNIT_TESTS OR PARTHENON_ENABLE_INTEGRATION_TESTS OR PARTHEN endif() if (PARTHENON_ENABLE_ASCENT) - find_package(Ascent REQUIRED NO_DEFAULT_PATH) + if (PARTHENON_USE_SYSTEM_PACKAGES) + find_package(Ascent REQUIRED) + else() + find_package(Ascent REQUIRED NO_DEFAULT_PATH) + endif() endif() # Installation configuration diff --git a/doc/sphinx/src/building.rst b/doc/sphinx/src/building.rst index 29559f1b1101..b3a42bd4caec 100644 --- a/doc/sphinx/src/building.rst +++ b/doc/sphinx/src/building.rst @@ -45,7 +45,8 @@ General list of cmake options: || PARTHENON\_COPYRIGHT\_CHECK\_DEFAULT || OFF || Option || Check copyright as part of the default target (otherwise use the `check-copyright` target) | || CMAKE\_INSTALL\_PREFIX || machine specific || String || Optional path for library installation | || Kokkos\_ROOT || unset || String || Path to a Kokkos source directory (containing CMakeLists.txt) | -|| PARTHENON\_IMPORT\_KOKKOS || ON/OFF || Option || If ON, attempt to link to an external Kokkos library. If OFF, build Kokkos from source and package with Parthenon | +|| PARTHENON\_USE\_SYSTEM\_PACKAGES || OFF || Option || If ON, attempt to link to system dependencies for Kokkos and Ascent if possible. If OFF, will avoid doing so by default. | +|| PARTHENON\_IMPORT\_KOKKOS || OFF/ON || Option || If ON, attempt to link to an external Kokkos library. Else build from source. Default is ON if PARTHENON\_USE\_SYSTEM\_PACKAGES and OFF otherwise. | || BUILD\_SHARED\_LIBS || OFF || Option || If installing Parthenon, whether to build as shared rather than static | +-------------------------------------------+--------------------------------+---------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+