CMakeLists.txt 2.65 KB
Newer Older
Guilhem Saurel's avatar
Guilhem Saurel committed
1
#
Justin Carpentier's avatar
Justin Carpentier committed
2
# Copyright (c) 2015-2020 CNRS INRIA
3
# Copyright (c) 2015 Wandercraft, 86 rue de Paris 91400 Orsay, France.
Guilhem Saurel's avatar
Guilhem Saurel committed
4
#
5

6
7
8
9
IF(BUILD_WITH_URDF_SUPPORT)
  SET(${PROJECT_NAME}_SOURCES
    parsers/urdf/model.cpp
    parsers/urdf/geometry.cpp
10
    parsers/urdf/utils.cpp
11
12
  )
ENDIF()
13

14
15
16
# Extract the compile definitions of the project for export
GET_DIRECTORY_PROPERTY(CURRENT_COMPILE_DEFINITIONS COMPILE_DEFINITIONS)

17
18
19
20
21
# Create target libpinocchio.so
ADD_LIBRARY(${PROJECT_NAME} SHARED ${HEADERS} ${${PROJECT_NAME}_SOURCES})
SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE CXX)
TARGET_COMPILE_DEFINITIONS(${PROJECT_NAME} PUBLIC ${CURRENT_COMPILE_DEFINITIONS})

22
23
24
25
IF(MSVC)
  TARGET_COMPILE_OPTIONS(${PROJECT_NAME} PUBLIC "/bigobj")
ENDIF()

26
27
28
29
SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${PROJECT_VERSION})
IF(BUILD_WITH_COMMIT_VERSION)
  TAG_LIBRARY_VERSION(${PROJECT_NAME})
ENDIF(BUILD_WITH_COMMIT_VERSION)
Justin Carpentier's avatar
Justin Carpentier committed
30
31
32
IF(WIN32)
  TARGET_COMPILE_DEFINITIONS(${PROJECT_NAME} PRIVATE -DNOMINMAX)
ENDIF(WIN32)
33

34
TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} SYSTEM PUBLIC ${EIGEN3_INCLUDE_DIR})
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
TARGET_LINK_LIBRARIES(${PROJECT_NAME} PUBLIC ${Boost_FILESYSTEM_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${Boost_SERIALIZATION_LIBRARY})
TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} PUBLIC $<INSTALL_INTERFACE:include>)

# Special care of urdfdom version
IF(urdfdom_FOUND)
  IF(${urdfdom_VERSION} VERSION_LESS "0.3.0")
    TARGET_COMPILE_DEFINITIONS(${PROJECT_NAME} PRIVATE -DPINOCCHIO_URDFDOM_COLLISION_WITH_GROUP_NAME)
  ENDIF(${urdfdom_VERSION} VERSION_LESS "0.3.0")

  # defines types from version 0.4.0
  IF(NOT ${urdfdom_VERSION} VERSION_LESS "0.4.0")
    TARGET_COMPILE_DEFINITIONS(${PROJECT_NAME} PRIVATE -DPINOCCHIO_URDFDOM_TYPEDEF_SHARED_PTR)
  ENDIF(NOT ${urdfdom_VERSION} VERSION_LESS "0.4.0")

  # std::shared_ptr appears from version 1.0.0
  IF(${urdfdom_VERSION} VERSION_GREATER "0.4.2")
    TARGET_COMPILE_DEFINITIONS(${PROJECT_NAME} PRIVATE -DPINOCCHIO_URDFDOM_USE_STD_SHARED_PTR)
  ENDIF(${urdfdom_VERSION} VERSION_GREATER "0.4.2")

  TARGET_LINK_LIBRARIES(${PROJECT_NAME} PUBLIC ${urdfdom_LIBRARIES})
  TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} SYSTEM PUBLIC ${urdfdom_INCLUDE_DIRS})
ENDIF(urdfdom_FOUND)

IF(hpp-fcl_FOUND)
  TARGET_LINK_LIBRARIES(${PROJECT_NAME} PUBLIC hpp-fcl::hpp-fcl)
ENDIF(hpp-fcl_FOUND)

ADD_HEADER_GROUP(HEADERS)
ADD_SOURCE_GROUP(${PROJECT_NAME}_SOURCES)

INSTALL(TARGETS ${PROJECT_NAME}
66
67
68
69
70
71
  EXPORT ${TARGETS_EXPORT_NAME}
  PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR}
  INCLUDES DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR}
  LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}
  ARCHIVE DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}
  RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR})
jcarpent's avatar
jcarpent committed
72