-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
104 lines (97 loc) · 4.43 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
# CMake project file for CtrlRoom v1.1
################################################################################
# PROJECT: CtrlRoom
################################################################################
cmake_minimum_required (VERSION 2.6)
project (CtrlRoom)
set (VERSION "1.1")
set (SOVERSION "1.1")
################################################################################
# Sources and headers
################################################################################
set (SOURCES "ctrlroom/vme/caen_v1729.cpp"
"ctrlroom/vme/caen_discriminator.cpp"
"ctrlroom/vme/caen_bridge.cpp"
"ctrlroom/vme/master.cpp"
"ctrlroom/vme/caen_v1729/spec.cpp"
"ctrlroom/vme/caen_discriminator/spec.cpp"
"ctrlroom/util/io.cpp"
"ctrlroom/util/logger.cpp"
"ctrlroom/util/configuration.cpp"
"ctrlroom/util/io/array.cpp"
"ctrlroom/board.cpp")
set (HEADERS "ctrlroom/vme/master/block_transfer.hpp"
"ctrlroom/vme/slave.hpp"
"ctrlroom/vme/master.hpp"
"ctrlroom/vme/caen_bridge.hpp"
"ctrlroom/vme/caen_discriminator.hpp"
"ctrlroom/vme/caen_discriminator/spec.hpp"
"ctrlroom/vme/caen_v1729.hpp"
"ctrlroom/vme/caen_v1729/channel_index.hpp"
"ctrlroom/vme/caen_v1729/spec.hpp"
"ctrlroom/vme/vme64.hpp"
"ctrlroom/util/root.hpp"
"ctrlroom/util/stringify.hpp"
"ctrlroom/util/assert.hpp"
"ctrlroom/util/type_traits.hpp"
"ctrlroom/util/io/array.hpp"
"ctrlroom/util/mixin.hpp"
"ctrlroom/util/configuration.hpp"
"ctrlroom/util/exception.hpp"
"ctrlroom/util/logger.hpp"
"ctrlroom/util/io.hpp"
"ctrlroom/board.hpp")
################################################################################
# CMAKE and Compiler Settings
################################################################################
## make sure that the default is RELEASE
if (NOT CMAKE_BUILD_TYPE)
set (CMAKE_BUILD_TYPE RELEASE CACHE STRING
"Choose the type of build, options are: None Debug Release."
FORCE)
endif (NOT CMAKE_BUILD_TYPE)
## extra cmake modules
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
"${CMAKE_SOURCE_DIR}/cmake/Modules/")
# CXX FLAGS (currently only supports gcc (>=4.8) and clang)
# -O1 for debug to take care of a problem with constexpr in gcc
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -std=c++11 -fPIC")
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O1 -std=c++11 -fPIC")
set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -fPIC")
set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -fPIC")
# Project source dir is in the include path
include_directories(BEFORE ${PROJECT_SOURCE_DIR})
################################################################################
# External Libraries
################################################################################
# require BOOST program_options library
find_package(Boost COMPONENTS program_options filesystem REQUIRED)
include_directories(AFTER ${Boost_INCLUDE_DIRS})
## CAENVME libraries required, except for local development on a macbook,
## where the VME libraries aren't present
IF (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(CAENVME_INCLUDE_DIRS tmpincludes)
set(CAENVME_DEFINITIONS -DLINUX)
ELSE ()
find_package(CAENVME REQUIRED)
ENDIF (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
include_directories(AFTER ${CAENVME_INCLUDE_DIRS})
add_definitions(${CAENVME_DEFINITIONS})
################################################################################
# Compile and Link
################################################################################
add_library(ctrlroom SHARED ${SOURCES} ${HEADERS})
target_link_libraries(ctrlroom
${Boost_LIBRARIES}
${CAENVME_LIBRARIES})
set_target_properties(ctrlroom PROPERTIES VERSION ${VERSION} SOVERSION ${SOVERSION})
################################################################################
# Install
################################################################################
# 1. install all headers
FOREACH (header ${HEADERS})
GET_FILENAME_COMPONENT(header_path ${header} PATH)
install (FILES ${header} DESTINATION include/${header_path})
ENDFOREACH()
# 2. install the shared library
install (TARGETS ctrlroom DESTINATION lib)