diff --git a/CMakeLists.txt b/CMakeLists.txt index f251eebba..688e8092b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.3) -project(EDM4HEP) +project(EDM4HEP LANGUAGES CXX) # project version SET( ${PROJECT_NAME}_VERSION_MAJOR 0 ) @@ -9,6 +9,13 @@ SET( ${PROJECT_NAME}_VERSION_PATCH 2 ) SET( ${PROJECT_NAME}_VERSION "${${PROJECT_NAME}_VERSION_MAJOR}.${${PROJECT_NAME}_VERSION_MINOR}.${${PROJECT_NAME}_VERSION_PATCH}" ) +#- RPATH settings ---------------------------------------------- +set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE CACHE BOOL "RPATH USE LINK PATH") +option(USE_RUNPATH_INSTEAD_OF_RPATH "Use runpath instead of rpath (allow specifying liked libraries via LD_LIBRARY_PATH)" OFF) +if(USE_RUNPATH_INSTEAD_OF_RPATH) + set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--enable-new-dtags") +endif() + #--- Run the podio class generator and link library ------- diff --git a/edm4hep.yaml b/edm4hep.yaml index a416d620b..824b3fe02 100644 --- a/edm4hep.yaml +++ b/edm4hep.yaml @@ -99,6 +99,12 @@ components: ObjectID(const podio::ObjectID& id ): index(id.index), collectionID(id.collectionID) {}\n " + # quantity with an identifier, a value and an error + edm4hep::Quantity: + Members: + - int16_t type // flag identifying how to interpret the quantity + - float value // value of the quantity + - float error // error on the value of the quantity datatypes : @@ -358,6 +364,7 @@ datatypes : VectorMembers: - int32_t subDetectorHitNumbers //number of hits in particular subdetectors.Check/set collection variable TrackSubdetectorNames for decoding the indices - edm4hep::TrackState trackStates //track states + - edm4hep::Quantity dxQuantities // different measurements of dx quantities OneToManyRelations: - edm4hep::TrackerHit trackerHits //hits that have been used to create this track - edm4hep::Track tracks //tracks (segments) that have been combined to create this track diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 421a6317f..09dd09ef3 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -2,32 +2,34 @@ IF(NOT BUILD_TESTING) RETURN() ENDIF() +function(set_test_env _testname) + set_property(TEST ${_testname} APPEND PROPERTY ENVIRONMENT + LD_LIBRARY_PATH=$:$:$ENV{LD_LIBRARY_PATH} + ROOT_INCLUDE_PATH=${PROJECT_SOURCE_DIR}/edm4hep:$ENV{ROOT_INCLUDE_PATH} + ) + set_tests_properties(${_testname} PROPERTIES + FAIL_REGULAR_EXPRESSION "[^a-z]Error;ERROR;error;Failed" + ) +endfunction() + add_executable(write_events write_events.cc) target_include_directories(write_events PUBLIC ${CMAKE_SOURCE_DIR}/edm4hep ) target_link_libraries(write_events edm4hep podio::podioRootIO) add_test(NAME write_events COMMAND write_events) -set_tests_properties(write_events PROPERTIES - ENVIRONMENT LD_LIBRARY_PATH=$:$:$ENV{LD_LIBRARY_PATH} - ) +set_test_env(write_events) add_executable(read_events read_events.cc) target_include_directories(read_events PUBLIC ${CMAKE_SOURCE_DIR}/edm4hep ) target_link_libraries(read_events edm4hep podio::podioRootIO) add_test(NAME read_events COMMAND read_events) -set_tests_properties(read_events PROPERTIES - DEPENDS write_events - ENVIRONMENT LD_LIBRARY_PATH=$:$:$ENV{LD_LIBRARY_PATH} - ) +set_test_env(read_events) IF (podio_VERSION VERSION_GREATER "0.13") add_executable(reco_particle_ref reco_particle_ref.cc) target_include_directories(reco_particle_ref PUBLIC ${CMAKE_SOURCE_DIR}/edm4hep) target_link_libraries(reco_particle_ref edm4hep podio::podioRootIO) add_test(NAME reco_particle_ref COMMAND reco_particle_ref) - set_tests_properties(reco_particle_ref PROPERTIES - ENVIRONMENT - LD_LIBRARY_PATH=$:$:$ENV{LD_LIBRARY_PATH} - ) + set_test_env(reco_particle_ref) ENDIF() IF(TARGET edm4hepSioBlocks) @@ -35,16 +37,14 @@ IF(TARGET edm4hepSioBlocks) target_include_directories(write_events_sio PUBLIC ${CMAKE_SOURCE_DIR}/edm4hep) target_link_libraries(write_events_sio edm4hep podio::podioSioIO) add_test(NAME write_events_sio COMMAND write_events_sio) - set_tests_properties(write_events_sio PROPERTIES - ENVIRONMENT LD_LIBRARY_PATH=$:$:$ENV{LD_LIBRARY_PATH} - ) + set_test_env(write_events_sio) add_executable(read_events_sio read_events_sio.cc) target_include_directories(read_events_sio PUBLIC ${CMAKE_SOURCE_DIR}/edm4hep) target_link_libraries(read_events_sio edm4hep podio::podioSioIO) add_test(NAME read_events_sio COMMAND read_events_sio) + set_test_env(read_events_sio) set_tests_properties(read_events_sio PROPERTIES - ENVIRONMENT LD_LIBRARY_PATH=$:$:$ENV{LD_LIBRARY_PATH} DEPENDS write_events_sio ) ENDIF() @@ -52,10 +52,10 @@ ENDIF() IF(TARGET ROOT::ROOTDataFrame) add_executable(test_rdf test_rdf.cc) target_include_directories(test_rdf PUBLIC ${CMAKE_SOURCE_DIR}/edm4hep ${CMAKE_SOURCE_DIR}/dataframe ) - target_link_libraries(test_rdf edm4hepRDF ROOT::ROOTDataFrame) + target_link_libraries(test_rdf edm4hepRDF ROOT::ROOTDataFrame podio::podioRootIO) add_test(NAME test_rdf COMMAND test_rdf) - set_tests_properties(test_rdf PROPERTIES - ENVIRONMENT LD_LIBRARY_PATH=$:$:$ENV{LD_LIBRARY_PATH} + set_test_env(test_rdf) + set_property(TEST test_rdf PROPERTY DEPENDS DEPENDS write_events ) endif() @@ -69,9 +69,7 @@ if(HepMC3_FOUND AND HepPDT_FOUND ) target_include_directories(edm4hep_testhepmc PUBLIC ${HEPMC3_INCLUDE_DIR} ${HEPPDT_INCLUDE_DIR} ) target_link_libraries(edm4hep_testhepmc edm4hep podio::podioRootIO ${HEPPDT_LIBRARIES} ${HEPMC3_LIBRARIES}) add_test(NAME edm4hep_testhepmc COMMAND edm4hep_testhepmc) - set_tests_properties(edm4hep_testhepmc PROPERTIES - ENVIRONMENT LD_LIBRARY_PATH=$:$:$ENV{LD_LIBRARY_PATH} - ) + set_test_env(edm4hep_testhepmc) endif() add_subdirectory(utils)