Commit 318462b1 authored by Simon Spannagel's avatar Simon Spannagel
Browse files

Rework Peary CMake module

parent c8cad47d
Pipeline #358226 passed with stages
in 4 minutes and 58 seconds
......@@ -4,22 +4,25 @@
# PEARY_INCLUDE_DIR - The PEARY main include directories
# PEARY_LIBRARY - The libraries needed to use PEARY
MESSAGE(STATUS "Looking for PEARY...")
MESSAGE(STATUS "Looking for Peary...")
FIND_PATH(PEARY_INCLUDE_DIR NAMES "devices/clicpix2/clicpix2.hpp" PATHS "$ENV{PEARYPATH}")
IF(PEARY_INCLUDE_DIR)
SET(PEARY_INC_FOUND TRUE)
MESSAGE(STATUS "Found PEARY headers: ${PEARY_INCLUDE_DIR}")
ENDIF()
FIND_LIBRARY(PEARY_LIBRARY NAMES "CLICpix2" HINTS "$ENV{PEARYPATH}/lib")
IF(PEARY_LIBRARY)
SET(PEARY_LIB_FOUND TRUE)
MESSAGE(STATUS "Found PEARY library: ${PEARY_LIBRARY}")
ENDIF()
FIND_PATH(Peary_INCLUDE_DIRS NAMES "peary/device/device.hpp" PATHS "$ENV{PEARYPATH}")
FIND_LIBRARY(Peary_LIBRARIES NAMES "peary" HINTS "$ENV{PEARYPATH}/lib")
IF(PEARY_LIB_FOUND AND PEARY_INC_FOUND)
SET(PEARY_FOUND TRUE)
IF(Peary_FIND_COMPONENTS)
FOREACH(component ${Peary_FIND_COMPONENTS})
STRING(TOLOWER "${component}" _COMP)
FIND_PATH(Peary_COMP_INCLUDE NAMES "devices/${_COMP}/${_COMP}.hpp" PATHS "$ENV{PEARYPATH}")
FIND_LIBRARY(Peary_COMP_LIB NAMES "${component}" HINTS "$ENV{PEARYPATH}/lib")
IF(Peary_COMP_INCLUDE AND Peary_COMP_LIB)
LIST(APPEND Peary_LIBRARIES "${Peary_COMP_LIB}")
SET(Peary_${component}_FOUND TRUE)
ELSE()
MESSAGE(STATUS "Looking for Peary component: ${component} -- NOTFOUND")
ENDIF()
ENDFOREACH()
ENDIF()
mark_as_advanced(PEARY_LIBRARY PEARY_INCLUDE_DIR)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Peary REQUIRED_VARS Peary_INCLUDE_DIRS Peary_LIBRARIES
HANDLE_COMPONENTS
FAIL_MESSAGE "Could not find Peary or a required component, make sure all necessary components are compiled and that the variable PEARYPATH points to the installation location:\n$ export PEARYPATH=/your/path/to/Peary\n")
......@@ -3,24 +3,18 @@ CORRYVRECKAN_ENABLE_DEFAULT(OFF)
# Define module and return the generated name as ALGORITHM_NAME
CORRYVRECKAN_ALGORITHM(ALGORITHM_NAME)
# Geant4 is required for geometry description and charge deposition.
FIND_PACKAGE(Peary)
IF(NOT PEARY_FOUND)
MESSAGE(FATAL_ERROR "Could not find Peary, make sure to set the path to your installation using\n"
"$ export PEARYPATH=/your/path/to/Peary")
ENDIF()
# Peary and its CLICpix2 component is required for data decoding:
FIND_PACKAGE(Peary REQUIRED COMPONENTS CLICpix2)
# Add source files to library
CORRYVRECKAN_ALGORITHM_SOURCES(${ALGORITHM_NAME}
Clicpix2EventLoader.cpp
# ADD SOURCE FILES HERE...
)
MESSAGE(STATUS "${PEARY_INCLUDE_DIR}")
TARGET_INCLUDE_DIRECTORIES(${ALGORITHM_NAME} SYSTEM PRIVATE ${PEARY_INCLUDE_DIR}/devices/clicpix2 ${PEARY_INCLUDE_DIR}/peary/utils)
TARGET_INCLUDE_DIRECTORIES(${ALGORITHM_NAME} SYSTEM PRIVATE ${Peary_INCLUDE_DIRS}/devices/clicpix2 ${Peary_INCLUDE_DIRS}/peary/utils)
# Add Geant4 libraries
TARGET_LINK_LIBRARIES(${ALGORITHM_NAME} ${PEARY_LIBRARY} ${PEARY_CLICPIX2_LIBRARY})
# Link required Peary libraries
TARGET_LINK_LIBRARIES(${ALGORITHM_NAME} ${Peary_LIBRARIES})
# Provide standard install target
CORRYVRECKAN_ALGORITHM_INSTALL(${ALGORITHM_NAME})
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment