Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@
[submodule "utils/kokkos-kernels"]
path = utils/kokkos-kernels
url = https://github.com/kokkos/kokkos-kernels.git
[submodule "utils/pybind11"]
path = utils/pybind11
url = https://github.com/pybind/pybind11.git
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
### Changed (changing behavior/API/variables/...)

### Infrastructure (changes irrelevant to downstream codes)
- [[PR653]](https://github.com/lanl/singularity-eos/pull/653) Move pybind11 to a submodule rather than fetching it via cmake fetchcontent

### Deprecated (soon to be removed behavior/API/variables/...)

Expand Down
15 changes: 15 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ include(singularity-eos/hdf5)
include(singularity-eos/kokkos)
include(singularity-eos/spiner)
include(singularity-eos/ports-of-call)
include(singularity-eos/pybind11)

add_library(singularity-eos INTERFACE)
add_library(singularity-eos::singularity-eos ALIAS singularity-eos)
Expand Down Expand Up @@ -294,6 +295,10 @@ endif()
# Must happen before building singularity-utils (which needs ports-of-call and spiner)
# Dependency order: Kokkos -> ports-of-call -> spiner -> singularity-utils

if (SINGULARITY_BUILD_PYTHON)
find_package(Python COMPONENTS Interpreter Development REQUIRED)
endif()

if(SINGULARITY_SUBMODULE_MODE)
# add all submodules
message(STATUS "singularity-eos configuring in submodule mode.")
Expand All @@ -318,6 +323,11 @@ if(SINGULARITY_SUBMODULE_MODE)
if(SINGULARITY_USE_EIGEN)
singularity_import_eigen()
endif()

# And pybind11 (if needed)
if (SINGULARITY_BUILD_PYTHON)
singularity_import_pybind11()
endif()
else()
# use system packages

Expand All @@ -341,6 +351,11 @@ else()
if(SINGULARITY_USE_EIGEN)
singularity_find_eigen()
endif()

# And pybind11 (if needed)
if (SINGULARITY_BUILD_PYTHON)
singularity_find_pybind11()
endif()
endif()

# Build singularity-utils first - it's a dependency for both
Expand Down
24 changes: 24 additions & 0 deletions cmake/singularity-eos/pybind11.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# ------------------------------------------------------------------------------#
# © 2021-2026. Triad National Security, LLC. All rights reserved. This program
Comment thread
Yurlungur marked this conversation as resolved.
Outdated
# was produced under U.S. Government contract 89233218CNA000001 for Los Alamos
# National Laboratory (LANL), which is operated by Triad National Security, LLC
# for the U.S. Department of Energy/National Nuclear Security Administration.
# All rights in the program are reserved by Triad National Security, LLC, and
# the U.S. Department of Energy/National Nuclear Security Administration. The
# Government is granted for itself and others acting on its behalf a
# nonexclusive, paid-up, irrevocable worldwide license in this material to
# reproduce, prepare derivative works, distribute copies to the public, perform
# publicly and display publicly, and to permit others to do so.
# ------------------------------------------------------------------------------#

macro(singularity_import_pybind11)
if(NOT TARGET pybind11::headers)
message(STATUS "Using pybind11 submodule")
add_subdirectory(utils/pybind11)
endif()
endmacro()

macro(singularity_find_pybind11)
message(STATUS "Searching for system pybind11")
find_package(pybind11 REQUIRED)
endmacro()
28 changes: 12 additions & 16 deletions python/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
find_package(Python COMPONENTS Interpreter Development REQUIRED)
find_package(pybind11 CONFIG QUIET)

if(NOT pybind11_FOUND)
message(STATUS "No pybind11 installation found, fetching from GitHub.")
include(FetchContent)
FetchContent_Declare(pybind11
GIT_REPOSITORY https://github.com/pybind/pybind11
GIT_TAG v2.9.2
)
FetchContent_GetProperties(pybind11)
if(NOT pybind11_POPULATED)
FetchContent_Populate(pybind11)
add_subdirectory(${pybind11_SOURCE_DIR} ${pybind11_BINARY_DIR})
endif()
endif()
# ------------------------------------------------------------------------------#
# © 2021-2026. Triad National Security, LLC. All rights reserved. This program
Comment thread
Yurlungur marked this conversation as resolved.
Outdated
# was produced under U.S. Government contract 89233218CNA000001 for Los Alamos
# National Laboratory (LANL), which is operated by Triad National Security, LLC
# for the U.S. Department of Energy/National Nuclear Security Administration.
# All rights in the program are reserved by Triad National Security, LLC, and
# the U.S. Department of Energy/National Nuclear Security Administration. The
# Government is granted for itself and others acting on its behalf a
# nonexclusive, paid-up, irrevocable worldwide license in this material to
# reproduce, prepare derivative works, distribute copies to the public, perform
# publicly and display publicly, and to permit others to do so.
# ------------------------------------------------------------------------------#

pybind11_add_module(singularity_eos
module.cpp
Expand Down
1 change: 1 addition & 0 deletions utils/pybind11
Submodule pybind11 added at 782bba
Loading