From 1f0477537ff4a7a001d08d9ba42987cfbe81bb02 Mon Sep 17 00:00:00 2001 From: Nathan Brei Date: Sun, 7 Jul 2024 18:12:43 -0400 Subject: [PATCH 01/12] Fix inconsistent JANA2_HAVE_{ROOT,XERCES} Previously, if Xerces was present on the system, but the user set USE_XERCES=0, jana_config.h would nevertheless set JANA2_HAVE_XERCES=1 and enable Xerces-specific code. Furthermore, if Xerces is a non-system install and hence not discoverable by CMake, this causes compilation errors. --- cmake/MakeConfig.cmake | 69 ++++++++++++++++++++++++------------------ 1 file changed, 39 insertions(+), 30 deletions(-) diff --git a/cmake/MakeConfig.cmake b/cmake/MakeConfig.cmake index 4ec1a0b18..e43d2e156 100644 --- a/cmake/MakeConfig.cmake +++ b/cmake/MakeConfig.cmake @@ -25,46 +25,55 @@ execute_process(COMMAND SBMS/osrelease.pl OUTPUT_STRIP_TRAILING_WHITESPACE) # ROOT -if(DEFINED ENV{ROOTSYS}) - set(JANA2_HAVE_ROOT 1) - set(ROOTSYS $ENV{ROOTSYS}) - - execute_process(COMMAND $ENV{ROOTSYS}/bin/root-config --cflags - OUTPUT_VARIABLE ROOTCFLAGS - OUTPUT_STRIP_TRAILING_WHITESPACE) - - execute_process(COMMAND $ENV{ROOTSYS}/bin/root-config --glibs - OUTPUT_VARIABLE ROOTGLIBS - OUTPUT_STRIP_TRAILING_WHITESPACE) -else() +if(${USE_ROOT}) + if(DEFINED ENV{ROOTSYS}) + set(JANA2_HAVE_ROOT 1) + set(ROOTSYS $ENV{ROOTSYS}) + + execute_process(COMMAND $ENV{ROOTSYS}/bin/root-config --cflags + OUTPUT_VARIABLE ROOTCFLAGS + OUTPUT_STRIP_TRAILING_WHITESPACE) + + execute_process(COMMAND $ENV{ROOTSYS}/bin/root-config --glibs + OUTPUT_VARIABLE ROOTGLIBS + OUTPUT_STRIP_TRAILING_WHITESPACE) + else() # message(STATUS "Did not find ROOT") + set(JANA2_HAVE_ROOT 0) + endif() +else() set(JANA2_HAVE_ROOT 0) endif() # XERCESC # n.b. this is hard-coded for now to assume XERCES 3 -if(DEFINED ENV{XERCESCROOT}) - set(JANA2_HAVE_XERCES 1) - set(XERCES3 1) - set(XERCESCROOT $ENV{XERCESCROOT}) - set(XERCES_CPPFLAGS "-I${XERCESCROOT}/include/xercesc") - set(XERCES_LIBS "-lxerces-c") - if( NOT $XERCESCROOT EQUAL "/usr" ) - set(XERCES_CPPFLAGS "${XERCES_CPPFLAGS} -I${XERCESCROOT}/include") - set(XERCES_LDFLAGS "-L${XERCESCROOT}/lib") - endif() -else() - find_package(XercesC) - if(XercesC_FOUND) +if(${USE_XERCES}) + if(DEFINED ENV{XERCESCROOT}) set(JANA2_HAVE_XERCES 1) set(XERCES3 1) - get_filename_component(XERCESCROOT "${XercesC_INCLUDE_DIRS}" DIRECTORY) - set(XERCES_CPPFLAGS "-I${XercesC_INCLUDE_DIRS} -I${XercesC_INCLUDE_DIRS}/xercesc") - set(XERCES_LIBS "${XercesC_LIBRARIES}") + set(XERCESCROOT $ENV{XERCESCROOT}) + set(XERCES_CPPFLAGS "-I${XERCESCROOT}/include/xercesc") + set(XERCES_LIBS "-lxerces-c") + if( NOT $XERCESCROOT EQUAL "/usr" ) + set(XERCES_CPPFLAGS "${XERCES_CPPFLAGS} -I${XERCESCROOT}/include") + set(XERCES_LDFLAGS "-L${XERCESCROOT}/lib") + endif() else() - set(JANA2_HAVE_XERCES 0) - set(XERCES3 0) + find_package(XercesC) + if(XercesC_FOUND) + set(JANA2_HAVE_XERCES 1) + set(XERCES3 1) + get_filename_component(XERCESCROOT "${XercesC_INCLUDE_DIRS}" DIRECTORY) + set(XERCES_CPPFLAGS "-I${XercesC_INCLUDE_DIRS} -I${XercesC_INCLUDE_DIRS}/xercesc") + set(XERCES_LIBS "${XercesC_LIBRARIES}") + else() + set(JANA2_HAVE_XERCES 0) + set(XERCES3 0) + endif() endif() +else() + set(JANA2_HAVE_XERCES 0) + set(XERCES3 0) endif() # cMsg From 32d114ccb6e45a6ffc82564f467a2fa14c74b1b3 Mon Sep 17 00:00:00 2001 From: Nathan Brei Date: Sun, 7 Jul 2024 21:55:36 -0400 Subject: [PATCH 02/12] Move JVersion.h generation out of CLI --- CMakeLists.txt | 1 + .../JANA/CLI/CMakeLists.txt => cmake/MakeJVersionH.cmake | 4 ++-- src/libraries/JANA/CMakeLists.txt | 2 -- 3 files changed, 3 insertions(+), 4 deletions(-) rename src/libraries/JANA/CLI/CMakeLists.txt => cmake/MakeJVersionH.cmake (90%) diff --git a/CMakeLists.txt b/CMakeLists.txt index f248d10bf..e2f677450 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -208,3 +208,4 @@ add_subdirectory(src/python) install(DIRECTORY scripts/ DESTINATION bin FILES_MATCHING PATTERN "jana-*.py" PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_READ WORLD_EXECUTE) include(${CMAKE_SOURCE_DIR}/cmake/MakeConfig.cmake) +include(${CMAKE_SOURCE_DIR}/cmake/MakeJVersionH.cmake) diff --git a/src/libraries/JANA/CLI/CMakeLists.txt b/cmake/MakeJVersionH.cmake similarity index 90% rename from src/libraries/JANA/CLI/CMakeLists.txt rename to cmake/MakeJVersionH.cmake index 7fc6b2fc2..64a896914 100644 --- a/src/libraries/JANA/CLI/CMakeLists.txt +++ b/cmake/MakeJVersionH.cmake @@ -68,6 +68,6 @@ else() endif() message(STATUS "Generating JVersion.h") -configure_file(JVersion.h.in JVersion.h) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/JVersion.h DESTINATION include/JANA/CLI) +configure_file(src/libraries/JANA/CLI/JVersion.h.in ${CMAKE_CURRENT_BINARY_DIR}/src/libraries/JANA/CLI/JVersion.h @ONLY) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/src/libraries/JANA/CLI/JVersion.h DESTINATION include/JANA/CLI) diff --git a/src/libraries/JANA/CMakeLists.txt b/src/libraries/JANA/CMakeLists.txt index 8f06c4a15..cee3f313a 100644 --- a/src/libraries/JANA/CMakeLists.txt +++ b/src/libraries/JANA/CMakeLists.txt @@ -1,6 +1,4 @@ -# For now all the CMakeLists in 'CLI' does is generate and install JVersion.h -add_subdirectory(CLI) # Everything else happens below set(JANA2_SOURCES From c453a7b800ab93152ded9f57371acd0b75a4fd52 Mon Sep 17 00:00:00 2001 From: Nathan Brei Date: Tue, 9 Jul 2024 16:50:42 -0400 Subject: [PATCH 03/12] JVersion provides JANA_HAVE_{PODIO,ROOT,XERCES} --- CMakeLists.txt | 11 +++++++++++ src/libraries/JANA/CLI/JVersion.h.in | 17 ++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e2f677450..b85d83323 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -78,6 +78,7 @@ if (${USE_ROOT}) find_package(ROOT REQUIRED) include(${ROOT_USE_FILE}) add_compile_definitions(JANA2_HAVE_ROOT) + set(JANA2_HAVE_ROOT 1) include_directories(${ROOT_INCLUDE_DIRS}) link_libraries(${ROOT_LIBRARIES}) execute_process( @@ -90,6 +91,8 @@ if (${USE_ROOT}) "Specify the C++ standard used to compile ROOT with e.g. -DCMAKE_CXX_STANDARD=17. " "Check the root-config output above for cxx flags.") endif() +else() + set(JANA2_HAVE_ROOT 0) endif() if (${USE_ZEROMQ}) @@ -101,10 +104,15 @@ if (${USE_XERCES}) set(XercesC_DIR $ENV{XERCESCROOT}) endif() find_package(XercesC REQUIRED) + set(JANA2_HAVE_XERCES 1) + set(JANA2_HAVE_XERCES3 1) add_compile_definitions(JANA2_HAVE_XERCES) add_compile_definitions(XERCES3) include_directories(${XercesC_INCLUDE_DIRS}) link_libraries(${XercesC_LIBRARIES}) +else() + set(JANA2_HAVE_XERCES 0) + set(JANA2_HAVE_XERCES3 0) endif() if (${USE_ASAN}) @@ -124,7 +132,10 @@ endif() if (${USE_PODIO}) find_package(podio REQUIRED) add_compile_definitions(JANA2_HAVE_PODIO) + set(JANA2_HAVE_PODIO 1) include_directories(SYSTEM ${podio_INCLUDE_DIR}) +else() + set(JANA2_HAVE_PODIO 0) endif() #--------- diff --git a/src/libraries/JANA/CLI/JVersion.h.in b/src/libraries/JANA/CLI/JVersion.h.in index cb6a3c695..cca30ab7d 100644 --- a/src/libraries/JANA/CLI/JVersion.h.in +++ b/src/libraries/JANA/CLI/JVersion.h.in @@ -5,6 +5,18 @@ #pragma once #include +#ifndef JANA2_HAVE_PODIO +# define JANA2_HAVE_PODIO @JANA2_HAVE_PODIO@ +#endif +#ifndef JANA2_HAVE_ROOT +# define JANA2_HAVE_ROOT @JANA2_HAVE_ROOT@ +#endif +#ifndef JANA2_HAVE_XERCES +# define JANA2_HAVE_XERCES @JANA2_HAVE_XERCES@ +# define XERCES3 @JANA2_HAVE_XERCES3@ +#endif + + struct JVersion { static const int major = @jana2_VERSION_MAJOR@; @@ -23,9 +35,12 @@ struct JVersion { static std::string GetCommitHash() { return last_commit_hash; } static std::string GetCommitDate() { return last_commit_date; } - static std::string GetInstallDir() { return installdir; } + static bool HasPodio() { return JANA2_HAVE_PODIO; } + static bool HasROOT() { return JANA2_HAVE_ROOT; } + static bool HasXerces() { return JANA2_HAVE_XERCES; } + static std::string GetVersion() { std::stringstream ss; ss << major << "." << minor << "." << patch; From aacbca3eeea40009f97902ddaba5f55f530618f6 Mon Sep 17 00:00:00 2001 From: Nathan Brei Date: Tue, 9 Jul 2024 16:54:32 -0400 Subject: [PATCH 04/12] Disentangle JVersion from JMain --- src/libraries/JANA/CLI/JMain.cc | 6 ------ src/libraries/JANA/CLI/JVersion.h.in | 13 +++++-------- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/src/libraries/JANA/CLI/JMain.cc b/src/libraries/JANA/CLI/JMain.cc index 81373643a..4366ce9d4 100644 --- a/src/libraries/JANA/CLI/JMain.cc +++ b/src/libraries/JANA/CLI/JMain.cc @@ -8,12 +8,6 @@ #include #include -// The values of JVERSION_COMMIT_HASH and JVERSION_COMMIT_DATE -// are #defined in JVersion.h.in so cmake can set them. -const std::string JVersion::last_commit_hash = JVERSION_COMMIT_HASH; -const std::string JVersion::last_commit_date = JVERSION_COMMIT_DATE; -const std::string JVersion::installdir = CMAKE_INSTALL_PREFIX; - namespace jana { diff --git a/src/libraries/JANA/CLI/JVersion.h.in b/src/libraries/JANA/CLI/JVersion.h.in index cca30ab7d..544cd4779 100644 --- a/src/libraries/JANA/CLI/JVersion.h.in +++ b/src/libraries/JANA/CLI/JVersion.h.in @@ -22,9 +22,11 @@ struct JVersion { static const int major = @jana2_VERSION_MAJOR@; static const int minor = @jana2_VERSION_MINOR@; static const int patch = @jana2_VERSION_PATCH@; - static const std::string last_commit_hash; - static const std::string last_commit_date; - static const std::string installdir; + + inline static const std::string last_commit_hash = "@JVERSION_COMMIT_HASH@"; + inline static const std::string last_commit_date = "@JVERSION_COMMIT_DATE@"; + inline static const std::string installdir = "@CMAKE_INSTALL_PREFIX@"; + static const bool is_unknown = @JVERSION_UNKNOWN@; static const bool is_release = @JVERSION_RELEASE@; static const bool is_modified = @JVERSION_MODIFIED@; @@ -61,10 +63,5 @@ struct JVersion { } }; -// These are defined here to allow cmake to set them but are -// actually used in JMain.cc. -#define JVERSION_COMMIT_HASH "@JVERSION_COMMIT_HASH@" -#define JVERSION_COMMIT_DATE "@JVERSION_COMMIT_DATE@" -#define CMAKE_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@" From c384a65341867de3f1dd754b2172b9cad9c4947b Mon Sep 17 00:00:00 2001 From: Nathan Brei Date: Thu, 11 Jul 2024 14:02:22 -0400 Subject: [PATCH 05/12] Replace jana_config.h with JVersion.h --- cmake/MakeConfig.cmake | 3 --- scripts/jana_config.h.in | 10 ---------- src/libraries/JANA/Compatibility/JGeometryMYSQL.h | 2 +- src/libraries/JANA/Compatibility/JGeometryXML.h | 2 +- 4 files changed, 2 insertions(+), 15 deletions(-) delete mode 100644 scripts/jana_config.h.in diff --git a/cmake/MakeConfig.cmake b/cmake/MakeConfig.cmake index e43d2e156..15b1054ab 100644 --- a/cmake/MakeConfig.cmake +++ b/cmake/MakeConfig.cmake @@ -1,7 +1,6 @@ # # This is used in the generation of the files: # jana-config -# jana_config.h # jana-this.sh # jana-this.csh # @@ -153,11 +152,9 @@ endif() set(HAVE_NUMA 0) configure_file(scripts/jana-config.in jana-config @ONLY) -configure_file(scripts/jana_config.h.in src/libraries/JANA/jana_config.h @ONLY) configure_file(scripts/jana-this.sh.in jana-this.sh @ONLY) configure_file(scripts/jana-this.csh.in jana-this.csh @ONLY) install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/jana-config DESTINATION bin) -install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/src/libraries/JANA/jana_config.h DESTINATION include/JANA) install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/jana-this.sh DESTINATION bin) install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/jana-this.csh DESTINATION bin) diff --git a/scripts/jana_config.h.in b/scripts/jana_config.h.in deleted file mode 100644 index 7f9525c13..000000000 --- a/scripts/jana_config.h.in +++ /dev/null @@ -1,10 +0,0 @@ -// -// This file was generated by CMake (see cmake/make_config.cmake) -// - -#define JANA2_HAVE_ROOT @JANA2_HAVE_ROOT@ -#define JANA2_HAVE_XERCES @JANA2_HAVE_XERCES@ -#define XERCES3 @XERCES3@ -#define HAVE_CCDB @HAVE_CCDB@ -#define HAVE_NUMA @HAVE_NUMA@ - diff --git a/src/libraries/JANA/Compatibility/JGeometryMYSQL.h b/src/libraries/JANA/Compatibility/JGeometryMYSQL.h index e25857b86..6c16472ac 100644 --- a/src/libraries/JANA/Compatibility/JGeometryMYSQL.h +++ b/src/libraries/JANA/Compatibility/JGeometryMYSQL.h @@ -8,7 +8,7 @@ #pragma once #include #include -//#include +#include class JGeometryMYSQL:public JGeometry{ diff --git a/src/libraries/JANA/Compatibility/JGeometryXML.h b/src/libraries/JANA/Compatibility/JGeometryXML.h index 1e2cc4885..6409e728d 100644 --- a/src/libraries/JANA/Compatibility/JGeometryXML.h +++ b/src/libraries/JANA/Compatibility/JGeometryXML.h @@ -12,7 +12,7 @@ #include #include #include -#include +#include #include From 0cfe17555aaf66c07a9f6e531628896253429b27 Mon Sep 17 00:00:00 2001 From: Nathan Brei Date: Thu, 11 Jul 2024 13:53:41 -0400 Subject: [PATCH 06/12] Remove references to ROOT_USE_FILE ROOT_USE_FILE _appears_ to be broken due to RootMacros.cmake being moved to the modules/ directory (Alma9 container, CVMFS /group install, Root 6.24.04). Luckily, ROOT_USE_FILE doesn't appear to be necessary (because macros such as ROOT_GENERATE_DICTIONARY are imported directly by `find_package(ROOT)`) or desirable (because the whole point of ROOT_USE_FILE is to pollute the global CMake includes/targets/CXX_FLAGS/etc). So it's an easy fix to simply remove all `include(${ROOT_USE_FILE})`. --- CMakeLists.txt | 1 - src/examples/RootDatamodelExample/CMakeLists.txt | 1 - src/plugins/janaview/CMakeLists.txt | 1 - 3 files changed, 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b85d83323..16259d1a4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -76,7 +76,6 @@ if (${USE_ROOT}) set(ROOT_DIR $ENV{ROOTSYS}/cmake) endif() find_package(ROOT REQUIRED) - include(${ROOT_USE_FILE}) add_compile_definitions(JANA2_HAVE_ROOT) set(JANA2_HAVE_ROOT 1) include_directories(${ROOT_INCLUDE_DIRS}) diff --git a/src/examples/RootDatamodelExample/CMakeLists.txt b/src/examples/RootDatamodelExample/CMakeLists.txt index 131b412f8..02d70d682 100644 --- a/src/examples/RootDatamodelExample/CMakeLists.txt +++ b/src/examples/RootDatamodelExample/CMakeLists.txt @@ -1,7 +1,6 @@ if(${USE_ROOT}) find_package(ROOT REQUIRED) - include(${ROOT_USE_FILE}) # Generate ROOT dictionaries for each of our ROOT object types # The foreach statement below should end with a list of classes diff --git a/src/plugins/janaview/CMakeLists.txt b/src/plugins/janaview/CMakeLists.txt index 7b970db98..2f3cbc48f 100644 --- a/src/plugins/janaview/CMakeLists.txt +++ b/src/plugins/janaview/CMakeLists.txt @@ -3,7 +3,6 @@ if(USE_ROOT) find_package(ROOT REQUIRED COMPONENTS Gui Core RIO Net Hist Graf Graf3d Gpad Tree Rint Postscript Matrix Physics MathCore Thread MultiProc) - include(${ROOT_USE_FILE}) ROOT_GENERATE_DICTIONARY(G__jv_mainframe jv_mainframe.h) include_directories(${CMAKE_CURRENT_SOURCE_DIR}) From 99bac178e0ec56c049644bbf463a5ac29ffec175 Mon Sep 17 00:00:00 2001 From: Nathan Brei Date: Thu, 11 Jul 2024 13:57:40 -0400 Subject: [PATCH 07/12] Remove never-implemented JGeometryMYSQL --- src/libraries/JANA/CMakeLists.txt | 2 - .../JANA/Compatibility/JGeometryMYSQL.cc | 67 ------------------- .../JANA/Compatibility/JGeometryMYSQL.h | 33 --------- .../JANA/Compatibility/JGeometryManager.cc | 3 +- 4 files changed, 2 insertions(+), 103 deletions(-) delete mode 100644 src/libraries/JANA/Compatibility/JGeometryMYSQL.cc delete mode 100644 src/libraries/JANA/Compatibility/JGeometryMYSQL.h diff --git a/src/libraries/JANA/CMakeLists.txt b/src/libraries/JANA/CMakeLists.txt index cee3f313a..8ff4f5ecb 100644 --- a/src/libraries/JANA/CMakeLists.txt +++ b/src/libraries/JANA/CMakeLists.txt @@ -125,8 +125,6 @@ set(JANA2_SOURCES Compatibility/JGeometry.h Compatibility/JGeometryManager.cc Compatibility/JGeometryManager.h - Compatibility/JGeometryMYSQL.cc - Compatibility/JGeometryMYSQL.h Compatibility/JGeometryXML.cc Compatibility/JGeometryXML.h Compatibility/md5.c diff --git a/src/libraries/JANA/Compatibility/JGeometryMYSQL.cc b/src/libraries/JANA/Compatibility/JGeometryMYSQL.cc deleted file mode 100644 index 12676b7bf..000000000 --- a/src/libraries/JANA/Compatibility/JGeometryMYSQL.cc +++ /dev/null @@ -1,67 +0,0 @@ -// $Id$ -// -// File: JGeometryMYSQL.cc -// Created: Wed May 7 16:21:37 EDT 2008 -// Creator: davidl (on Darwin swire-d95.jlab.org 8.11.1 i386) -// - -#include "JGeometryMYSQL.h" - -//--------------------------------- -// JGeometryMYSQL (Constructor) -//--------------------------------- -JGeometryMYSQL::JGeometryMYSQL(string url, int run, string context):JGeometry(url,run,context) -{ - -} - -//--------------------------------- -// ~JGeometryMYSQL (Destructor) -//--------------------------------- -JGeometryMYSQL::~JGeometryMYSQL() -{ - -} - -//--------------------------------- -// Get -//--------------------------------- -bool JGeometryMYSQL::Get(string /*path*/, string &/*sval*/) -{ - - // Looks like we failed to find the requested item. Let the caller know. - return false; -} - -//--------------------------------- -// Get -//--------------------------------- -bool JGeometryMYSQL::Get(string /*path*/, map &/*svals*/) -{ - // Looks like we failed to find the requested item. Let the caller know. - return false; -} - -//--------------------------------- -// GetMultiple -//--------------------------------- -bool JGeometryMYSQL::GetMultiple(string /*xpath*/, vector &/*vsval*/) -{ - return false; -} - -//--------------------------------- -// GetMultiple -//--------------------------------- -bool JGeometryMYSQL::GetMultiple(string /*xpath*/, vector >&/*vsvals*/) -{ - return false; -} - -//--------------------------------- -// GetXPaths -//--------------------------------- -void JGeometryMYSQL::GetXPaths(vector &/*paths*/, ATTR_LEVEL_t /*level*/, const string &/*filter*/) -{ - -} diff --git a/src/libraries/JANA/Compatibility/JGeometryMYSQL.h b/src/libraries/JANA/Compatibility/JGeometryMYSQL.h deleted file mode 100644 index 6c16472ac..000000000 --- a/src/libraries/JANA/Compatibility/JGeometryMYSQL.h +++ /dev/null @@ -1,33 +0,0 @@ -// $Id$ -// -// File: JGeometryMYSQL.h -// Created: Wed May 7 16:21:37 EDT 2008 -// Creator: davidl (on Darwin swire-d95.jlab.org 8.11.1 i386) -// - -#pragma once -#include -#include -#include - - -class JGeometryMYSQL:public JGeometry{ - public: - JGeometryMYSQL(string url, int run, string context="default"); - virtual ~JGeometryMYSQL(); - - bool Get(string xpath, string &sval); - bool Get(string xpath, map &svals); - bool GetMultiple(string xpath, vector &vsval); - bool GetMultiple(string xpath, vector >&vsvals); - void GetXPaths(vector &xpaths, ATTR_LEVEL_t level, const string &filter=""); - - protected: - - - private: - JGeometryMYSQL(); - -}; - - diff --git a/src/libraries/JANA/Compatibility/JGeometryManager.cc b/src/libraries/JANA/Compatibility/JGeometryManager.cc index 9e3cb576c..e8b2b2651 100644 --- a/src/libraries/JANA/Compatibility/JGeometryManager.cc +++ b/src/libraries/JANA/Compatibility/JGeometryManager.cc @@ -7,7 +7,6 @@ #include #include -#include JGeometry *JGeometryManager::GetJGeometry(unsigned int run_number) { @@ -53,9 +52,11 @@ JGeometry *JGeometryManager::GetJGeometry(unsigned int run_number) { if (url_str.find("xmlfile://") == 0 || url_str.find("ccdb://") == 0) { g = new JGeometryXML(string(url), run_number, context); } + /* else if (url_str.find("mysql:") == 0) { g = new JGeometryMYSQL(string(url), run_number, context); } + */ if (g) { geometries.push_back(g); } From 82d207a42263a528759098f09a5e048239bc2552 Mon Sep 17 00:00:00 2001 From: Nathan Brei Date: Thu, 11 Jul 2024 14:06:00 -0400 Subject: [PATCH 08/12] Remove support for Xerces 2 From xerces.apache.org: > If you're looking for information regarding the old Xerces 2.x library, please be advised that Xerces 2.8.0 and all earlier releases are 100% unsupported and should no longer be used by applications. --- CMakeLists.txt | 3 -- cmake/MakeConfig.cmake | 4 -- src/libraries/JANA/CLI/JVersion.h.in | 1 - .../JANA/Compatibility/JGeometryXML.cc | 41 ------------------- .../JANA/Compatibility/JGeometryXML.h | 33 --------------- 5 files changed, 82 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 16259d1a4..a0d5764ab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -104,14 +104,11 @@ if (${USE_XERCES}) endif() find_package(XercesC REQUIRED) set(JANA2_HAVE_XERCES 1) - set(JANA2_HAVE_XERCES3 1) add_compile_definitions(JANA2_HAVE_XERCES) - add_compile_definitions(XERCES3) include_directories(${XercesC_INCLUDE_DIRS}) link_libraries(${XercesC_LIBRARIES}) else() set(JANA2_HAVE_XERCES 0) - set(JANA2_HAVE_XERCES3 0) endif() if (${USE_ASAN}) diff --git a/cmake/MakeConfig.cmake b/cmake/MakeConfig.cmake index 15b1054ab..704b163b7 100644 --- a/cmake/MakeConfig.cmake +++ b/cmake/MakeConfig.cmake @@ -49,7 +49,6 @@ endif() if(${USE_XERCES}) if(DEFINED ENV{XERCESCROOT}) set(JANA2_HAVE_XERCES 1) - set(XERCES3 1) set(XERCESCROOT $ENV{XERCESCROOT}) set(XERCES_CPPFLAGS "-I${XERCESCROOT}/include/xercesc") set(XERCES_LIBS "-lxerces-c") @@ -61,18 +60,15 @@ if(${USE_XERCES}) find_package(XercesC) if(XercesC_FOUND) set(JANA2_HAVE_XERCES 1) - set(XERCES3 1) get_filename_component(XERCESCROOT "${XercesC_INCLUDE_DIRS}" DIRECTORY) set(XERCES_CPPFLAGS "-I${XercesC_INCLUDE_DIRS} -I${XercesC_INCLUDE_DIRS}/xercesc") set(XERCES_LIBS "${XercesC_LIBRARIES}") else() set(JANA2_HAVE_XERCES 0) - set(XERCES3 0) endif() endif() else() set(JANA2_HAVE_XERCES 0) - set(XERCES3 0) endif() # cMsg diff --git a/src/libraries/JANA/CLI/JVersion.h.in b/src/libraries/JANA/CLI/JVersion.h.in index 544cd4779..127585188 100644 --- a/src/libraries/JANA/CLI/JVersion.h.in +++ b/src/libraries/JANA/CLI/JVersion.h.in @@ -13,7 +13,6 @@ #endif #ifndef JANA2_HAVE_XERCES # define JANA2_HAVE_XERCES @JANA2_HAVE_XERCES@ -# define XERCES3 @JANA2_HAVE_XERCES3@ #endif diff --git a/src/libraries/JANA/Compatibility/JGeometryXML.cc b/src/libraries/JANA/Compatibility/JGeometryXML.cc index a9bbae502..459b37e67 100644 --- a/src/libraries/JANA/Compatibility/JGeometryXML.cc +++ b/src/libraries/JANA/Compatibility/JGeometryXML.cc @@ -19,26 +19,6 @@ using namespace std; #include "JGeometryXML.h" #if JANA2_HAVE_XERCES - -#if XERCES3 -// XERCES 3 - -#else -// XERCES 2 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#endif - using namespace xercesc; #endif @@ -181,18 +161,12 @@ void JGeometryXML::Init(string xmlfile, string xml) XMLPlatformUtils::Initialize(); // Instantiate the DOM parser. -#if XERCES3 parser = new XercesDOMParser(); parser->setCreateEntityReferenceNodes(false); parser->setValidationScheme(XercesDOMParser::Val_Always); parser->setValidationSchemaFullChecking(true); parser->setDoSchema(true); parser->setDoNamespaces(true); // optional -#else - static const XMLCh gLS[] = { chLatin_L, chLatin_S, chNull }; - DOMImplementation *impl = DOMImplementationRegistry::getDOMImplementation(gLS); - parser = ((DOMImplementationLS*)impl)->createDOMBuilder(DOMImplementationLS::MODE_SYNCHRONOUS, 0); -#endif // Create an error handler and install it JGeometryXML::ErrorHandler errorHandler; @@ -208,30 +182,19 @@ void JGeometryXML::Init(string xmlfile, string xml) // Parse top-level file allowing entity resolver to handle lower levels if( xml != "" ){ // --- Read lower levels from Calib DB -#if XERCES3 xercesc::MemBufInputSource myxml_buf((const unsigned char*)xml.c_str(), xml.size(), "myxml (in memory)"); parser->parse(myxml_buf); md5_checksum = myEntityResolver.GetMD5_checksum(); -#else - jerr << "XML string (as opposed to file) parsing not supported with xerces2" << endl; - exit(-1); -#endif }else{ // --- Read top and lower levels from files -#if XERCES3 parser->parse(xmlfile.c_str()); md5_checksum = myEntityResolver.GetMD5_checksum(); -#else - doc = parser->parseURI(xmlfile.c_str()); -#endif } // Process xml string -#if XERCES3 // Get full DOM doc = parser->getDocument(); -#endif valid_xmlfile = true; @@ -998,11 +961,7 @@ JGeometryXML::EntityResolver::~EntityResolver() //---------------------------------- // resolveEntity //---------------------------------- -#if XERCES3 xercesc::InputSource* JGeometryXML::EntityResolver::resolveEntity(const XMLCh* const publicId, const XMLCh* const systemId) -#else -xercesc::DOMInputSource* JGeometryXML::EntityResolver::resolveEntity(const XMLCh* const publicId, const XMLCh* const systemId, const XMLCh* const baseURI) -#endif { /// This method gets called from the xerces parser each time it /// opens a file (except for the top-level file). For each of these, diff --git a/src/libraries/JANA/Compatibility/JGeometryXML.h b/src/libraries/JANA/Compatibility/JGeometryXML.h index 6409e728d..f0ae6438e 100644 --- a/src/libraries/JANA/Compatibility/JGeometryXML.h +++ b/src/libraries/JANA/Compatibility/JGeometryXML.h @@ -20,9 +20,6 @@ #if JANA2_HAVE_XERCES #if !defined(__CINT__) && !defined(__CLING__) - -#if XERCES3 - // XERCES3 #include #include @@ -30,18 +27,6 @@ #include #include #include -#else - -// XERCES2 -#include -#include -#include -#include -#include -#include -#include - -#endif #else // __CINT__ __CLING__ namespace xercesc{ @@ -118,11 +103,7 @@ class JGeometryXML:public JGeometry{ }; -#if XERCES3 xercesc::XercesDOMParser *parser; -#else // XERCES3 - xercesc::DOMBuilder *parser; -#endif // XERCES3 xercesc::DOMDocument *doc; void AddNodeToList(xercesc::DOMNode* start, string start_path, vector &xpaths, JGeometry::ATTR_LEVEL_t level); @@ -133,11 +114,7 @@ class JGeometryXML:public JGeometry{ static void GetAttributes(xercesc::DOMNode* node, map &attributes); // Error handler callback class -#if XERCES3 class ErrorHandler : public xercesc::ErrorHandler -#else // XERCES3 - class ErrorHandler : public xercesc::DOMErrorHandler -#endif // XERCES3 { public: // Constructors and Destructor @@ -147,11 +124,9 @@ class JGeometryXML:public JGeometry{ void resetErrors(){} // Purely virtual methods -#if XERCES3 void warning(const xercesc::SAXParseException& /*exc*/){} void error(const xercesc::SAXParseException& /*exc*/){} void fatalError(const xercesc::SAXParseException& /*exc*/){} -#endif // XERCES3 private : // Unimplemented constructors and operators @@ -162,20 +137,12 @@ class JGeometryXML:public JGeometry{ // A simple entity resolver to keep track of files being // included from the top-level XML file so a full MD5 sum // can be made -#if XERCES3 class EntityResolver : public xercesc::EntityResolver -#else - class EntityResolver : public xercesc::DOMEntityResolver -#endif // XERCES3 { public: EntityResolver(const std::string &xmlFile, JCalibration *jcalib); ~EntityResolver(); -#if XERCES3 xercesc::InputSource* resolveEntity(const XMLCh* const publicId, const XMLCh* const systemId); -#else // XERCES3 - xercesc::DOMInputSource* resolveEntity(const XMLCh* const publicId, const XMLCh* const systemId, const XMLCh* const baseURI); -#endif // XERCES3 std::vector GetXMLFilenames(void); From 78a742f5850a0acee1bdc35b4db1a37cee601fd6 Mon Sep 17 00:00:00 2001 From: Nathan Brei Date: Thu, 11 Jul 2024 14:16:07 -0400 Subject: [PATCH 09/12] Remove dead libnuma references JANA's NUMA support uses information from `lscpu` or `/proc/cpuinfo` instead of libnuma. Libnuma was insufficient because it didn't provide information about sockets or hyperthreads, and JANA2 constrains affinity/locality at any level, not just NUMA nodes. --- cmake/MakeConfig.cmake | 3 -- src/libraries/JANA/Utils/JCpuInfo.cc | 42 ---------------------------- src/libraries/JANA/Utils/JCpuInfo.h | 6 ---- 3 files changed, 51 deletions(-) diff --git a/cmake/MakeConfig.cmake b/cmake/MakeConfig.cmake index 704b163b7..9335c34a9 100644 --- a/cmake/MakeConfig.cmake +++ b/cmake/MakeConfig.cmake @@ -144,9 +144,6 @@ else() set(HAVE_CURL 0) endif() -# TODO: FindNuma.cmake -set(HAVE_NUMA 0) - configure_file(scripts/jana-config.in jana-config @ONLY) configure_file(scripts/jana-this.sh.in jana-this.sh @ONLY) configure_file(scripts/jana-this.csh.in jana-this.csh @ONLY) diff --git a/src/libraries/JANA/Utils/JCpuInfo.cc b/src/libraries/JANA/Utils/JCpuInfo.cc index 1ea207179..3349a8b9d 100644 --- a/src/libraries/JANA/Utils/JCpuInfo.cc +++ b/src/libraries/JANA/Utils/JCpuInfo.cc @@ -19,9 +19,6 @@ #include #endif //__APPLE__ -#ifdef HAVE_NUMA -#include -#endif //HAVE_NUMA #include @@ -77,45 +74,6 @@ uint32_t GetCpuID() { } - -size_t GetNumaNodeID() { -#ifdef HAVE_NUMA - if (numa_available() == -1) { - return 0; - } else { - return numa_node_of_cpu(GetCpuID()); - } -#else //HAVE_NUMA - return 0; -#endif //HAVE_NUMA -} - -size_t GetNumaNodeID(size_t cpu_id) { -#ifdef HAVE_NUMA - if (numa_available() == -1) { - return 0; - } else { - return numa_node_of_cpu(cpu_id); - } -#else //HAVE_NUMA - (void) cpu_id; // suppress compiler warning. - return 0; -#endif //HAVE_NUMA -} - -size_t GetNumNumaNodes() { -#ifdef HAVE_NUMA - if (numa_available() == -1) { - return 1; - } else { - return numa_num_configured_nodes(); - } -#else //HAVE_NUMA - return 1; -#endif //HAVE_NUMA -} - - bool PinThreadToCpu(std::thread* thread, size_t cpu_id) { if (typeid(std::thread::native_handle_type) != typeid(pthread_t)) { diff --git a/src/libraries/JANA/Utils/JCpuInfo.h b/src/libraries/JANA/Utils/JCpuInfo.h index 004f0067f..bf9f57693 100644 --- a/src/libraries/JANA/Utils/JCpuInfo.h +++ b/src/libraries/JANA/Utils/JCpuInfo.h @@ -22,12 +22,6 @@ namespace JCpuInfo { uint32_t GetCpuID(); - size_t GetNumaNodeID(); - - size_t GetNumaNodeID(size_t cpuid); - - size_t GetNumNumaNodes(); - bool PinThreadToCpu(std::thread *thread, size_t cpu_id); } From 9411a990f13b7e73fdc6545df7b33831d441b462 Mon Sep 17 00:00:00 2001 From: Nathan Brei Date: Thu, 11 Jul 2024 16:10:23 -0400 Subject: [PATCH 10/12] Always obtain JANA2_HAVE_{ROOT,Podio,Xerces} from JVersion.h - Converts all #ifdef's into #ifs - Removes flags from compile_definitions --- CMakeLists.txt | 19 +++++++++---------- .../RootDatamodelExample/CMakeLists.txt | 1 - src/libraries/JANA/CMakeLists.txt | 6 ------ src/libraries/JANA/JEvent.h | 14 ++++++++------ src/libraries/JANA/JFactoryT.h | 9 +++++---- src/libraries/JANA/JMultifactory.cc | 2 +- src/libraries/JANA/JMultifactory.h | 15 ++++++++------- src/libraries/JANA/Omni/JHasInputs.h | 2 +- src/libraries/JANA/Omni/JHasOutputs.h | 2 +- src/libraries/JANA/Omni/JOmniFactory.h | 3 ++- src/libraries/JANA/Podio/JPodioTypeHelpers.h | 5 +++-- src/libraries/JANA/Utils/JStringification.cc | 2 +- src/libraries/JANA/Utils/JStringification.h | 6 ++++-- src/python/common/JEventProcessorPY.h | 6 ++++-- 14 files changed, 47 insertions(+), 45 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a0d5764ab..33e9a96e3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -70,13 +70,21 @@ option(USE_CUDA "Compile CUDA-involved examples (Needed for examples/SubeventCUD option(USE_PODIO "Compile with PODIO support" OFF) option(BUILD_SHARED_LIBS "Build into both shared and static libs." ON) +if (${USE_PODIO}) + find_package(podio REQUIRED) + set(JANA2_HAVE_PODIO 1) + set(USE_ROOT ON) + include_directories(SYSTEM ${podio_INCLUDE_DIR}) +else() + set(JANA2_HAVE_PODIO 0) +endif() + if (${USE_ROOT}) if((NOT DEFINED ROOT_DIR) AND (DEFINED ENV{ROOTSYS})) set(ROOT_DIR $ENV{ROOTSYS}/cmake) endif() find_package(ROOT REQUIRED) - add_compile_definitions(JANA2_HAVE_ROOT) set(JANA2_HAVE_ROOT 1) include_directories(${ROOT_INCLUDE_DIRS}) link_libraries(${ROOT_LIBRARIES}) @@ -104,7 +112,6 @@ if (${USE_XERCES}) endif() find_package(XercesC REQUIRED) set(JANA2_HAVE_XERCES 1) - add_compile_definitions(JANA2_HAVE_XERCES) include_directories(${XercesC_INCLUDE_DIRS}) link_libraries(${XercesC_LIBRARIES}) else() @@ -125,14 +132,6 @@ if (${USE_CUDA}) find_package(CUDA REQUIRED) endif() -if (${USE_PODIO}) - find_package(podio REQUIRED) - add_compile_definitions(JANA2_HAVE_PODIO) - set(JANA2_HAVE_PODIO 1) - include_directories(SYSTEM ${podio_INCLUDE_DIR}) -else() - set(JANA2_HAVE_PODIO 0) -endif() #--------- # Report back to the user what we've discovered diff --git a/src/examples/RootDatamodelExample/CMakeLists.txt b/src/examples/RootDatamodelExample/CMakeLists.txt index 02d70d682..e170f771e 100644 --- a/src/examples/RootDatamodelExample/CMakeLists.txt +++ b/src/examples/RootDatamodelExample/CMakeLists.txt @@ -33,7 +33,6 @@ if(${USE_ROOT}) ) add_library(RootDatamodelExample_plugin SHARED ${RootDatamodelExample_PLUGIN_SOURCES}) - target_compile_definitions(RootDatamodelExample_plugin PUBLIC JANA2_HAVE_ROOT) target_include_directories(RootDatamodelExample_plugin PUBLIC ${JANA_INCLUDE_DIR} ${ROOT_INCLUDE_DIRS}) target_link_libraries(RootDatamodelExample_plugin jana2) target_link_libraries(RootDatamodelExample_plugin ${ROOT_LIBRARIES}) diff --git a/src/libraries/JANA/CMakeLists.txt b/src/libraries/JANA/CMakeLists.txt index 8ff4f5ecb..c91d153a1 100644 --- a/src/libraries/JANA/CMakeLists.txt +++ b/src/libraries/JANA/CMakeLists.txt @@ -152,10 +152,8 @@ target_include_directories(jana2 PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/..) # So that we can find the generated JVersion.h before install target_link_libraries(jana2 ${CMAKE_DL_LIBS} Threads::Threads) if (${USE_PODIO}) - target_compile_definitions(jana2 PUBLIC JANA2_HAVE_PODIO=1 JANA2_HAVE_ROOT=1) target_link_libraries(jana2 podio::podio podio::podioRootIO ${ROOT_LIBRARIES}) elseif (${USE_ROOT}) - target_compile_definitions(jana2 PUBLIC JANA2_HAVE_ROOT=1) target_link_libraries(jana2 ${ROOT_LIBRARIES}) endif() @@ -168,10 +166,8 @@ target_include_directories(jana2_static_lib PUBLIC $) target_link_libraries(jana2_static_lib ${CMAKE_DL_LIBS} Threads::Threads) if (${USE_PODIO}) - target_compile_definitions(jana2_static_lib PUBLIC JANA2_HAVE_PODIO=1 JANA2_HAVE_ROOT=1) target_link_libraries(jana2_static_lib podio::podio podio::podioRootIO ${ROOT_LIBRARIES}) elseif (${USE_ROOT}) - target_compile_definitions(jana2_static_lib PUBLIC JANA2_HAVE_ROOT=1) target_link_libraries(jana2_static_lib ${ROOT_LIBRARIES}) endif() install(TARGETS jana2_static_lib EXPORT jana2_targets DESTINATION lib) @@ -187,10 +183,8 @@ if (BUILD_SHARED_LIBS) target_link_libraries(jana2_shared_lib ${CMAKE_DL_LIBS} Threads::Threads) if (${USE_PODIO}) - target_compile_definitions(jana2_shared_lib PUBLIC JANA2_HAVE_PODIO=1 JANA2_HAVE_ROOT=1) target_link_libraries(jana2_shared_lib podio::podio podio::podioRootIO ${ROOT_LIBRARIES}) elseif (${USE_ROOT}) - target_compile_definitions(jana2_shared_lib PUBLIC JANA2_HAVE_ROOT=1) target_link_libraries(jana2_shared_lib ${ROOT_LIBRARIES}) endif() diff --git a/src/libraries/JANA/JEvent.h b/src/libraries/JANA/JEvent.h index 628bc45c7..63573c8b9 100644 --- a/src/libraries/JANA/JEvent.h +++ b/src/libraries/JANA/JEvent.h @@ -10,11 +10,14 @@ #include #include +#include + #include #include #include #include #include +#include #include #include @@ -22,9 +25,8 @@ #include #include #include -#include "JANA/Utils/JInspector.h" -#ifdef JANA2_HAVE_PODIO +#if JANA2_HAVE_PODIO #include namespace podio { class CollectionBase; @@ -51,7 +53,7 @@ class JEvent : public std::enable_shared_from_this void SetFactorySet(JFactorySet* aFactorySet) { delete mFactorySet; mFactorySet = aFactorySet; -#ifdef JANA2_HAVE_PODIO +#if JANA2_HAVE_PODIO // Maintain the index of PODIO factories for (JFactory* factory : mFactorySet->GetAllFactories()) { if (dynamic_cast(factory) != nullptr) { @@ -97,7 +99,7 @@ class JEvent : public std::enable_shared_from_this template JFactoryT* Insert(const std::vector& items, const std::string& tag = "") const; // PODIO -#ifdef JANA2_HAVE_PODIO +#if JANA2_HAVE_PODIO std::vector GetAllCollectionNames() const; const podio::CollectionBase* GetCollectionBase(std::string name, bool throw_on_missing=true) const; template const typename JFactoryPodioT::CollectionT* GetCollection(std::string name, bool throw_on_missing=true) const; @@ -210,7 +212,7 @@ class JEvent : public std::enable_shared_from_this -#ifdef JANA2_HAVE_PODIO +#if JANA2_HAVE_PODIO std::map mPodioFactories; #endif }; @@ -504,7 +506,7 @@ JFactoryT* JEvent::GetSingle(const T* &t, const char *tag, bool exception_if_ return fac; } -#ifdef JANA2_HAVE_PODIO +#if JANA2_HAVE_PODIO inline std::vector JEvent::GetAllCollectionNames() const { std::vector keys; diff --git a/src/libraries/JANA/JFactoryT.h b/src/libraries/JANA/JFactoryT.h index a97f6f605..681df889d 100644 --- a/src/libraries/JANA/JFactoryT.h +++ b/src/libraries/JANA/JFactoryT.h @@ -11,8 +11,9 @@ #include #include #include +#include -#ifdef JANA2_HAVE_ROOT +#if JANA2_HAVE_ROOT #include #endif @@ -35,7 +36,7 @@ class JFactoryT : public JFactory { JFactoryT(const std::string& aName, const std::string& aTag) __attribute__ ((deprecated)) : JFactory(aName, aTag) { EnableGetAs(); EnableGetAs( std::is_convertible() ); // Automatically add JObject if this can be converted to it -#ifdef JANA2_HAVE_ROOT +#if JANA2_HAVE_ROOT EnableGetAs( std::is_convertible() ); // Automatically add TObject if this can be converted to it #endif } @@ -43,7 +44,7 @@ class JFactoryT : public JFactory { JFactoryT(const std::string& aName) __attribute__ ((deprecated)) : JFactory(aName, "") { EnableGetAs(); EnableGetAs( std::is_convertible() ); // Automatically add JObject if this can be converted to it -#ifdef JANA2_HAVE_ROOT +#if JANA2_HAVE_ROOT EnableGetAs( std::is_convertible() ); // Automatically add TObject if this can be converted to it #endif } @@ -51,7 +52,7 @@ class JFactoryT : public JFactory { JFactoryT() : JFactory(JTypeInfo::demangle(), ""){ EnableGetAs(); EnableGetAs( std::is_convertible() ); // Automatically add JObject if this can be converted to it -#ifdef JANA2_HAVE_ROOT +#if JANA2_HAVE_ROOT EnableGetAs( std::is_convertible() ); // Automatically add TObject if this can be converted to it #endif } diff --git a/src/libraries/JANA/JMultifactory.cc b/src/libraries/JANA/JMultifactory.cc index 0e8fb4237..a36f4c66d 100644 --- a/src/libraries/JANA/JMultifactory.cc +++ b/src/libraries/JANA/JMultifactory.cc @@ -10,7 +10,7 @@ void JMultifactory::Execute(const std::shared_ptr& event) { std::lock_guard lock(m_mutex); -#ifdef JANA2_HAVE_PODIO +#if JANA2_HAVE_PODIO if (mNeedPodio) { mPodioFrame = GetOrCreateFrame(event); } diff --git a/src/libraries/JANA/JMultifactory.h b/src/libraries/JANA/JMultifactory.h index fe4c2b454..453a26131 100644 --- a/src/libraries/JANA/JMultifactory.h +++ b/src/libraries/JANA/JMultifactory.h @@ -8,8 +8,9 @@ #include #include #include +#include -#ifdef JANA2_HAVE_PODIO +#if JANA2_HAVE_PODIO #include #include "JANA/Podio/JFactoryPodioT.h" #endif @@ -35,7 +36,7 @@ class JMultifactoryHelper : public JFactoryT{ }; -#ifdef JANA2_HAVE_PODIO +#if JANA2_HAVE_PODIO // TODO: This redundancy goes away if we merge JFactoryPodioT with JFactoryT template class JMultifactoryHelperPodio : public JFactoryPodioT{ @@ -70,7 +71,7 @@ class JMultifactory : public jana::omni::JComponent, // This can be used for parameter and collection name prefixing, though at a higher level std::string mFactoryName; // So we can propagate this to the JMultifactoryHelpers, so we can have useful error messages -#ifdef JANA2_HAVE_PODIO +#if JANA2_HAVE_PODIO bool mNeedPodio = false; // Whether we need to retrieve the podio::Frame podio::Frame* mPodioFrame = nullptr; // To provide the podio::Frame to SetPodioData, SetCollection #endif @@ -97,7 +98,7 @@ class JMultifactory : public jana::omni::JComponent, template void SetData(std::string tag, std::vector data); -#ifdef JANA2_HAVE_PODIO +#if JANA2_HAVE_PODIO template void DeclarePodioOutput(std::string tag, bool owns_data=true); @@ -158,7 +159,7 @@ void JMultifactory::SetData(std::string tag, std::vector data) { ex.plugin_name = m_plugin_name; throw ex; } -#ifdef JANA2_HAVE_PODIO +#if JANA2_HAVE_PODIO // This may or may not be a Podio factory. We find out if it is, and if so, set the frame before calling Set(). auto* typed = dynamic_cast(helper); if (typed != nullptr) { @@ -169,7 +170,7 @@ void JMultifactory::SetData(std::string tag, std::vector data) { } -#ifdef JANA2_HAVE_PODIO +#if JANA2_HAVE_PODIO template void JMultifactory::DeclarePodioOutput(std::string tag, bool owns_data) { @@ -245,7 +246,7 @@ void JMultifactoryHelper::Process(const std::shared_ptr &event) mMultiFactory->Execute(event); } -#ifdef JANA2_HAVE_PODIO +#if JANA2_HAVE_PODIO template void JMultifactoryHelperPodio::Process(const std::shared_ptr &event) { mMultiFactory->SetApplication(this->GetApplication()); diff --git a/src/libraries/JANA/Omni/JHasInputs.h b/src/libraries/JANA/Omni/JHasInputs.h index 94508807a..71912b0fd 100644 --- a/src/libraries/JANA/Omni/JHasInputs.h +++ b/src/libraries/JANA/Omni/JHasInputs.h @@ -127,7 +127,7 @@ struct JHasInputs { } }; -#ifdef JANA2_HAVE_PODIO +#if JANA2_HAVE_PODIO template class PodioInput : public InputBase { diff --git a/src/libraries/JANA/Omni/JHasOutputs.h b/src/libraries/JANA/Omni/JHasOutputs.h index eca931a18..27fc59cb9 100644 --- a/src/libraries/JANA/Omni/JHasOutputs.h +++ b/src/libraries/JANA/Omni/JHasOutputs.h @@ -51,7 +51,7 @@ struct JHasOutputs { }; -#ifdef JANA2_HAVE_PODIO +#if JANA2_HAVE_PODIO template class PodioOutput : public OutputBase { diff --git a/src/libraries/JANA/Omni/JOmniFactory.h b/src/libraries/JANA/Omni/JOmniFactory.h index cf495562b..9eceb7e6d 100644 --- a/src/libraries/JANA/Omni/JOmniFactory.h +++ b/src/libraries/JANA/Omni/JOmniFactory.h @@ -10,6 +10,7 @@ * which might be changed by user parameters. */ +#include #include #include #include @@ -69,7 +70,7 @@ class JOmniFactory : public JMultifactory, public jana::omni::JHasInputs { }; -#ifdef JANA2_HAVE_PODIO +#if JANA2_HAVE_PODIO template class PodioOutput : public OutputBase { diff --git a/src/libraries/JANA/Podio/JPodioTypeHelpers.h b/src/libraries/JANA/Podio/JPodioTypeHelpers.h index 7c1b8e3d0..876b70831 100644 --- a/src/libraries/JANA/Podio/JPodioTypeHelpers.h +++ b/src/libraries/JANA/Podio/JPodioTypeHelpers.h @@ -7,10 +7,11 @@ #include #include +#include /// These allow us to have both a PODIO-enabled and a PODIO-free definition of certain key structures and functions. -#ifdef JANA2_HAVE_PODIO +#if JANA2_HAVE_PODIO // Sadly, this will only work with C++17 or higher, and for now JANA still supports C++14 (when not using PODIO) template @@ -34,5 +35,5 @@ struct is_podio::collection_t>> : std::t template static constexpr bool is_podio_v = is_podio::value; -#endif //ifdef JANA2_HAVE_PODIO +#endif //if JANA2_HAVE_PODIO diff --git a/src/libraries/JANA/Utils/JStringification.cc b/src/libraries/JANA/Utils/JStringification.cc index dc1dc3c16..364da2fd3 100644 --- a/src/libraries/JANA/Utils/JStringification.cc +++ b/src/libraries/JANA/Utils/JStringification.cc @@ -47,7 +47,7 @@ void JStringification::GetObjectSummaries(std::map ss << "0x" << std::hex << (uint64_t)jobj << std::dec; objects[ss.str()] = summary; // key is address of object converted to string } -#ifdef JANA2_HAVE_ROOT +#if JANA2_HAVE_ROOT // For objects inheriting from TObject, we try and convert members automatically // into JObjectSummary form. This relies on dictionaries being compiled in. // (see ROOT_GENERATE_DICTIONARY for cmake files). diff --git a/src/libraries/JANA/Utils/JStringification.h b/src/libraries/JANA/Utils/JStringification.h index 7a59b476e..79313697d 100644 --- a/src/libraries/JANA/Utils/JStringification.h +++ b/src/libraries/JANA/Utils/JStringification.h @@ -5,7 +5,9 @@ #pragma once #include -#ifdef JANA2_HAVE_ROOT +#include + +#if JANA2_HAVE_ROOT #include #include #include @@ -41,7 +43,7 @@ class JStringification { template std::string GetAddrAsString(void *addr) const; -#ifdef JANA2_HAVE_ROOT +#if JANA2_HAVE_ROOT std::string GetRootObjectMemberAsString(const TObject *tobj, const TDataMember *memitem, std::string type) const; #endif // JANA2_HAVE_ROOT diff --git a/src/python/common/JEventProcessorPY.h b/src/python/common/JEventProcessorPY.h index 075860aef..7297c74b1 100644 --- a/src/python/common/JEventProcessorPY.h +++ b/src/python/common/JEventProcessorPY.h @@ -20,6 +20,7 @@ // n.b. There may actually be a way to do this with one class by // manipulating the ref counter in the python object +#include #include #include @@ -29,7 +30,8 @@ using std::endl; #include namespace py = pybind11; -#ifdef JANA2_HAVE_ROOT + +#if JANA2_HAVE_ROOT #include #include #include @@ -113,7 +115,7 @@ class JEventProcessorPY { LOG_ERROR(default_cout_logger) << "Unable to find factory specified for prefetching: factory=" << p.first << " tag=" << p.second << LOG_END; }else { auto v = fac->GetAs(); -#ifdef JANA2_HAVE_ROOT +#if JANA2_HAVE_ROOT if( v.empty() )fac->GetAs(); #endif // JANA2_HAVE_ROOT From 94549c048d526a04d80b6bfc5fd5b4c68f9a1b84 Mon Sep 17 00:00:00 2001 From: Nathan Brei Date: Thu, 11 Jul 2024 20:35:48 -0400 Subject: [PATCH 11/12] Move JVersion.h out of CLI --- CMakeLists.txt | 1 + cmake/MakeJVersionH.cmake | 4 ++-- src/libraries/JANA/CLI/JMain.cc | 2 +- src/libraries/JANA/CLI/JVersion.h | 8 ++++++++ src/libraries/JANA/CMakeLists.txt | 3 +-- src/libraries/JANA/Compatibility/JGeometryXML.h | 2 +- src/libraries/JANA/JEvent.h | 2 +- src/libraries/JANA/JFactoryT.h | 2 +- src/libraries/JANA/JMultifactory.h | 2 +- src/libraries/JANA/{CLI => }/JVersion.h.in | 0 src/libraries/JANA/Omni/JOmniFactory.h | 4 ++-- src/libraries/JANA/Podio/JPodioTypeHelpers.h | 2 +- src/libraries/JANA/Utils/JStringification.h | 2 +- src/python/common/JEventProcessorPY.h | 2 +- src/python/modules/jana/jana_module.cc | 2 +- 15 files changed, 23 insertions(+), 15 deletions(-) create mode 100644 src/libraries/JANA/CLI/JVersion.h rename src/libraries/JANA/{CLI => }/JVersion.h.in (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 33e9a96e3..908dfb121 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -194,6 +194,7 @@ message(STATUS "-----------------------") include_directories(src/libraries) # So that everyone can find the JANA header files include_directories(src/external) # So that everyone can find our vendorized header-old libraries +include_directories(${CMAKE_CURRENT_BINARY_DIR}/src/libraries) # So that everyone can find JVersion.h # This is needed on macos to allow plugins to link without resolving all JANA symbols until runtime if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") diff --git a/cmake/MakeJVersionH.cmake b/cmake/MakeJVersionH.cmake index 64a896914..8b3f7ad38 100644 --- a/cmake/MakeJVersionH.cmake +++ b/cmake/MakeJVersionH.cmake @@ -69,5 +69,5 @@ endif() message(STATUS "Generating JVersion.h") -configure_file(src/libraries/JANA/CLI/JVersion.h.in ${CMAKE_CURRENT_BINARY_DIR}/src/libraries/JANA/CLI/JVersion.h @ONLY) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/src/libraries/JANA/CLI/JVersion.h DESTINATION include/JANA/CLI) +configure_file(src/libraries/JANA/JVersion.h.in ${CMAKE_CURRENT_BINARY_DIR}/src/libraries/JANA/JVersion.h @ONLY) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/src/libraries/JANA/JVersion.h DESTINATION include/JANA) diff --git a/src/libraries/JANA/CLI/JMain.cc b/src/libraries/JANA/CLI/JMain.cc index 4366ce9d4..d28085c3a 100644 --- a/src/libraries/JANA/CLI/JMain.cc +++ b/src/libraries/JANA/CLI/JMain.cc @@ -4,7 +4,7 @@ #include "JMain.h" -#include +#include #include #include diff --git a/src/libraries/JANA/CLI/JVersion.h b/src/libraries/JANA/CLI/JVersion.h new file mode 100644 index 000000000..10a0d697a --- /dev/null +++ b/src/libraries/JANA/CLI/JVersion.h @@ -0,0 +1,8 @@ +#pragma once + +// We are moving JVersion.h out of CLI. +// In the future, use #include instead. + +#include + + diff --git a/src/libraries/JANA/CMakeLists.txt b/src/libraries/JANA/CMakeLists.txt index c91d153a1..89390b67d 100644 --- a/src/libraries/JANA/CMakeLists.txt +++ b/src/libraries/JANA/CMakeLists.txt @@ -148,9 +148,8 @@ add_library(jana2 OBJECT ${JANA2_SOURCES}) find_package(Threads REQUIRED) set(THREADS_PREFER_PTHREAD_FLAG ON) -target_include_directories(jana2 PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/..) -# So that we can find the generated JVersion.h before install target_link_libraries(jana2 ${CMAKE_DL_LIBS} Threads::Threads) + if (${USE_PODIO}) target_link_libraries(jana2 podio::podio podio::podioRootIO ${ROOT_LIBRARIES}) elseif (${USE_ROOT}) diff --git a/src/libraries/JANA/Compatibility/JGeometryXML.h b/src/libraries/JANA/Compatibility/JGeometryXML.h index f0ae6438e..0a0eacb7c 100644 --- a/src/libraries/JANA/Compatibility/JGeometryXML.h +++ b/src/libraries/JANA/Compatibility/JGeometryXML.h @@ -12,7 +12,7 @@ #include #include #include -#include +#include #include diff --git a/src/libraries/JANA/JEvent.h b/src/libraries/JANA/JEvent.h index 63573c8b9..ef0134bc7 100644 --- a/src/libraries/JANA/JEvent.h +++ b/src/libraries/JANA/JEvent.h @@ -10,7 +10,7 @@ #include #include -#include +#include #include #include diff --git a/src/libraries/JANA/JFactoryT.h b/src/libraries/JANA/JFactoryT.h index 681df889d..7151ee841 100644 --- a/src/libraries/JANA/JFactoryT.h +++ b/src/libraries/JANA/JFactoryT.h @@ -10,8 +10,8 @@ #include #include #include +#include #include -#include #if JANA2_HAVE_ROOT #include diff --git a/src/libraries/JANA/JMultifactory.h b/src/libraries/JANA/JMultifactory.h index 453a26131..df5be8672 100644 --- a/src/libraries/JANA/JMultifactory.h +++ b/src/libraries/JANA/JMultifactory.h @@ -8,7 +8,7 @@ #include #include #include -#include +#include #if JANA2_HAVE_PODIO #include diff --git a/src/libraries/JANA/CLI/JVersion.h.in b/src/libraries/JANA/JVersion.h.in similarity index 100% rename from src/libraries/JANA/CLI/JVersion.h.in rename to src/libraries/JANA/JVersion.h.in diff --git a/src/libraries/JANA/Omni/JOmniFactory.h b/src/libraries/JANA/Omni/JOmniFactory.h index 9eceb7e6d..e001910a7 100644 --- a/src/libraries/JANA/Omni/JOmniFactory.h +++ b/src/libraries/JANA/Omni/JOmniFactory.h @@ -10,10 +10,10 @@ * which might be changed by user parameters. */ -#include +#include #include +#include #include -#include #include #include diff --git a/src/libraries/JANA/Podio/JPodioTypeHelpers.h b/src/libraries/JANA/Podio/JPodioTypeHelpers.h index 876b70831..c5f3b05f0 100644 --- a/src/libraries/JANA/Podio/JPodioTypeHelpers.h +++ b/src/libraries/JANA/Podio/JPodioTypeHelpers.h @@ -7,7 +7,7 @@ #include #include -#include +#include /// These allow us to have both a PODIO-enabled and a PODIO-free definition of certain key structures and functions. diff --git a/src/libraries/JANA/Utils/JStringification.h b/src/libraries/JANA/Utils/JStringification.h index 79313697d..f85b380d6 100644 --- a/src/libraries/JANA/Utils/JStringification.h +++ b/src/libraries/JANA/Utils/JStringification.h @@ -5,7 +5,7 @@ #pragma once #include -#include +#include #if JANA2_HAVE_ROOT #include diff --git a/src/python/common/JEventProcessorPY.h b/src/python/common/JEventProcessorPY.h index 7297c74b1..5f935ed2c 100644 --- a/src/python/common/JEventProcessorPY.h +++ b/src/python/common/JEventProcessorPY.h @@ -20,7 +20,7 @@ // n.b. There may actually be a way to do this with one class by // manipulating the ref counter in the python object -#include +#include #include #include diff --git a/src/python/modules/jana/jana_module.cc b/src/python/modules/jana/jana_module.cc index 6c17f1a86..e2ec8e238 100644 --- a/src/python/modules/jana/jana_module.cc +++ b/src/python/modules/jana/jana_module.cc @@ -4,7 +4,7 @@ #include #include -#include +#include // Something to throw that makes a nicer error message class PYTHON_MODULE_STARTUP_FAILED{public: PYTHON_MODULE_STARTUP_FAILED(){}}; From f30bfff511a1ef339572e630858f76d7ba6ed340 Mon Sep 17 00:00:00 2001 From: Nathan Brei Date: Fri, 12 Jul 2024 01:00:27 -0400 Subject: [PATCH 12/12] JANA_HAVE_{Podio,ROOT,Xerces} defined in exactly one place --- src/libraries/JANA/JVersion.h.in | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/libraries/JANA/JVersion.h.in b/src/libraries/JANA/JVersion.h.in index 127585188..8745a8834 100644 --- a/src/libraries/JANA/JVersion.h.in +++ b/src/libraries/JANA/JVersion.h.in @@ -5,15 +5,9 @@ #pragma once #include -#ifndef JANA2_HAVE_PODIO -# define JANA2_HAVE_PODIO @JANA2_HAVE_PODIO@ -#endif -#ifndef JANA2_HAVE_ROOT -# define JANA2_HAVE_ROOT @JANA2_HAVE_ROOT@ -#endif -#ifndef JANA2_HAVE_XERCES -# define JANA2_HAVE_XERCES @JANA2_HAVE_XERCES@ -#endif +#define JANA2_HAVE_PODIO @JANA2_HAVE_PODIO@ +#define JANA2_HAVE_ROOT @JANA2_HAVE_ROOT@ +#define JANA2_HAVE_XERCES @JANA2_HAVE_XERCES@ struct JVersion {