CMakeLists.txt 5.07 KB
Newer Older
1
CMAKE_MINIMUM_REQUIRED(VERSION 3.1)
2

3
# Project properties
Guilhem Saurel's avatar
Guilhem Saurel committed
4
SET(PROJECT_ORG stack-of-tasks)
5
6
SET(PROJECT_NAME dynamic-graph)
SET(PROJECT_DESCRIPTION "Dynamic graph library")
7
SET(PROJECT_URL "https://github.com/${PROJECT_ORG}/${PROJECT_NAME}")
8
SET(PROJECT_SUFFIX "-v3")
9

10
11
# Project options
OPTION(SUFFIX_SO_VERSION "Suffix library name with its version" ON)
Olivier Stasse's avatar
Olivier Stasse committed
12

13
14
# Project configuration
SET(PROJECT_USE_CMAKE_EXPORT TRUE)
Olivier Stasse's avatar
Olivier Stasse committed
15
SET(CUSTOM_HEADER_DIR ${PROJECT_NAME})
Olivier Stasse's avatar
Olivier Stasse committed
16
SET(CXX_DISABLE_WERROR TRUE)
17
18

# Doxygen setup
19
SET(DOXYGEN_USE_MATHJAX YES)
20
21
SET(DOXYGEN_USE_TEMPLATE_CSS YES)

22
# JRL-cmakemodule setup
23
INCLUDE(cmake/base.cmake)
24
INCLUDE(cmake/boost.cmake)
25

26
# Project definition
27
28
COMPUTE_PROJECT_ARGS(PROJECT_ARGS LANGUAGES CXX)
PROJECT(${PROJECT_NAME} ${PROJECT_ARGS})
29
CHECK_MINIMAL_CXX_STANDARD(11 ENFORCE)
30

31
INCLUDE(cmake/pthread.cmake)  # needs to be included after the CXX definition
32

33
# Project dependencies
34
35
36
IF(BUILD_TESTING)
  FIND_PACKAGE(Boost REQUIRED COMPONENTS unit_test_framework)
ENDIF()
Guilhem Saurel's avatar
Guilhem Saurel committed
37
38
ADD_PROJECT_DEPENDENCY(Boost REQUIRED COMPONENTS serialization system thread)
ADD_PROJECT_DEPENDENCY(Eigen3 REQUIRED PKG_CONFIG_REQUIRES eigen3)
39
SEARCH_FOR_PTHREAD()
40

41
42
43
44
45
46
47
# Add configuration headers for plug-ins.
GENERATE_CONFIGURATION_HEADER(
  ${HEADER_DIR} config-tracer.hh DG_TRACER tracer_EXPORTS)
GENERATE_CONFIGURATION_HEADER(
  ${HEADER_DIR}
  config-tracer-real-time.hh DG_TRACERREALTIME tracer_real_time_EXPORTS)

