From cc26c2943dedd1fe38c9b32e9a52014c3be18a93 Mon Sep 17 00:00:00 2001 From: Jonah Maxwell Miller Date: Mon, 31 Aug 2026 16:52:40 -0400 Subject: [PATCH 1/6] update to use pybind11 submodule --- .gitmodules | 3 +++ CMakeLists.txt | 15 +++++++++++++++ cmake/singularity-eos/pybind11.cmake | 11 +++++++++++ python/CMakeLists.txt | 17 ----------------- utils/pybind11 | 1 + 5 files changed, 30 insertions(+), 17 deletions(-) create mode 100644 cmake/singularity-eos/pybind11.cmake create mode 160000 utils/pybind11 diff --git a/.gitmodules b/.gitmodules index b851cbc2f66..8aaf27b1c93 100644 --- a/.gitmodules +++ b/.gitmodules @@ -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 diff --git a/CMakeLists.txt b/CMakeLists.txt index 18e9c4cc011..bdffedefef6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) @@ -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.") @@ -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 @@ -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 diff --git a/cmake/singularity-eos/pybind11.cmake b/cmake/singularity-eos/pybind11.cmake new file mode 100644 index 00000000000..1fbc3f5d7da --- /dev/null +++ b/cmake/singularity-eos/pybind11.cmake @@ -0,0 +1,11 @@ +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() diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index a47517741f8..9a8a5676816 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -1,20 +1,3 @@ -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() - pybind11_add_module(singularity_eos module.cpp modifier_shifted.cpp diff --git a/utils/pybind11 b/utils/pybind11 new file mode 160000 index 00000000000..782bba5a439 --- /dev/null +++ b/utils/pybind11 @@ -0,0 +1 @@ +Subproject commit 782bba5a4399e56e0dd9b6fd6b9402c4c901343a From b072e532bbc954a98a7a6a2758d9b3f431b70c8c Mon Sep 17 00:00:00 2001 From: Jonah Maxwell Miller Date: Mon, 31 Aug 2026 16:58:12 -0400 Subject: [PATCH 2/6] changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d9167046b71..607c5a92104 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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/...) From af1459a0892df5cf985859db5e09dc95bd533945 Mon Sep 17 00:00:00 2001 From: Jonah Maxwell Miller Date: Mon, 31 Aug 2026 16:59:12 -0400 Subject: [PATCH 3/6] CC --- cmake/singularity-eos/pybind11.cmake | 13 +++++++++++++ python/CMakeLists.txt | 13 +++++++++++++ 2 files changed, 26 insertions(+) diff --git a/cmake/singularity-eos/pybind11.cmake b/cmake/singularity-eos/pybind11.cmake index 1fbc3f5d7da..23c60d67386 100644 --- a/cmake/singularity-eos/pybind11.cmake +++ b/cmake/singularity-eos/pybind11.cmake @@ -1,3 +1,16 @@ +# ------------------------------------------------------------------------------# +# © 2021-2026. 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 +# 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") diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 9a8a5676816..dcfa2e80bca 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -1,3 +1,16 @@ +# ------------------------------------------------------------------------------# +# © 2021-2026. 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 +# 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 modifier_shifted.cpp From 136e15e1438804d1bec0158371d0f0516db71127 Mon Sep 17 00:00:00 2001 From: Jonah Maxwell Miller Date: Tue, 1 Sep 2026 12:00:36 -0400 Subject: [PATCH 4/6] pin pybind11 to release 3.0 rather than to develop branch --- utils/pybind11 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/pybind11 b/utils/pybind11 index 782bba5a439..d03662f0984 160000 --- a/utils/pybind11 +++ b/utils/pybind11 @@ -1 +1 @@ -Subproject commit 782bba5a4399e56e0dd9b6fd6b9402c4c901343a +Subproject commit d03662f0984f652b60e7ddce53d3868002275197 From 17b346cd35e0665d62a2e4dbffdb1feba77a9ef2 Mon Sep 17 00:00:00 2001 From: Jonah Miller Date: Tue, 1 Sep 2026 19:22:36 -0400 Subject: [PATCH 5/6] Update python/CMakeLists.txt Co-authored-by: Adam M. Dempsey --- python/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index dcfa2e80bca..d3ae70bfda1 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -1,5 +1,5 @@ # ------------------------------------------------------------------------------# -# © 2021-2026. Triad National Security, LLC. All rights reserved. This program +# © 2022-2026. 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 # for the U.S. Department of Energy/National Nuclear Security Administration. From d155a27ecc3ba3a36dd5302e8507822fd6c99347 Mon Sep 17 00:00:00 2001 From: Jonah Miller Date: Tue, 1 Sep 2026 19:22:45 -0400 Subject: [PATCH 6/6] Update cmake/singularity-eos/pybind11.cmake Co-authored-by: Adam M. Dempsey --- cmake/singularity-eos/pybind11.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/singularity-eos/pybind11.cmake b/cmake/singularity-eos/pybind11.cmake index 23c60d67386..ead61353008 100644 --- a/cmake/singularity-eos/pybind11.cmake +++ b/cmake/singularity-eos/pybind11.cmake @@ -1,5 +1,5 @@ # ------------------------------------------------------------------------------# -# © 2021-2026. Triad National Security, LLC. All rights reserved. This program +# © 2026. 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 # for the U.S. Department of Energy/National Nuclear Security Administration.