Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmake fixes for the rdataframe analyzers #37

Merged
merged 2 commits into from
Apr 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions case-studies/flavour/dataframe/analyzers/Bs2DsK.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include <random>
#include <chrono>
#include <iostream>

using namespace MCParticle;
using namespace VertexFitterSimple;
Expand Down
1 change: 1 addition & 0 deletions case-studies/flavour/dataframe/analyzers/Bs2JPsiPhi.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "Bs2JPsiPhi.h"
#include <iostream>

using namespace MCParticle;
using namespace VertexFitterSimple;
Expand Down
48 changes: 30 additions & 18 deletions case-studies/flavour/dataframe/analyzers/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@

find_package(ROOT REQUIRED COMPONENTS ROOTDataFrame ROOTVecOps)
include(${ROOT_USE_FILE})
#include("${ROOT_DIR}/modules/RootNewMacros.cmake")

find_package(EDM4HEP)
find_package(podio)
find_package(Vdt)


set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
Expand All @@ -20,27 +20,39 @@ file(GLOB sources *.cc)
file(GLOB headers *.h)
add_library(FCCAnalysesFlavour SHARED ${sources} ${headers} G__FCCAnalysesFlavour.cxx )
target_include_directories(FCCAnalysesFlavour PUBLIC
${CMAKE_SOURCE_DIR}/analyzers
${FCCANALYSES_INCLUDE_PATH}
)
target_link_libraries(FCCAnalysesFlavour ROOT::Physics ROOT::MathCore ROOT::ROOTVecOps ROOT::ROOTDataFrame EDM4HEP::edm4hep EDM4HEP::edm4hepDict podio::podio)

set_target_properties(FCCAnalysesFlavour PROPERTIES
PUBLIC_HEADER "${headers}")
${CMAKE_SOURCE_DIR}/analyzers
${FCCANALYSES_INCLUDE_PATH}
${VDT_INCLUDE_DIR}
)
target_link_libraries(FCCAnalysesFlavour
ROOT::Physics
ROOT::MathCore
ROOT::ROOTVecOps
ROOT::ROOTDataFrame
EDM4HEP::edm4hep
EDM4HEP::edm4hepDict
podio::podio
)

set_target_properties(FCCAnalysesFlavour
PROPERTIES PUBLIC_HEADER "${headers}")

install(TARGETS FCCAnalysesFlavour
RUNTIME DESTINATION "${INSTALL_BIN_DIR}" COMPONENT bin
LIBRARY DESTINATION "${INSTALL_LIB_DIR}" COMPONENT shlib
PUBLIC_HEADER DESTINATION "${INSTALL_INCLUDE_DIR}/FCCAnalysesFlavour"
COMPONENT dev
)
RUNTIME DESTINATION "${INSTALL_BIN_DIR}" COMPONENT bin
LIBRARY DESTINATION "${INSTALL_LIB_DIR}" COMPONENT shlib
PUBLIC_HEADER DESTINATION "${INSTALL_INCLUDE_DIR}/FCCAnalysesFlavour"
COMPONENT dev
)

install(FILES
"${PROJECT_BINARY_DIR}/analyzers/libFCCAnalysesFlavour.rootmap"
DESTINATION "${INSTALL_LIB_DIR}" COMPONENT dev)
"${PROJECT_BINARY_DIR}/analyzers/libFCCAnalysesFlavour.rootmap"
DESTINATION "${INSTALL_LIB_DIR}"
COMPONENT dev
)

if (${ROOT_VERSION} GREATER 6)
install(FILES
"${PROJECT_BINARY_DIR}/analyzers/libFCCAnalysesFlavour_rdict.pcm"
DESTINATION "${INSTALL_LIB_DIR}" COMPONENT dev)
endif()
"${PROJECT_BINARY_DIR}/analyzers/libFCCAnalysesFlavour_rdict.pcm"
DESTINATION "${INSTALL_LIB_DIR}"
COMPONENT dev)
endif()
83 changes: 83 additions & 0 deletions case-studies/flavour/dataframe/cmake/FindVdt.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Copyright (C) 1995-2019, Rene Brun and Fons Rademakers.
# All rights reserved.
#
# For the licensing terms see $ROOTSYS/LICENSE.
# For the list of contributors see $ROOTSYS/README/CREDITS.

#.rst:
# FindVdt
# -------
#
# Find the Vdt library header and define variables.
#
# Imported Targets
# ^^^^^^^^^^^^^^^^
#
# This module defines :prop_tgt:`IMPORTED` target ``VDT::VDT``,
# if Vdt has been found.
#
# Result Variables
# ^^^^^^^^^^^^^^^^
#
# This module defines the following variables:
#
# ::
#
# VDT_FOUND - True if Vdt is found.
# VDT_INCLUDE_DIRS - Where to find vdt/vdtMath.h
#
# ::
#
# VDT_VERSION - The version of Vdt found (x.y.z)
# VDT_VERSION_MAJOR - The major version of Vdt
# VDT_VERSION_MINOR - The minor version of Vdt
# VDT_VERSION_PATCH - The patch version of Vdt
#

