Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

install nlohmann/json from package like ROOT does #117

Merged
merged 2 commits into from
Mar 24, 2025

Conversation

tomeichlersmith
Copy link
Member

@tomeichlersmith tomeichlersmith commented Mar 19, 2025

I am adding a new package to the container, here are the details.
ROOT will build in nlohmann/json if it is not available already and we want a JSON reader/writer anyways, so I'm installing it from Ubuntu repos like ROOT does in its official images.

What new packages does this PR add to the development image?

  • nlohmann/json

Check List

  • I CI successfully built the container using docker
  • I CI was able to build ldmx-sw using this new container build
  • I CI was able to test run a small simulation and reconstruction inside this container
  • I was able to successfully use the new packages.

I wanted to make sure that we could use find_package in ldmx-sw to deduce if nlohmann/json is available.
If it isn't, we could then use FetchContent to make sure that ldmx-sw can still be built with older images.
Added a line to ldmx-sw/CMakeLists.txt:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index e3e0c698..98e427e9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -23,6 +23,8 @@ project(LDMX_SW VERSION ${LDMXSW_VERSION_NUM}
                 LANGUAGES CXX    
 )
 
+find_package(nlohmann_json 3.10.5 REQUIRED)
+
 set(CMAKE_CXX_STANDARD 20)
 
 # Load additional macros used by this project. 

which gives (when running just configure after just use ldmx/dev:global-install-nlohmann-json):

-- Found nlohmann_json: /usr/share/cmake/nlohmann_json/nlohmann_jsonConfig.cmake (found suitable version "3.11.3", minimum required is "3.10.5") 

@tomeichlersmith tomeichlersmith marked this pull request as ready for review March 24, 2025 19:48
@tomeichlersmith tomeichlersmith merged commit 5f5dc32 into main Mar 24, 2025
@tomeichlersmith tomeichlersmith deleted the global-install-nlohmann-json branch March 24, 2025 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant