Skip to content

Commit

Permalink
[cxxmodules] Enable a module if json is present.
Browse files Browse the repository at this point in the history
  • Loading branch information
vgvassilev committed Nov 6, 2021
1 parent 1aba25e commit 0cdfa69
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
4 changes: 3 additions & 1 deletion core/clingutils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,9 @@ set(clinginclude ${CMAKE_SOURCE_DIR}/interpreter/cling/include)

set(custom_modulemaps)
if (runtime_cxxmodules)
set(custom_modulemaps boost.modulemap tinyxml2.modulemap cuda.modulemap module.modulemap.build)
set(custom_modulemaps boost.modulemap tinyxml2.modulemap cuda.modulemap
module.modulemap.build
json.modulemap)
# FIXME: We should install vc.modulemap only when Vc is found (Vc_FOUND) but
# some systems install it under /usr/include/Vc/Vc which allows rootcling to
# discover it and assert that the modulemap is not found.
Expand Down
2 changes: 2 additions & 0 deletions graf3d/eve7/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ ROOT_STANDARD_LIBRARY_PACKAGE(ROOTEve
src/REveViewer.cxx
src/REveVSD.cxx
src/REveVSDStructs.cxx
DICTIONARY_OPTIONS
-mByproduct Json
DEPENDENCIES
Core
Geom
Expand Down
4 changes: 4 additions & 0 deletions interpreter/cling/include/cling/json.modulemap
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module Json {
header "nlohmann/json.hpp"
export *
}
6 changes: 6 additions & 0 deletions interpreter/cling/lib/Interpreter/CIFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,7 @@ namespace {
llvm::SmallString<256> tinyxml2IncLoc(getIncludePathForHeader(HS, "tinyxml2.h"));
llvm::SmallString<256> cudaIncLoc(getIncludePathForHeader(HS, "cuda.h"));
llvm::SmallString<256> vcVcIncLoc(getIncludePathForHeader(HS, "Vc/Vc"));
llvm::SmallString<256> jsonIncLoc(getIncludePathForHeader(HS, "nlohmann/json.hpp"));
llvm::SmallString<256> clingIncLoc(getIncludePathForHeader(HS,
"cling/Interpreter/RuntimeUniverse.h"));

Expand Down Expand Up @@ -705,6 +706,11 @@ namespace {
clingIncLoc.str(), MOverlay,
/*RegisterModuleMap=*/ true,
/*AllowModulemapOverride=*/ false);
if (!jsonIncLoc.empty())
maybeAppendOverlayEntry(jsonIncLoc.str(), "json.modulemap",
clingIncLoc.str(), MOverlay,
/*RegisterModuleMap=*/ true,
/*AllowModulemapOverride=*/ false);
if (!boostIncLoc.empty()) {
// Add the modulemap in the include/boost folder not in include.
llvm::sys::path::append(boostIncLoc, "boost");
Expand Down

0 comments on commit 0cdfa69

Please sign in to comment.