if(NOT VDT_INCLUDE_DIR)
find_path(VDT_INCLUDE_DIR NAME vdt/vdtMath.h PATH_SUFFIXES include)
endif()

if(NOT VDT_LIBRARY)
find_library(VDT_LIBRARY NAMES vdt)
endif()

mark_as_advanced(VDT_INCLUDE_DIR VDT_LIBRARY)

if(VDT_INCLUDE_DIR)
file(STRINGS "${VDT_INCLUDE_DIR}/vdt/vdtMath.h" VDT_H REGEX "^#define VDT_VERSION_[A-Z]+[ ]+[0-9]+.*$")
string(REGEX REPLACE ".+VDT_VERSION_MAJOR[ ]+([0-9]+).*$" "\\1" VDT_VERSION_MAJOR "${VDT_H}")
string(REGEX REPLACE ".+VDT_VERSION_MINOR[ ]+([0-9]+).*$" "\\1" VDT_VERSION_MINOR "${VDT_H}")
string(REGEX REPLACE ".+VDT_VERSION_PATCH[ ]+([0-9]+).*$" "\\1" VDT_VERSION_PATCH "${VDT_H}")
set(VDT_VERSION "${VDT_VERSION_MAJOR}.${VDT_VERSION_MINOR}.${VDT_VERSION_PATCH}")
if("${VDT_VERSION}" STREQUAL "..")
if(EXISTS "${VDT_INCLUDE_DIR}/vdt/tanh.h")
set(VDT_VERSION "0.4")
else()
set(VDT_VERSION "0.3")
endif()
endif()
endif()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Vdt FOUND_VAR VDT_FOUND
REQUIRED_VARS VDT_INCLUDE_DIR VDT_LIBRARY VERSION_VAR VDT_VERSION)

if(VDT_FOUND)
set(VDT_INCLUDE_DIRS ${VDT_INCLUDE_DIR})

if(NOT VDT_LIBRARIES)
set(VDT_LIBRARIES ${VDT_LIBRARY})
endif()

if(NOT TARGET VDT::VDT)
add_library(VDT::VDT UNKNOWN IMPORTED)

set_target_properties(VDT::VDT
PROPERTIES
IMPORTED_LOCATION "${VDT_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${VDT_INCLUDE_DIRS}"
)
endif()
endif()

42 changes: 25 additions & 17 deletions case-studies/higgs/dataframe/analyzers/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ include(${ROOT_USE_FILE})

find_package(EDM4HEP)
find_package(podio)
find_package(Vdt)


set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
Expand All @@ -14,9 +15,10 @@ get_target_property(EDM4HEP_INCLUDE_DIRS EDM4HEP::edm4hep INTERFACE_INCLUDE_DIRE
include_directories(${EDM4HEP_INCLUDE_DIRS} ${podio_INCLUDE_DIR})

ROOT_GENERATE_DICTIONARY(G__FCCAnalysesHiggs
dummyLoaderHiggs.h
APCHiggsTools.h
LINKDEF LinkDef.h)
dummyLoaderHiggs.h
APCHiggsTools.h
LINKDEF LinkDef.h
)


file(GLOB sources *.cc)
Expand All @@ -25,31 +27,37 @@ add_library(FCCAnalysesHiggs SHARED ${sources} ${headers} G__FCCAnalysesHiggs.cx
target_include_directories(FCCAnalysesHiggs PUBLIC
${CMAKE_SOURCE_DIR}/analyzers
${FCCANALYSES_INCLUDE_PATH}
)
${VDT_INCLUDE_DIR}
)
target_link_libraries(FCCAnalysesHiggs ROOT::Physics
ROOT::MathCore
ROOT::ROOTVecOps
ROOT::ROOTDataFrame
EDM4HEP::edm4hep
EDM4HEP::edm4hepDict
podio::podio)
podio::podio
)

set_target_properties(FCCAnalysesHiggs PROPERTIES
PUBLIC_HEADER "${headers}")
set_target_properties(FCCAnalysesHiggs
PROPERTIES PUBLIC_HEADER "${headers}")

