diff --git a/.gitignore b/.gitignore index 0b4376270..e8356938f 100644 --- a/.gitignore +++ b/.gitignore @@ -65,9 +65,4 @@ cmake-build*/ .cache compile_commands.json -# PODIO generated artifacts -src/examples/PodioExample/datamodel/* -src/examples/PodioExample/src/* -src/examples/PodioExample/podio_generated_files.cmake -podio_build/ diff --git a/src/examples/PodioExample/CMakeLists.txt b/src/examples/PodioExample/CMakeLists.txt index c77838a52..9e29d1be0 100644 --- a/src/examples/PodioExample/CMakeLists.txt +++ b/src/examples/PodioExample/CMakeLists.txt @@ -9,25 +9,34 @@ set(PodioExample_SOURCES if (USE_PODIO) - foreach( _conf ${CMAKE_CONFIGURATION_TYPES} ) - string(TOUPPER ${_conf} _conf ) - set( CMAKE_RUNTIME_OUTPUT_DIRECTORY_${_conf} ${CMAKE_CURRENT_BINARY_DIR} ) - set( CMAKE_LIBRARY_OUTPUT_DIRECTORY_${_conf} ${CMAKE_CURRENT_BINARY_DIR} ) - set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${_conf} ${CMAKE_CURRENT_BINARY_DIR} ) - endforeach() - PODIO_GENERATE_DATAMODEL(datamodel layout.yaml DATAMODEL_HEADERS DATAMODEL_SOURCES IO_BACKEND_HANDLERS ROOT) - PODIO_ADD_DATAMODEL_CORE_LIB(PodioExampleDatamodel "${DATAMODEL_HEADERS}" "${DATAMODEL_SOURCES}") - PODIO_ADD_ROOT_IO_DICT(PodioExampleDatamodelDict PodioExampleDatamodel "${DATAMODEL_HEADERS}" src/selection.xml) + PODIO_GENERATE_DATAMODEL(PodioExampleDatamodel layout.yaml headers sources + IO_BACKEND_HANDLERS ROOT + OUTPUT_FOLDER ${CMAKE_CURRENT_BINARY_DIR} + ) + + PODIO_ADD_DATAMODEL_CORE_LIB(PodioExampleDatamodel "${headers}" "${sources}" + OUTPUT_FOLDER ${CMAKE_CURRENT_BINARY_DIR}) + + PODIO_ADD_ROOT_IO_DICT(PodioExampleDatamodelDict PodioExampleDatamodel "${headers}" + ${CMAKE_CURRENT_BINARY_DIR}/src/selection.xml) find_package(podio REQUIRED) add_executable(PodioExample ${PodioExample_SOURCES}) - target_include_directories(PodioExample PUBLIC .) - target_link_libraries(PodioExample jana2 podio::podio PodioExampleDatamodel PodioExampleDatamodelDict podio::podioRootIO) + target_link_libraries(PodioExample + jana2 PodioExampleDatamodel PodioExampleDatamodelDict podio::podioRootIO) + set_target_properties(PodioExample PROPERTIES INSTALL_RPATH_USE_LINK_PATH TRUE) install(TARGETS PodioExample DESTINATION bin) - install(TARGETS PodioExampleDatamodel DESTINATION lib) + + install(TARGETS PodioExampleDatamodel + LIBRARY DESTINATION lib + PUBLIC_HEADER DESTINATION include/PodioExampleDatamodel #include/JANA/Plugins/PodioExampleDatamodel + ) + install(TARGETS PodioExampleDatamodelDict DESTINATION lib) + + else() message(STATUS "Skipping examples/PodioExample because USE_PODIO=Off") diff --git a/src/examples/PodioExample/DatamodelGlue.h b/src/examples/PodioExample/DatamodelGlue.h index f0ae08426..a96ac9789 100644 --- a/src/examples/PodioExample/DatamodelGlue.h +++ b/src/examples/PodioExample/DatamodelGlue.h @@ -6,10 +6,10 @@ #ifndef JANA2_DATAMODELGLUE_H #define JANA2_DATAMODELGLUE_H -#include -#include -#include -#include +#include +#include +#include +#include template diff --git a/src/examples/PodioExample/ExampleClusterFactory.cc b/src/examples/PodioExample/ExampleClusterFactory.cc index c718c59e6..9e91ea83a 100644 --- a/src/examples/PodioExample/ExampleClusterFactory.cc +++ b/src/examples/PodioExample/ExampleClusterFactory.cc @@ -4,7 +4,7 @@ #include "ExampleClusterFactory.h" -#include "datamodel/ExampleHit.h" +#include "PodioExampleDatamodel/ExampleHit.h" #include ExampleClusterFactory::ExampleClusterFactory() { @@ -54,4 +54,4 @@ void ExampleClusterFactory::Process(const std::shared_ptr &event) } -// TODO: Expose collections as refs, not ptrs? \ No newline at end of file +// TODO: Expose collections as refs, not ptrs? diff --git a/src/examples/PodioExample/ExampleClusterFactory.h b/src/examples/PodioExample/ExampleClusterFactory.h index 0980c123a..39a979490 100644 --- a/src/examples/PodioExample/ExampleClusterFactory.h +++ b/src/examples/PodioExample/ExampleClusterFactory.h @@ -7,7 +7,7 @@ #define JANA2_EXAMPLECLUSTERFACTORY_H #include -#include "datamodel/ExampleCluster.h" +#include "PodioExampleDatamodel/ExampleCluster.h" #include "DatamodelGlue.h" class ExampleClusterFactory : public JFactoryPodioT { diff --git a/src/examples/PodioExample/PodioExample.cc b/src/examples/PodioExample/PodioExample.cc index 2bf703814..3980238a6 100644 --- a/src/examples/PodioExample/PodioExample.cc +++ b/src/examples/PodioExample/PodioExample.cc @@ -4,8 +4,8 @@ #include #include #include -#include "datamodel/MutableExampleHit.h" -#include "datamodel/ExampleHitCollection.h" +#include "PodioExampleDatamodel/MutableExampleHit.h" +#include "PodioExampleDatamodel/ExampleHitCollection.h" #include #include diff --git a/src/examples/PodioExample/PodioExampleSource.cc b/src/examples/PodioExample/PodioExampleSource.cc index 751dca681..66c5f5e4f 100644 --- a/src/examples/PodioExample/PodioExampleSource.cc +++ b/src/examples/PodioExample/PodioExampleSource.cc @@ -4,7 +4,7 @@ #include "PodioExampleSource.h" -#include +#include std::unique_ptr PodioExampleSource::NextFrame(int event_index, int &event_number, int &run_number) { diff --git a/src/programs/perf_tests/PodioStressTest.h b/src/programs/perf_tests/PodioStressTest.h index f2cddce7c..8ad2ee9df 100644 --- a/src/programs/perf_tests/PodioStressTest.h +++ b/src/programs/perf_tests/PodioStressTest.h @@ -1,7 +1,7 @@ #pragma once -#include -#include +#include +#include diff --git a/src/programs/unit_tests/Components/PodioTests.cc b/src/programs/unit_tests/Components/PodioTests.cc index 184e596fb..9fdcd4099 100644 --- a/src/programs/unit_tests/Components/PodioTests.cc +++ b/src/programs/unit_tests/Components/PodioTests.cc @@ -2,7 +2,7 @@ #include #include -#include +#include #include // Hopefully this won't be necessary in the future #include