-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
157 lines (123 loc) · 4.78 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
project(mattak)
set(CMAKE_BUILD_TYPE "RelWithDebInfo")
option(PIP_INSTALLATION "Used by scikit-build-core to set correct default installation path" OFF)
if(PIP_INSTALLATION)
set(RNO_G_INSTALL_DIR ./build)
elseif(DEFINED ENV{RNO_G_INSTALL_DIR})
message("RNO_G_INSTALL_DIR is set to $ENV{RNO_G_INSTALL_DIR}")
set(RNO_G_INSTALL_DIR $ENV{RNO_G_INSTALL_DIR})
else()
message(WARNING "Will install to /usr/local RNO_G_INSTALL_DIR not set")
set(RNO_G_INSTALL_DIR "/usr/local")
endif()
set(UTIL_LIB_DIR ${RNO_G_INSTALL_DIR}/lib)
set(UTIL_INC_DIR ${RNO_G_INSTALL_DIR}/include)
set(UTIL_BIN_DIR ${RNO_G_INSTALL_DIR}/bin)
set(UTIL_SHARE_DIR ${RNO_G_INSTALL_DIR}/share)
set(LD_UTIL ${RNO_G_INSTALL_DIR}/lib)
set(INC_UTIL ${RNO_G_INSTALL_DIR}/include)
if (NOT DEFINED ROOTLESS)
list(APPEND CMAKE_PREFIX_PATH $ENV{ROOTSYS})
#---Locate the ROOT package and defines a number of variables (e.g. ROOT_INCLUDE_DIRS)
find_package(ROOT COMPONENTS Matrix Minuit)
if( ROOT_FOUND)
set(libname mattak)
set(DICTNAME G__${libname})
include(${ROOT_USE_FILE} )
include_directories( ${ROOT_INCLUDE_DIRS} ${PROJECT_SOURCE_DIR}/src ${UTIL_INC_DIR})
option (LIBRNO_G_SUPPORT "Support for reading / converting from raw files." OFF)
set (LIBRNO_G_PATH "../librno-g" CACHE STRING "Additional path to search for librno-g (only necessary if not in RNO_G_INSTALL_DIR/lib)" )
set(H_FILES
mattak/Header.h
mattak/Constants.h
mattak/DAQStatus.h
mattak/Sensors.h
mattak/TriggerInfo.h
mattak/GNSS.h
mattak/Waveforms.h
mattak/Pedestals.h
mattak/Converter.h
mattak/RunInfo.h
mattak/Version.h
mattak/VoltageCalibration.h
mattak/Dataset.h
)
configure_file("src/Version.cc.in" "Version.cc.in" COPYONLY)
configure_file("${CMAKE_CURRENT_BINARY_DIR}/Version.cc.in" "Version.cc" COPYONLY)
set(CC_FILES
src/Header.cc
src/DAQStatus.cc
src/Sensors.cc
src/TriggerInfo.cc
src/GNSS.cc
src/Waveforms.cc
src/Pedestals.cc
src/Converter.cc
src/RunInfo.cc
src/VoltageCalibration.cc
src/Dataset.cc
${CMAKE_CURRENT_BINARY_DIR}/Version.cc
)
set (INSTALL_SCRIPTS
scripts/rno-g-convert-run
scripts/rno-g-make-eventlists
)
add_custom_target(version ${CMAKE_COMMAND} -P ${CMAKE_SOURCE_DIR}/version.cmake)
ROOT_GENERATE_DICTIONARY(${DICTNAME} ${H_FILES} LINKDEF src/LinkDef.h)
add_library(${libname} SHARED ${CC_FILES} ${DICTNAME}.cxx)
add_dependencies(${libname} version)
install (DIRECTORY src/mattak DESTINATION ${UTIL_INC_DIR})
install (PROGRAMS ${INSTALL_SCRIPTS} DESTINATION ${UTIL_BIN_DIR})
install (TARGETS ${libname}
ARCHIVE DESTINATION ${UTIL_LIB_DIR}
LIBRARY DESTINATION ${UTIL_LIB_DIR}
RUNTIME DESTINATION ${UTIL_BIN_DIR}
)
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/lib${libname}_rdict.pcm DESTINATION ${UTIL_LIB_DIR} )
if (LIBRNO_G_SUPPORT)
add_definitions( -DLIBRNO_G_SUPPORT )
find_library(RNO_G_LIB rno-g PATHS ${LIBRNO_G_PATH}/build ${UTIL_LIB_DIR})
find_package(ZLIB REQUIRED)
include_directories(${UTIL_INC_DIR})
include_directories(${LIBRNO_G_PATH}/src)
include_directories(${LIBNUPHASE_PATH})
target_link_libraries(${libname} ${RNO_G_LIB} ${ZLIB_LIBRARIES} ${ROOT_LIBRARIES})
else()
target_link_libraries(${libname} ${ROOT_LIBRARIES})
endif()
set (BINSRCDIR prog)
macro(add_program binary_name )
add_executable(${binary_name} ${BINSRCDIR}/${binary_name}.cc)
target_link_libraries(${binary_name} ${ROOT_LIBRARIES} ${libname})
if (LIBNUPHASE_SUPPORT)
target_link_libraries(${binary_name} ${ZLIB_LIBRARIES} rno-g)
endif()
INSTALL (PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${binary_name} DESTINATION ${UTIL_BIN_DIR})
endmacro()
if (LIBRNO_G_SUPPORT)
add_program(rno-g-convert)
add_program(rno-g-test-voltage-calibration)
add_program(rno-g-readout-elapsed)
endif( )
add_program(rno-g-combine)
add_program(rno-g-test-apply-voltage-calibration)
add_program(rno-g-make-eventlist)
add_program(rno-g-count-events)
add_program(rno-g-summary-tree)
else()
message(WARNING "No ROOT installation found. Skipping ROOTful version")
endif()
endif()
if(NOT DEFINED PYBINDLESS)
find_package(pybind11 CONFIG REQUIRED)
include_directories(${PROJECT_SOURCE_DIR}/src)
add_library(mattak_noroot MODULE src/VoltageCalibration.cc)
target_compile_definitions(mattak_noroot PUBLIC -DMATTAK_NOROOT)
target_link_libraries(mattak_noroot PUBLIC pybind11::module)
install (TARGETS mattak_noroot
ARCHIVE DESTINATION ${UTIL_LIB_DIR}
LIBRARY DESTINATION ${UTIL_LIB_DIR}
RUNTIME DESTINATION ${UTIL_BIN_DIR}
)
endif()