CMakeLists.txt 4.89 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
23
24
25
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}")
Olivier Stasse's avatar
Olivier Stasse committed
26

27
# JRL-cmakemodule setup
28
INCLUDE(cmake/base.cmake)
29
INCLUDE(cmake/boost.cmake)
30

31
# Project definition
32
33
COMPUTE_PROJECT_ARGS(PROJECT_ARGS LANGUAGES CXX)
PROJECT(${PROJECT_NAME} ${PROJECT_ARGS})
34

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

37
# Project dependencies
38
ADD_PROJECT_DEPENDENCY(Eigen3 REQUIRED PKG_CONFIG_REQUIRES eigen3)
39
40
SET(BOOST_COMPONENTS serialization system unit_test_framework thread)
SEARCH_FOR_BOOST()
41
SEARCH_FOR_PTHREAD()
42

43
44
45
46
47
48
49
# 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
50
# Verbosity level
51
IF(NOT (\"${CMAKE_VERBOSITY_LEVEL}\" STREQUAL \"\"))
Olivier Stasse's avatar
Olivier Stasse committed
52
  ADD_DEFINITIONS(-DVP_DEBUG_MODE=${CMAKE_VERBOSITY_LEVEL} -DVP_DEBUG)
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
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
  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
107

108
SET(${PROJECT_NAME}_SOURCES
Olivier Stasse's avatar
Olivier Stasse committed
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
  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/signal/signal-caster.cpp
  src/signal/signal-cast-helper.cpp

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

132
133
134
135
ADD_LIBRARY(${PROJECT_NAME} SHARED
  ${${PROJECT_NAME}_SOURCES} ${${PROJECT_NAME}_HEADERS})
TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} SYSTEM PUBLIC ${EIGEN3_INCLUDE_DIR})
TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} PUBLIC $<INSTALL_INTERFACE:include>)
136
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${Boost_LIBRARIES})
Olivier Stasse's avatar
Olivier Stasse committed
137

138
139
140
IF(UNIX)
  TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${CMAKE_DL_LIBS} pthread)
ENDIF(UNIX)
Olivier Stasse's avatar
Olivier Stasse committed
141

142
143
144
IF(SUFFIX_SO_VERSION)
  SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${PROJECT_VERSION})
ENDIF(SUFFIX_SO_VERSION)
Olivier Stasse's avatar
Olivier Stasse committed
145

146
INSTALL(TARGETS ${PROJECT_NAME} EXPORT ${TARGETS_EXPORT_NAME} DESTINATION lib)
147

148
ADD_SUBDIRECTORY(src)
Thomas Moulard's avatar
Thomas Moulard committed
149
ADD_SUBDIRECTORY(tests)
150

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