Skip to content
Snippets Groups Projects
Commit a2927267 authored by Administrator's avatar Administrator Committed by Florian Uhlig
Browse files

Fix installation and usage of AnalysisTree headers

Patch the AnalysisTree and AnalysisTreeQA buils systems to create also
correct dictionaries for ROOT versions below v6.18.0.
Add the directories where the header files of both packages are installed
to ROOT_INCLUDE_PATH which are paths used by rootcint to find needed
header files.
parent 3029e9f4
No related branches found
No related tags found
1 merge request!736Fix installation and usage of AnalysisTree headers (#2435)
Pipeline #16282 passed
......@@ -498,6 +498,8 @@ if(NOT CBMROOT_MINIMAL)
"${CMAKE_INSTALL_PREFIX}/include/mvd"
"${CMAKE_INSTALL_PREFIX}/include/littrack"
"${CMAKE_INSTALL_PREFIX}/include/KF"
"${CMAKE_INSTALL_PREFIX}/include/AnalysisTree"
"${CMAKE_INSTALL_PREFIX}/include/AnalysisTreeQA"
)
set(CMAKE_INSTALL_LIBDIR lib)
SET(VMCWORKDIR ${CMAKE_INSTALL_PREFIX}/share/cbmroot)
......
diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt
index ab4c300..765e1db 100644
--- a/core/CMakeLists.txt
+++ b/core/CMakeLists.txt
@@ -16,7 +16,28 @@ string(REPLACE ".cpp" ".hpp" HEADERS "${SOURCES}")
list(APPEND HEADERS "Constants.hpp" "Detector.hpp")
add_library(AnalysisTreeBase SHARED ${SOURCES} G__AnalysisTreeBase.cxx)
-ROOT_GENERATE_DICTIONARY(G__AnalysisTreeBase ${HEADERS} LINKDEF AnalysisTreeCoreLinkDef.h)
+
+if(${ROOT_VERSION} VERSION_GREATER 6.18.0)
+ message(STATUS "ROOT ${ROOT_VERSION}, use the standard ROOT_GENERATE_DICTIONARY macro.")
+ ROOT_GENERATE_DICTIONARY(G__AnalysisTreeBase ${HEADERS} LINKDEF AnalysisTreeCoreLinkDef.h)
+else()
+ message(STATUS "ROOT ${ROOT_VERSION} has a broken ROOT_GENERATE_DICTIONARY macro, so build the dictionary ourself.")
+ set(dictionary_includes ${HEADERS})
+ set(dictionary_linkdef "AnalysisTreeCoreLinkDef.h")
+ set(dictionary_source "G__AnalysisTreeBase.cxx")
+
+ add_custom_command(OUTPUT ${dictionary_source}
+ COMMAND ${ROOT_rootcling_CMD} -f ${dictionary_source}
+ -rml libAnalysisTreeBase
+ -rmf libAnalysisTreeBase.rootmap
+ -s libAnalysisTreeBase
+ -inlineInputHeader
+ -I${CMAKE_CURRENT_SOURCE_DIR} ${dictionary_includes}
+ ${CMAKE_CURRENT_SOURCE_DIR}/${dictionary_linkdef}
+ DEPENDS ${dictionary_includes} ${dictionary_linkdef}
+ )
+endif()
+
target_link_libraries(AnalysisTreeBase ${ROOT_LIBRARIES} EG)
add_custom_command(TARGET AnalysisTreeBase PRE_BUILD
diff --git a/core/Constants.hpp b/core/Constants.hpp
index ed7b9c6..f9cbcc3 100644
--- a/core/Constants.hpp
+++ b/core/Constants.hpp
@@ -109,4 +109,4 @@ enum EventHeaderFields : ShortInt_t {
}// namespace AnalysisTree
-#endif
\ No newline at end of file
+#endif
diff --git a/core/Module.hpp b/core/Module.hpp
index 9c523aa..c54d17e 100644
--- a/core/Module.hpp
+++ b/core/Module.hpp
@@ -93,4 +93,4 @@ class ModulePosition : public IndexedObject {
};
}// namespace AnalysisTree
-#endif
\ No newline at end of file
+#endif
diff --git a/infra/CMakeLists.txt b/infra/CMakeLists.txt
index ed7bd9b..a63a7b1 100644
--- a/infra/CMakeLists.txt
+++ b/infra/CMakeLists.txt
@@ -30,12 +30,34 @@ add_library(AnalysisTreeInfra SHARED ${SOURCES} G__AnalysisTreeInfra.cxx)
target_compile_definitions(AnalysisTreeInfra PUBLIC
$<$<BOOL:${Boost_FOUND}>:ANALYSISTREE_BOOST_FOUND>)
-ROOT_GENERATE_DICTIONARY(G__AnalysisTreeInfra ${HEADERS}
- LINKDEF AnalysisTreeInfraLinkDef.h
- OPTIONS
- -I${CMAKE_BINARY_DIR}/include
- $<$<BOOL:${Boost_FOUND}>:-DANALYSISTREE_BOOST_FOUND>
- )
+if(${ROOT_VERSION} VERSION_GREATER 6.18.0)
+ message(STATUS "ROOT ${ROOT_VERSION}, use the standard ROOT_GENERATE_DICTIONARY macro.")
+ ROOT_GENERATE_DICTIONARY(G__AnalysisTreeInfra ${HEADERS}
+ LINKDEF AnalysisTreeInfraLinkDef.h
+ OPTIONS
+ -I${CMAKE_BINARY_DIR}/include
+ $<$<BOOL:${Boost_FOUND}>:-DANALYSISTREE_BOOST_FOUND>
+ )
+else()
+ message(STATUS "ROOT ${ROOT_VERSION} has a broken ROOT_GENERATE_DICTIONARY macro, so build the dictionary ourself.")
+ set(dictionary_includes ${HEADERS})
+ set(dictionary_linkdef "AnalysisTreeInfraLinkDef.h")
+ set(dictionary_source "G__AnalysisTreeInfra.cxx")
+
+ add_custom_command(OUTPUT ${dictionary_source}
+ COMMAND ${ROOT_rootcling_CMD} -f ${dictionary_source}
+ -rml libAnalysisTreeInfra
+ -rmf libAnalysisTreeInfra.rootmap
+ -s libAnalysisTreeInfra
+ -inlineInputHeader
+ -I${CMAKE_CURRENT_SOURCE_DIR} ${dictionary_includes}
+ -I${CMAKE_BINARY_DIR}/include
+ -I${CMAKE_BINARY_DIR}/include/AnalysisTree
+ $<$<BOOL:${Boost_FOUND}>:-DANALYSISTREE_BOOST_FOUND>
+ ${CMAKE_CURRENT_SOURCE_DIR}/${dictionary_linkdef}
+ DEPENDS ${dictionary_includes} ${dictionary_linkdef}
+ )
+endif()
target_link_libraries(AnalysisTreeInfra
PUBLIC
${ROOT_LIBRARIES}
diff --git a/infra/SimpleCut.hpp b/infra/SimpleCut.hpp
index 4ec5458..21fe68c 100644
--- a/infra/SimpleCut.hpp
+++ b/infra/SimpleCut.hpp
@@ -116,4 +116,4 @@ SimpleCut RangeCut(const std::string& variable_name, float lo, float hi, const s
SimpleCut EqualsCut(const std::string& variable_name, int value, const std::string& title = "");
}// namespace AnalysisTree
-#endif//ANALYSISTREE_SIMPLECUT_H
\ No newline at end of file
+#endif//ANALYSISTREE_SIMPLECUT_H
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index ee90134..0861bc8 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -20,11 +20,35 @@ endif ()
#add_dependencies(AnalysisTreeQA ${PROJECT_DEPENDENCIES})
-ROOT_GENERATE_DICTIONARY(G__AnalysisTreeQA
- ${HEADERS}
- LINKDEF AnalysisTreeQALinkDef.h
- OPTIONS -I${CMAKE_BINARY_DIR}/include
- )
+if(${ROOT_VERSION} VERSION_GREATER 6.18.0)
+ message(STATUS "ROOT ${ROOT_VERSION}, use the standard ROOT_GENERATE_DICTIONARY macro.")
+ ROOT_GENERATE_DICTIONARY(G__AnalysisTreeQA
+ ${HEADERS}
+ LINKDEF AnalysisTreeQALinkDef.h
+ OPTIONS -I${CMAKE_BINARY_DIR}/include
+ )
+else()
+ message(STATUS "ROOT ${ROOT_VERSION} has a broken ROOT_GENERATE_DICTIONARY macro, so build the dictionary ourself.")
+ set(dictionary_includes ${HEADERS})
+ set(dictionary_linkdef "AnalysisTreeQALinkDef.h")
+ set(dictionary_source "G__AnalysisTreeQA.cxx")
+
+ add_custom_command(OUTPUT ${dictionary_source}
+ COMMAND ${ROOT_rootcling_CMD} -f ${dictionary_source}
+ -rml libAnalysisTreeQA
+ -rmf libAnalysisTreeQA.rootmap
+ -s libAnalysisTreeQA
+ -inlineInputHeader
+ -I${AnalysisTree_INCLUDE_DIR}
+ -I${CMAKE_CURRENT_SOURCE_DIR}
+ ${dictionary_includes}
+ ${CMAKE_CURRENT_SOURCE_DIR}/${dictionary_linkdef}
+ DEPENDS ${dictionary_includes} ${dictionary_linkdef}
+ )
+endif()
+
+
+
target_link_libraries(AnalysisTreeQA
PUBLIC
AnalysisTreeBase
......@@ -10,6 +10,7 @@ download_project_if_needed(PROJECT AnalysisTree_source
GIT_TAG ${ANALYSISTREE_VERSION}
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/AnalysisTree
TEST_FILE CMakeLists.txt
PATCH_COMMAND "patch -p1 < ${CMAKE_CURRENT_SOURCE_DIR}/AnalysisTree.patch"
)
If(ProjectUpdated)
......
......@@ -9,6 +9,7 @@ download_project_if_needed(PROJECT AnalysisTreeQA_source
GIT_TAG ${ANALYSISTREEQA_VERSION}
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/AnalysisTreeQA
TEST_FILE CMakeLists.txt
PATCH_COMMAND "patch -p1 < ${CMAKE_CURRENT_SOURCE_DIR}/AnalysisTreeQA.patch"
)
If(ProjectUpdated)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment