# CMakeLists.txt for the "lar-lenses" package. # If ROOT is not installed in a default system location you need to tell CMake where to find it. # Sourcing `thisroot.sh` already sets the required environment variables. # Otherwise, you'll have to tell the build system where to look for ROOT, # e.g. by passing `-DROOT_DIR="/path/to/root/installation` at cmake configuration time. cmake_minimum_required(VERSION 2.8) if(${CMAKE_VERSION} VERSION_LESS 3.12) cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}) endif() project(lar-lenses LANGUAGES CXX) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_PLATFORM_INDEPENDENT_CODE ON) #---Check "ROOT" environment variable is set #message("THING:" $ENV{THING}) if(NOT DEFINED ENV{ROOTSYS}) message(FATAL_ERROR "ROOTSYS environment variable not defined") endif() #---Locate the ROOT package and defines a number of variables (e.g. ROOT_INCLUDE_DIRS) find_package(ROOT REQUIRED COMPONENTS Geom Physics Matrix MathCore MathMore RIO Net Tree TreePlayer) find_library(ROOT_TREEPLAYER_LIBRARY TreePlayer HINTS ${ROOT_LIBRARY_DIR} REQUIRED) find_library(ROOT_MATHMORE_LIBRARY MathMore HINTS ${ROOT_LIBRARY_DIR} REQUIRED) #---Include edepsim-io libraries find_library(edepsim_io NAMES edepsim_io PATHS ENV LD_LIBRARY_PATH) if(NOT edepsim_io) message(FATAL_ERROR "Failed to find the edepsim_io library.") else() message(STATUS "Found edepsim_io at: ${edepsim_io}") endif() message("CURRENT ROOT SYS="$ENV{ROOTSYS}) message("CURRENT ROOT SYS="$ENV{ROOT_INCLUDE_DIRS}) #---Include ROOT / edepsim-io / local project include_directories(${ROOT_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}/include $ENV{EDEPSIM_IO_DIR}) file(GLOB sources ${PROJECT_SOURCE_DIR}/src/*.cpp) file(GLOB headers ${PROJECT_SOURCE_DIR}/include/*.h) # Creates a libStruct shared library with a generated dictionary. ROOT_GENERATE_DICTIONARY(G__Struct struct.h LINKDEF include/Linkdef.h) add_library(Struct SHARED G__Struct.cxx) target_link_libraries(Struct PUBLIC ROOT::RIO ROOT::Net) #---------------------------------------------------------------------------- # Add the executables add_executable(single single.cpp ${sources} ${headers}) target_link_libraries(single PUBLIC ${ROOT_LIBRARIES} ${edepsim_io}) add_executable(fast-lenses reco_fast.cpp ${sources} ${headers}) target_link_libraries(fast-lenses PUBLIC Struct ${ROOT_LIBRARIES} ${edepsim_io}) add_executable(full-lenses reco_full.cpp ${sources} ${headers}) target_link_libraries(full-lenses PUBLIC ${ROOT_LIBRARIES} ${edepsim_io}) add_executable(calo calo.cpp ${sources} ${headers}) target_link_libraries(calo PUBLIC Struct ${ROOT_LIBRARIES} ${edepsim_io}) add_executable(convert src/convert.C ${sources} ${headers}) target_link_libraries(convert PUBLIC Struct ${ROOT_LIBRARIES} ${edepsim_io}) #add_executable(vertex manual_vertex.cpp ${sources} ${headers}) #target_link_libraries(vertex PUBLIC ${ROOT_LIBRARIES} ${edepsim_io}) add_executable(geo src/geometry.C ${sources} ${headers}) target_link_libraries(geo PUBLIC ${ROOT_LIBRARIES} ${edepsim_io}) add_executable(lecce_save src/lecce_save.C ${sources} ${headers}) target_link_libraries(lecce_save PUBLIC ${ROOT_LIBRARIES} ${edepsim_io}) add_executable(visible src/visible_tracks.C ${sources} ${headers}) target_link_libraries(visible PUBLIC ${ROOT_LIBRARIES} ${edepsim_io}) #-------------------------------------------------------------------------- # Copy all scripts/stuff to the build directory set(OptMen_SCRIPTS setup_CNAF run_fast.sh run_full.sh run_single.sh run_visible.sh run_lecce_save.sh run_calo.sh submit_fast.sub submit_full.sub) foreach(_script ${OptMen_SCRIPTS}) configure_file( ${PROJECT_SOURCE_DIR}/${_script} ${PROJECT_BINARY_DIR}/${_script} COPYONLY ) endforeach()