install(TARGETS FCCAnalysesHiggs
RUNTIME DESTINATION "${INSTALL_BIN_DIR}" COMPONENT bin
LIBRARY DESTINATION "${INSTALL_LIB_DIR}" COMPONENT shlib
PUBLIC_HEADER DESTINATION "${INSTALL_INCLUDE_DIR}/FCCAnalysesHiggs"
COMPONENT dev
)
RUNTIME DESTINATION "${INSTALL_BIN_DIR}" COMPONENT bin
LIBRARY DESTINATION "${INSTALL_LIB_DIR}" COMPONENT shlib
PUBLIC_HEADER DESTINATION "${INSTALL_INCLUDE_DIR}/FCCAnalysesHiggs"
COMPONENT dev
)

install(FILES
"${PROJECT_BINARY_DIR}/analyzers/libFCCAnalysesHiggs.rootmap"
DESTINATION "${INSTALL_LIB_DIR}" COMPONENT dev)
"${PROJECT_BINARY_DIR}/analyzers/libFCCAnalysesHiggs.rootmap"
DESTINATION "${INSTALL_LIB_DIR}"
COMPONENT dev
)

if (${ROOT_VERSION} GREATER 6)
install(FILES
"${PROJECT_BINARY_DIR}/analyzers/libFCCAnalysesHiggs_rdict.pcm"
DESTINATION "${INSTALL_LIB_DIR}" COMPONENT dev)
endif()
"${PROJECT_BINARY_DIR}/analyzers/libFCCAnalysesHiggs_rdict.pcm"
DESTINATION "${INSTALL_LIB_DIR}"
COMPONENT dev
)
endif()
83 changes: 83 additions & 0 deletions case-studies/higgs/dataframe/cmake/FindVdt.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Copyright (C) 1995-2019, Rene Brun and Fons Rademakers.
# All rights reserved.
#
# For the licensing terms see $ROOTSYS/LICENSE.
# For the list of contributors see $ROOTSYS/README/CREDITS.

#.rst:
# FindVdt
# -------
#
# Find the Vdt library header and define variables.
#
# Imported Targets
# ^^^^^^^^^^^^^^^^
#
# This module defines :prop_tgt:`IMPORTED` target ``VDT::VDT``,
# if Vdt has been found.
#
# Result Variables
# ^^^^^^^^^^^^^^^^
#
# This module defines the following variables:
#
# ::
#
# VDT_FOUND - True if Vdt is found.
# VDT_INCLUDE_DIRS - Where to find vdt/vdtMath.h
#
# ::
#
# VDT_VERSION - The version of Vdt found (x.y.z)
# VDT_VERSION_MAJOR - The major version of Vdt
# VDT_VERSION_MINOR - The minor version of Vdt
# VDT_VERSION_PATCH - The patch version of Vdt
#

if(NOT VDT_INCLUDE_DIR)
find_path(VDT_INCLUDE_DIR NAME vdt/vdtMath.h PATH_SUFFIXES include)
endif()

if(NOT VDT_LIBRARY)
find_library(VDT_LIBRARY NAMES vdt)
endif()

mark_as_advanced(VDT_INCLUDE_DIR VDT_LIBRARY)

if(VDT_INCLUDE_DIR)
file(STRINGS "${VDT_INCLUDE_DIR}/vdt/vdtMath.h" VDT_H REGEX "^#define VDT_VERSION_[A-Z]+[ ]+[0-9]+.*$")
string(REGEX REPLACE ".+VDT_VERSION_MAJOR[ ]+([0-9]+).*$" "\\1" VDT_VERSION_MAJOR "${VDT_H}")
string(REGEX REPLACE ".+VDT_VERSION_MINOR[ ]+([0-9]+).*$" "\\1" VDT_VERSION_MINOR "${VDT_H}")
string(REGEX REPLACE ".+VDT_VERSION_PATCH[ ]+([0-9]+).*$" "\\1" VDT_VERSION_PATCH "${VDT_H}")
set(VDT_VERSION "${VDT_VERSION_MAJOR}.${VDT_VERSION_MINOR}.${VDT_VERSION_PATCH}")
if("${VDT_VERSION}" STREQUAL "..")
if(EXISTS "${VDT_INCLUDE_DIR}/vdt/tanh.h")
set(VDT_VERSION "0.4")
else()
set(VDT_VERSION "0.3")
endif()
endif()
endif()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Vdt FOUND_VAR VDT_FOUND
REQUIRED_VARS VDT_INCLUDE_DIR VDT_LIBRARY VERSION_VAR VDT_VERSION)

if(VDT_FOUND)
set(VDT_INCLUDE_DIRS ${VDT_INCLUDE_DIR})

if(NOT VDT_LIBRARIES)
set(VDT_LIBRARIES ${VDT_LIBRARY})
endif()

if(NOT TARGET VDT::VDT)
add_library(VDT::VDT UNKNOWN IMPORTED)

set_target_properties(VDT::VDT
PROPERTIES
IMPORTED_LOCATION "${VDT_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${VDT_INCLUDE_DIRS}"
)
endif()
endif()