Olivier Stasse's avatar
Olivier Stasse committed
48
# Verbosity level
49
IF(NOT (\"${CMAKE_VERBOSITY_LEVEL}\" STREQUAL \"\"))
Olivier Stasse's avatar
Olivier Stasse committed
50
  ADD_DEFINITIONS(-DVP_DEBUG_MODE=${CMAKE_VERBOSITY_LEVEL} -DVP_DEBUG)
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
ENDIF(NOT (\"${CMAKE_VERBOSITY_LEVEL}\" STREQUAL \"\"))

# Main Library
SET(${PROJECT_NAME}_HEADERS
  include/${CUSTOM_HEADER_DIR}/fwd.hh
  include/${CUSTOM_HEADER_DIR}/debug.h
  include/${CUSTOM_HEADER_DIR}/real-time-logger.h
  include/${CUSTOM_HEADER_DIR}/real-time-logger-def.h

  include/${CUSTOM_HEADER_DIR}/dynamic-graph-api.h

  include/${CUSTOM_HEADER_DIR}/entity.h
  include/${CUSTOM_HEADER_DIR}/factory.h
  include/${CUSTOM_HEADER_DIR}/pool.h

  include/${CUSTOM_HEADER_DIR}/exception-abstract.h
  include/${CUSTOM_HEADER_DIR}/exception-factory.h
  include/${CUSTOM_HEADER_DIR}/exception-signal.h
  include/${CUSTOM_HEADER_DIR}/exception-traces.h

  include/${CUSTOM_HEADER_DIR}/signal.h
  include/${CUSTOM_HEADER_DIR}/signal-array.h
  include/${CUSTOM_HEADER_DIR}/signal-base.h
  include/${CUSTOM_HEADER_DIR}/signal-ptr.h
  include/${CUSTOM_HEADER_DIR}/signal-time-dependent.h
  include/${CUSTOM_HEADER_DIR}/signal-ptr.t.cpp
  include/${CUSTOM_HEADER_DIR}/signal.t.cpp
  include/${CUSTOM_HEADER_DIR}/time-dependency.h
  include/${CUSTOM_HEADER_DIR}/time-dependency.t.cpp
80
  # Kept for a brittle backward compatiblity.
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
  include/${CUSTOM_HEADER_DIR}/signal-caster.h
  include/${CUSTOM_HEADER_DIR}/signal-cast-helper.h
  include/${CUSTOM_HEADER_DIR}/all-signals.h
  include/${CUSTOM_HEADER_DIR}/signal-helper.h
  include/${CUSTOM_HEADER_DIR}/entity-helper.h

  include/${CUSTOM_HEADER_DIR}/tracer.h
  include/${CUSTOM_HEADER_DIR}/tracer-real-time.h

  include/${CUSTOM_HEADER_DIR}/command.h
  include/${CUSTOM_HEADER_DIR}/eigen-io.h
  include/${CUSTOM_HEADER_DIR}/linear-algebra.h
  include/${CUSTOM_HEADER_DIR}/value.h

  include/${CUSTOM_HEADER_DIR}/command-setter.h
  include/${CUSTOM_HEADER_DIR}/command-setter.t.cpp
  include/${CUSTOM_HEADER_DIR}/command-getter.h
  include/${CUSTOM_HEADER_DIR}/command-getter.t.cpp
  include/${CUSTOM_HEADER_DIR}/command-direct-getter.h
  include/${CUSTOM_HEADER_DIR}/command-direct-setter.h
  include/${CUSTOM_HEADER_DIR}/command-bind.h
  include/${CUSTOM_HEADER_DIR}/all-commands.h

  include/${CUSTOM_HEADER_DIR}/logger.h
  )
Olivier Stasse's avatar
Olivier Stasse committed
106

107
SET(${PROJECT_NAME}_SOURCES
Olivier Stasse's avatar
Olivier Stasse committed
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
  src/debug/debug.cpp
  src/debug/real-time-logger.cpp
  src/debug/logger.cpp

  src/dgraph/entity.cpp
  src/dgraph/factory.cpp
  src/dgraph/pool.cpp

  src/exception/exception-abstract.cpp
  src/exception/exception-factory.cpp
  src/exception/exception-signal.cpp
  src/exception/exception-traces.cpp

  src/mt/process-list.cpp

  src/signal/signal-array.cpp

  src/command/value.cpp
  src/command/command.cpp
  )

129
130
ADD_LIBRARY(${PROJECT_NAME} SHARED
  ${${PROJECT_NAME}_SOURCES} ${${PROJECT_NAME}_HEADERS})
131
TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} SYSTEM PUBLIC ${EIGEN3_INCLUDE_DIR})
132
TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} PUBLIC $<INSTALL_INTERFACE:include>)
133
TARGET_LINK_LIBRARIES(${PROJECT_NAME} PUBLIC Boost::serialization Boost::system Boost::thread)
Olivier Stasse's avatar
Olivier Stasse committed
134

135
IF(UNIX)
Guilhem Saurel's avatar
Guilhem Saurel committed
136
  TARGET_LINK_LIBRARIES(${PROJECT_NAME} PUBLIC ${CMAKE_DL_LIBS} pthread)
137
ENDIF(UNIX)
Olivier Stasse's avatar
Olivier Stasse committed
138

139
140
141
IF(SUFFIX_SO_VERSION)
  SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${PROJECT_VERSION})
ENDIF(SUFFIX_SO_VERSION)
Olivier Stasse's avatar
Olivier Stasse committed
142

143
INSTALL(TARGETS ${PROJECT_NAME} EXPORT ${TARGETS_EXPORT_NAME} DESTINATION lib)
144

145

146
147
148
149
150
SET(DYNAMIC_GRAPH_PLUGINDIR "${CMAKE_INSTALL_PREFIX}/lib/${PROJECT_NAME}-plugins")
SET(PACKAGE_EXTRA_MACROS "set(DYNAMIC_GRAPH_PLUGINDIR ${DYNAMIC_GRAPH_PLUGINDIR})")
SET(PKG_CONFIG_EXTRA "plugindir=${DYNAMIC_GRAPH_PLUGINDIR}")
SET(CMAKE_INSTALL_RPATH "${DYNAMIC_GRAPH_PLUGINDIR}")

151
ADD_SUBDIRECTORY(src)
152
153
154
IF(BUILD_TESTING)
  ADD_SUBDIRECTORY(tests)
ENDIF(BUILD_TESTING)
155

156
PKG_CONFIG_APPEND_LIBS(${PROJECT_NAME})
Guilhem Saurel's avatar
Guilhem Saurel committed
157
INSTALL(FILES package.xml DESTINATION share/${PROJECT_NAME})