From 89072c4df07d4b40d220b4e166558bef5efc84b0 Mon Sep 17 00:00:00 2001 From: Nathan Brei Date: Sat, 7 Dec 2024 16:08:44 -0500 Subject: [PATCH 1/6] Remove all references to jerror jerror is moving out of JANA2 permanently and will live on in halld_recon as DANA/jerror.h --- src/libraries/JANA/Compatibility/JGeometry.h | 1 - src/libraries/JANA/Compatibility/JGeometryXML.h | 2 -- 2 files changed, 3 deletions(-) diff --git a/src/libraries/JANA/Compatibility/JGeometry.h b/src/libraries/JANA/Compatibility/JGeometry.h index f61bb2b5d..12e0c10d3 100644 --- a/src/libraries/JANA/Compatibility/JGeometry.h +++ b/src/libraries/JANA/Compatibility/JGeometry.h @@ -6,7 +6,6 @@ // #pragma once -#include "jerror.h" #include #include diff --git a/src/libraries/JANA/Compatibility/JGeometryXML.h b/src/libraries/JANA/Compatibility/JGeometryXML.h index 0a0eacb7c..9bbb150e5 100644 --- a/src/libraries/JANA/Compatibility/JGeometryXML.h +++ b/src/libraries/JANA/Compatibility/JGeometryXML.h @@ -8,7 +8,6 @@ #pragma once #include -#include #include #include #include @@ -17,7 +16,6 @@ #include - #if JANA2_HAVE_XERCES #if !defined(__CINT__) && !defined(__CLING__) // XERCES3 From 877a7486559f28d91b7b2def887996e0191e581e Mon Sep 17 00:00:00 2001 From: Nathan Brei Date: Sat, 7 Dec 2024 16:15:47 -0500 Subject: [PATCH 2/6] JGeometryXML.h no longer pulls in md5.h md5 is a vendored dependency which we'd like to keep separated from the rest of our code and internal, so that it doesn't become part of our install interface. Referencing it from a public header file unnecessarily forces us to provide it downstream. --- src/libraries/JANA/Compatibility/JGeometryXML.cc | 1 + src/libraries/JANA/Compatibility/JGeometryXML.h | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/libraries/JANA/Compatibility/JGeometryXML.cc b/src/libraries/JANA/Compatibility/JGeometryXML.cc index 459b37e67..f275a5e95 100644 --- a/src/libraries/JANA/Compatibility/JGeometryXML.cc +++ b/src/libraries/JANA/Compatibility/JGeometryXML.cc @@ -16,6 +16,7 @@ using namespace std; #include #include #include +#include #include "JGeometryXML.h" #if JANA2_HAVE_XERCES diff --git a/src/libraries/JANA/Compatibility/JGeometryXML.h b/src/libraries/JANA/Compatibility/JGeometryXML.h index 9bbb150e5..7924c0bed 100644 --- a/src/libraries/JANA/Compatibility/JGeometryXML.h +++ b/src/libraries/JANA/Compatibility/JGeometryXML.h @@ -13,8 +13,6 @@ #include #include -#include - #if JANA2_HAVE_XERCES #if !defined(__CINT__) && !defined(__CLING__) From 43638a78bce196a33a9c0e6763195bfb6e443fa1 Mon Sep 17 00:00:00 2001 From: Nathan Brei Date: Sat, 7 Dec 2024 16:53:12 -0500 Subject: [PATCH 3/6] Move vendored md5 into its own private target --- src/external/CMakeLists.txt | 1 + src/external/md5/CMakeLists.txt | 6 ++++++ src/{libraries/JANA/Compatibility => external/md5}/md5.c | 0 src/{libraries/JANA/Compatibility => external/md5}/md5.h | 0 src/libraries/JANA/CMakeLists.txt | 2 +- src/libraries/JANA/Calibrations/JLargeCalibration.cc | 2 +- src/libraries/JANA/Compatibility/JGeometryXML.cc | 2 +- 7 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 src/external/md5/CMakeLists.txt rename src/{libraries/JANA/Compatibility => external/md5}/md5.c (100%) rename src/{libraries/JANA/Compatibility => external/md5}/md5.h (100%) diff --git a/src/external/CMakeLists.txt b/src/external/CMakeLists.txt index fbd043d47..fcc771d80 100644 --- a/src/external/CMakeLists.txt +++ b/src/external/CMakeLists.txt @@ -1,3 +1,4 @@ add_subdirectory(catch2) +add_subdirectory(md5) add_subdirectory(tomlplusplus) diff --git a/src/external/md5/CMakeLists.txt b/src/external/md5/CMakeLists.txt new file mode 100644 index 000000000..dcbe70c22 --- /dev/null +++ b/src/external/md5/CMakeLists.txt @@ -0,0 +1,6 @@ + +add_library(VendoredMD5 STATIC md5.c) +target_include_directories(VendoredMD5 PUBLIC $) + + + diff --git a/src/libraries/JANA/Compatibility/md5.c b/src/external/md5/md5.c similarity index 100% rename from src/libraries/JANA/Compatibility/md5.c rename to src/external/md5/md5.c diff --git a/src/libraries/JANA/Compatibility/md5.h b/src/external/md5/md5.h similarity index 100% rename from src/libraries/JANA/Compatibility/md5.h rename to src/external/md5/md5.h diff --git a/src/libraries/JANA/CMakeLists.txt b/src/libraries/JANA/CMakeLists.txt index 08f5e9f17..a09fa5db4 100644 --- a/src/libraries/JANA/CMakeLists.txt +++ b/src/libraries/JANA/CMakeLists.txt @@ -51,7 +51,6 @@ set(JANA2_SOURCES Compatibility/JStreamLogBuffer.cc Compatibility/JGeometryManager.cc Compatibility/JGeometryXML.cc - Compatibility/md5.c ) if (${USE_PODIO}) @@ -70,6 +69,7 @@ find_package(Threads REQUIRED) set(THREADS_PREFER_PTHREAD_FLAG ON) target_link_libraries(jana2 PUBLIC ${CMAKE_DL_LIBS} Threads::Threads) target_link_libraries(jana2 PRIVATE VendoredTomlPlusPlus) +target_link_libraries(jana2 PRIVATE VendoredMD5) if (${USE_PODIO}) target_link_libraries(jana2 PUBLIC podio::podio podio::podioRootIO ${ROOT_LIBRARIES}) diff --git a/src/libraries/JANA/Calibrations/JLargeCalibration.cc b/src/libraries/JANA/Calibrations/JLargeCalibration.cc index c11481d72..c017d0ed8 100644 --- a/src/libraries/JANA/Calibrations/JLargeCalibration.cc +++ b/src/libraries/JANA/Calibrations/JLargeCalibration.cc @@ -22,7 +22,7 @@ using namespace std; #include #include -#include "JANA/Compatibility/md5.h" +#include static pthread_mutex_t resource_manager_mutex = PTHREAD_MUTEX_INITIALIZER; diff --git a/src/libraries/JANA/Compatibility/JGeometryXML.cc b/src/libraries/JANA/Compatibility/JGeometryXML.cc index f275a5e95..5a438103d 100644 --- a/src/libraries/JANA/Compatibility/JGeometryXML.cc +++ b/src/libraries/JANA/Compatibility/JGeometryXML.cc @@ -16,7 +16,7 @@ using namespace std; #include #include #include -#include +#include #include "JGeometryXML.h" #if JANA2_HAVE_XERCES From 26e270b879c39b3730e4ad6f59bbefc6b1fd5c2b Mon Sep 17 00:00:00 2001 From: Nathan Brei Date: Sat, 7 Dec 2024 17:08:57 -0500 Subject: [PATCH 4/6] Remove obsolete JGetObjectsFactory --- .../JANA/Compatibility/JGetObjectsFactory.h | 32 ------------------- 1 file changed, 32 deletions(-) delete mode 100644 src/libraries/JANA/Compatibility/JGetObjectsFactory.h diff --git a/src/libraries/JANA/Compatibility/JGetObjectsFactory.h b/src/libraries/JANA/Compatibility/JGetObjectsFactory.h deleted file mode 100644 index ab6cc7114..000000000 --- a/src/libraries/JANA/Compatibility/JGetObjectsFactory.h +++ /dev/null @@ -1,32 +0,0 @@ - -// Copyright 2020, Jefferson Science Associates, LLC. -// Subject to the terms in the LICENSE file found in the top-level directory. - -#pragma once -#include -#include - -template -class JGetObjectsFactory : public JFactoryT { - - /// JGetObjectsFactory allows us to use `JEventSource::GetObjects` with JANA2. - /// Use of GetObjects is deprecated and strongly discouraged in favor of using - /// JEvent::Insert instead. However, rewriting the halld event sources is a - /// monumental task, so we keep GetObjects for now and use this as the mechanism - /// to call into it. - -public: - JGetObjectsFactory(std::string tag="") { - JFactory::SetTag(tag); - } - - void Process(const std::shared_ptr& event) { - JEventSource* source = event->GetJEventSource(); - source->GetObjects(event, this); - // if (!result) throw JException("JGetObjectsFactory registered with a source that doesn't provide said objects"); - // JANA can't/shouldn't distinguish between "Source can't provide said objects" and "Source provided zero" - // Examples: DMCThrown, DDIRCTruthBarHit - JFactory::mCreationStatus = JFactory::CreationStatus::InsertedViaGetObjects; - } - -}; From 61be75807bb81179bfcb64e637a15a323f6d4c8a Mon Sep 17 00:00:00 2001 From: Nathan Brei Date: Sat, 7 Dec 2024 23:59:40 -0500 Subject: [PATCH 5/6] Convert VendoredMD5 to an OBJECT library This is so that md5 gets "baked in" to libjana.{so,a}, rather than producing a separate install artifact --- src/external/md5/CMakeLists.txt | 2 +- src/libraries/JANA/CMakeLists.txt | 6 +++--- src/programs/jana/CMakeLists.txt | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/external/md5/CMakeLists.txt b/src/external/md5/CMakeLists.txt index dcbe70c22..ed5f3c194 100644 --- a/src/external/md5/CMakeLists.txt +++ b/src/external/md5/CMakeLists.txt @@ -1,5 +1,5 @@ -add_library(VendoredMD5 STATIC md5.c) +add_library(VendoredMD5 OBJECT md5.c) target_include_directories(VendoredMD5 PUBLIC $) diff --git a/src/libraries/JANA/CMakeLists.txt b/src/libraries/JANA/CMakeLists.txt index a09fa5db4..39da10619 100644 --- a/src/libraries/JANA/CMakeLists.txt +++ b/src/libraries/JANA/CMakeLists.txt @@ -69,7 +69,7 @@ find_package(Threads REQUIRED) set(THREADS_PREFER_PTHREAD_FLAG ON) target_link_libraries(jana2 PUBLIC ${CMAKE_DL_LIBS} Threads::Threads) target_link_libraries(jana2 PRIVATE VendoredTomlPlusPlus) -target_link_libraries(jana2 PRIVATE VendoredMD5) +target_link_libraries(jana2 PRIVATE VendoredMD5) # To pull in the header file if (${USE_PODIO}) target_link_libraries(jana2 PUBLIC podio::podio podio::podioRootIO ${ROOT_LIBRARIES}) @@ -79,7 +79,7 @@ endif() # static library, always there -add_library(jana2_static_lib STATIC $) +add_library(jana2_static_lib STATIC $ $) set_target_properties(jana2_static_lib PROPERTIES PREFIX "lib" OUTPUT_NAME "JANA") target_include_directories(jana2_static_lib PUBLIC $) @@ -96,7 +96,7 @@ install(TARGETS jana2_static_lib EXPORT jana2_targets DESTINATION lib) # optionally build shared lib if (BUILD_SHARED_LIBS) message(STATUS "Building both shared and static libraries") - add_library(jana2_shared_lib SHARED $) + add_library(jana2_shared_lib SHARED $ $) set_target_properties(jana2_shared_lib PROPERTIES PREFIX "lib" OUTPUT_NAME "JANA") target_include_directories(jana2_shared_lib PUBLIC $) diff --git a/src/programs/jana/CMakeLists.txt b/src/programs/jana/CMakeLists.txt index 6e0a156ef..312316e88 100644 --- a/src/programs/jana/CMakeLists.txt +++ b/src/programs/jana/CMakeLists.txt @@ -3,7 +3,7 @@ add_executable(jana jana.cc ) find_package(Threads REQUIRED) -target_link_libraries(jana jana2 Threads::Threads) +target_link_libraries(jana jana2_static_lib Threads::Threads) target_link_options(jana PRIVATE -rdynamic) install(TARGETS jana DESTINATION bin) From ea13765deaf8b6dd71c9e67a4d805562861f9cb9 Mon Sep 17 00:00:00 2001 From: Nathan Brei Date: Sun, 8 Dec 2024 00:07:33 -0500 Subject: [PATCH 6/6] Link PodioExample against jana2_static_lib Because the `jana2` object library alone doesn't contain the `VendoredMD5` symbols. --- src/examples/PodioExample/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/examples/PodioExample/CMakeLists.txt b/src/examples/PodioExample/CMakeLists.txt index 244144747..6bbe3e07b 100644 --- a/src/examples/PodioExample/CMakeLists.txt +++ b/src/examples/PodioExample/CMakeLists.txt @@ -10,7 +10,7 @@ if (USE_PODIO) add_executable(PodioExample ${PodioExample_SOURCES}) target_link_libraries(PodioExample - PUBLIC jana2 PodioDatamodel PodioDatamodelDict podio::podioRootIO) + PUBLIC jana2_static_lib PodioDatamodel PodioDatamodelDict podio::podioRootIO) set_target_properties(PodioExample PROPERTIES INSTALL_RPATH_USE_LINK_PATH TRUE)