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
# 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

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

32
# Project dependencies
33
ADD_PROJECT_DEPENDENCY(Eigen3 REQUIRED PKG_CONFIG_REQUIRES eigen3)
34 35
SET(BOOST_COMPONENTS serialization system unit_test_framework thread)
SEARCH_FOR_BOOST()
36
SEARCH_FOR_PTHREAD()
37

38 39 40 41 42 43 44
# 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
45
# Verbosity level
46
IF(NOT (\"${CMAKE_VERBOSITY_LEVEL}\" STREQUAL \"\"))
Olivier Stasse's avatar
Olivier Stasse committed
47
  ADD_DEFINITIONS(-DVP_DEBUG_MODE=${CMAKE_VERBOSITY_LEVEL} -DVP_DEBUG)
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
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
102

103
SET(${PROJECT_NAME}_SOURCES
Olivier Stasse's avatar
Olivier Stasse committed
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
  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
  )

127 128 129 130
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>)
131
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${Boost_LIBRARIES})
Olivier Stasse's avatar
Olivier Stasse committed
132

133 134 135
IF(UNIX)
  TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${CMAKE_DL_LIBS} pthread)
ENDIF(UNIX)
Olivier Stasse's avatar
Olivier Stasse committed
136

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

141
INSTALL(TARGETS ${PROJECT_NAME} EXPORT ${TARGETS_EXPORT_NAME} DESTINATION lib)
142

143

144 145 146 147 148
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}")

149
ADD_SUBDIRECTORY(src)
150
ADD_SUBDIRECTORY(tests)
151

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