forked from mdelcourt/CosmicTrigger
-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
79 lines (68 loc) · 2.8 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
cmake_minimum_required (VERSION 2.6)
project (VeheMencE)
# Don't put the lib prefix in front of the livrary, so that it nicely loads in python
set(CMAKE_SHARED_LIBRARY_PREFIX "")
# Control the verbosity of the build
set(CMAKE_VERBOSE_MAKEFILE OFF)
# Python version
set(PYTHON_MIN_VERSION "2.7" CACHE STRING "Minimum Python version to look for")
set(Boost_PYTHON_VERSION_TAG "python27" CACHE STRING "Suffix for boost::python shared library (X in libboost_pythonX.py)")
# Use C++17
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
# Python headers and configure the build
find_package(PythonLibs ${PYTHON_MIN_VERSION} REQUIRED)
include_directories(${PYTHON_INCLUDE_DIRS})
message("-- Using python version: ${PYTHONLIBS_VERSION_STRING}")
# Find boost headers and configure the build
set(Boost_NO_BOOST_CMAKE ON)
set(_Boost_STACKTRACE_BASIC_HEADERS "boost/stacktrace.hpp")
set(_Boost_STACKTRACE_BACKTRACE_HEADERS "boost/stacktrace.hpp")
set(_Boost_STACKTRACE_ADDR2LINE_HEADERS "boost/stacktrace.hpp")
set(_Boost_STACKTRACE_NOOP_HEADERS "boost/stacktrace.hpp")
find_package(Boost 1.54 REQUIRED COMPONENTS ${Boost_PYTHON_VERSION_TAG} stacktrace_basic stacktrace_noop thread log log_setup)
include_directories(${Boost_INCLUDE_DIRS})
message("-- Using Boost version: ${Boost_VERSION}" )
add_definitions(-DBOOST_STACKTRACE_LINK -DBOOST_LOG_DYN_LINK)
# Find CAENLIB library and headers
set(CAEN_LIBRARY "CAENVME")
find_library(CAENLIB ${CAEN_LIBRARY})
find_file(CAENLIBHEADERS CAENVMElib.h)
if(NOT (CAENLIB AND CAENLIBHEADERS))
message(FATAL_ERROR "CAEN library not found")
endif()
get_filename_component(CAENLIB_INCLUDE_DIR ${CAENLIBHEADERS} DIRECTORY)
get_filename_component(CAENLIB_LIBRARY_PATH ${CAENLIB} DIRECTORY)
message("-- Using CAEN library.")
include_directories(${CAENLIB_INCLUDE_DIR})
link_directories(${CAENLIB_LIBRARY_PATH})
add_definitions(-DLINUX)
# Specify the sources
set(VEHEMENCE_SOURCES
"src/CommonDef.cpp"
"src/logger.cpp"
"src/VmeController.cpp"
"src/VmeUsbBridge.cpp"
"src/VmeBoard.cpp"
"src/CaenetBridge.cpp"
"src/Discri.cpp"
"src/Scaler.cpp"
"src/TTCvi.cpp"
"src/HVmodule.cpp"
"src/N470HVmodule.cpp"
"src/SY527PowerSystem.cpp"
"src/V1190Event.cpp"
"src/TDC.cpp"
"src/PythonModule.cpp"
)
# Build and link the shared library
add_library(VeheMencE SHARED ${VEHEMENCE_SOURCES})
target_include_directories(VeheMencE PRIVATE ${CMAKE_SOURCE_DIR}/include)
target_link_libraries(VeheMencE ${CAEN_LIBRARY} ${Boost_LIBRARIES})
# Examples
add_subdirectory (examples)
#installation
install (TARGETS VeheMencE DESTINATION lib)
install (TARGETS VeheMencE DESTINATION lib/python${PYTHON_MIN_VERSION}/site-packages)
install (DIRECTORY ${CMAKE_SOURCE_DIR}/include/ DESTINATION include/vehemence FILES_MATCHING PATTERN "*.h")