Skip to content

Commit

Permalink
Fix PodioExampleDatamodel generation & install
Browse files Browse the repository at this point in the history
This addresses issue #329
  • Loading branch information
nathanwbrei committed Aug 2, 2024
1 parent 4b95840 commit 6fb343c
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 22 deletions.
33 changes: 21 additions & 12 deletions src/examples/PodioExample/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
8 changes: 4 additions & 4 deletions src/examples/PodioExample/DatamodelGlue.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
#ifndef JANA2_DATAMODELGLUE_H
#define JANA2_DATAMODELGLUE_H

#include <datamodel/ExampleHitCollection.h>
#include <datamodel/ExampleClusterCollection.h>
#include <datamodel/EventInfoCollection.h>
#include <datamodel/TimesliceInfoCollection.h>
#include <PodioExampleDatamodel/ExampleHitCollection.h>
#include <PodioExampleDatamodel/ExampleClusterCollection.h>
#include <PodioExampleDatamodel/EventInfoCollection.h>
#include <PodioExampleDatamodel/TimesliceInfoCollection.h>


template<typename ... Ts>
Expand Down
4 changes: 2 additions & 2 deletions src/examples/PodioExample/ExampleClusterFactory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


#include "ExampleClusterFactory.h"
#include "datamodel/ExampleHit.h"
#include "PodioExampleDatamodel/ExampleHit.h"
#include <JANA/JEvent.h>

ExampleClusterFactory::ExampleClusterFactory() {
Expand Down Expand Up @@ -54,4 +54,4 @@ void ExampleClusterFactory::Process(const std::shared_ptr<const JEvent> &event)
}


// TODO: Expose collections as refs, not ptrs?
// TODO: Expose collections as refs, not ptrs?
2 changes: 1 addition & 1 deletion src/examples/PodioExample/ExampleClusterFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#define JANA2_EXAMPLECLUSTERFACTORY_H

#include <JANA/Podio/JFactoryPodioT.h>
#include "datamodel/ExampleCluster.h"
#include "PodioExampleDatamodel/ExampleCluster.h"
#include "DatamodelGlue.h"

class ExampleClusterFactory : public JFactoryPodioT<ExampleCluster> {
Expand Down
4 changes: 2 additions & 2 deletions src/examples/PodioExample/PodioExample.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
#include <iostream>
#include <podio/CollectionBase.h>
#include <podio/Frame.h>
#include "datamodel/MutableExampleHit.h"
#include "datamodel/ExampleHitCollection.h"
#include "PodioExampleDatamodel/MutableExampleHit.h"
#include "PodioExampleDatamodel/ExampleHitCollection.h"
#include <podio/ROOTFrameWriter.h>
#include <podio/ROOTFrameReader.h>

Expand Down
2 changes: 1 addition & 1 deletion src/examples/PodioExample/PodioExampleSource.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


#include "PodioExampleSource.h"
#include <datamodel/EventInfo.h>
#include <PodioExampleDatamodel/EventInfo.h>

std::unique_ptr<podio::Frame> PodioExampleSource::NextFrame(int event_index, int &event_number, int &run_number) {

Expand Down

0 comments on commit 6fb343c

Please sign in to comment.