CMakeLists.txt 2.36 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

jcarpent's avatar
jcarpent committed
6
7
8
9
# ----------------------------------------------------
# --- C++ --------------------------------------------
# ----------------------------------------------------

10
SET(${PROJECT_NAME}_SOURCES
11
12
  parsers/urdf/model.cpp
  parsers/urdf/geometry.cpp
13
14
)

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

jcarpent's avatar
jcarpent committed
18
19
IF(UNIX)
    # Create target libpinocchio.so
20
21
    ADD_LIBRARY(${PROJECT_NAME} SHARED ${HEADERS} ${${PROJECT_NAME}_SOURCES})
    SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE CXX)
22
    TARGET_COMPILE_DEFINITIONS(${PROJECT_NAME} PUBLIC ${CURRENT_COMPILE_DEFINITIONS})
23
24

    SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${PROJECT_VERSION})
25
26
27
    IF(BUILD_WITH_COMMIT_VERSION)
      TAG_LIBRARY_VERSION(${PROJECT_NAME})
    ENDIF(BUILD_WITH_COMMIT_VERSION)
28

jcarpent's avatar
jcarpent committed
29
    PKG_CONFIG_USE_DEPENDENCY(${PROJECT_NAME} eigen3)
30
    TARGET_LINK_LIBRARIES(${PROJECT_NAME} PUBLIC ${Boost_FILESYSTEM_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${Boost_SERIALIZATION_LIBRARY})
Guilhem Saurel's avatar
Guilhem Saurel committed
31
    TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} PUBLIC $<INSTALL_INTERFACE:include>)
32

33
    # Special care of urdfdom version
jcarpent's avatar
jcarpent committed
34
    IF(URDFDOM_FOUND)
35
36
37
38
39
40
41
42
43
44
45
46
47
48
      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")

jcarpent's avatar
jcarpent committed
49
50
51
52
53
54
55
56
57
58
      PKG_CONFIG_USE_DEPENDENCY(${PROJECT_NAME} urdfdom)
    ENDIF(URDFDOM_FOUND)

    IF(HPP_FCL_FOUND)
      PKG_CONFIG_USE_DEPENDENCY(${PROJECT_NAME} hpp-fcl)
    ENDIF(HPP_FCL_FOUND)

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

Guilhem Saurel's avatar
Guilhem Saurel committed
59
    INSTALL(TARGETS ${PROJECT_NAME}
60
61
            EXPORT ${TARGETS_EXPORT_NAME}
            DESTINATION lib)
jcarpent's avatar
jcarpent committed
62
ENDIF(UNIX)
jcarpent's avatar
jcarpent committed
63