CMakeLists.txt 2.62 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
11
12
13
14
15
IF(BUILD_WITH_URDF_SUPPORT)
  SET(${PROJECT_NAME}_SOURCES
    parsers/urdf/model.cpp
    parsers/urdf/geometry.cpp
  )
ENDIF()
16

17
18
19
# Extract the compile definitions of the project for export
GET_DIRECTORY_PROPERTY(CURRENT_COMPILE_DEFINITIONS COMPILE_DEFINITIONS)

Francois Keith's avatar
Francois Keith committed
20
IF(UNIX OR "${CMAKE_GENERATOR_TOOLSET}" MATCHES "ClangCl")
jcarpent's avatar
jcarpent committed
21
    # Create target libpinocchio.so
22
23
    ADD_LIBRARY(${PROJECT_NAME} SHARED ${HEADERS} ${${PROJECT_NAME}_SOURCES})
    SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE CXX)
24
    TARGET_COMPILE_DEFINITIONS(${PROJECT_NAME} PUBLIC ${CURRENT_COMPILE_DEFINITIONS})
25
26

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

31
    TARGET_LINK_LIBRARIES(${PROJECT_NAME} PUBLIC Eigen3::Eigen)
32
    TARGET_LINK_LIBRARIES(${PROJECT_NAME} PUBLIC ${Boost_FILESYSTEM_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${Boost_SERIALIZATION_LIBRARY})
Guilhem Saurel's avatar
Guilhem Saurel committed
33
    TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} PUBLIC $<INSTALL_INTERFACE:include>)
34

35
    # Special care of urdfdom version
36
37
    IF(urdfdom_FOUND)
      IF(${urdfdom_VERSION} VERSION_LESS "0.3.0")
38
        TARGET_COMPILE_DEFINITIONS(${PROJECT_NAME} PRIVATE -DPINOCCHIO_URDFDOM_COLLISION_WITH_GROUP_NAME)
39
      ENDIF(${urdfdom_VERSION} VERSION_LESS "0.3.0")
40
41

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

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

51
      TARGET_LINK_LIBRARIES(${PROJECT_NAME} PUBLIC ${urdfdom_LIBRARIES})
Justin Carpentier's avatar
Justin Carpentier committed
52
      TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} SYSTEM PUBLIC ${urdfdom_INCLUDE_DIRS})
53
    ENDIF(urdfdom_FOUND)
jcarpent's avatar
jcarpent committed
54

Justin Carpentier's avatar
Justin Carpentier committed
55
    IF(hpp-fcl_FOUND)
56
      TARGET_LINK_LIBRARIES(${PROJECT_NAME} PUBLIC hpp-fcl::hpp-fcl)
Justin Carpentier's avatar
Justin Carpentier committed
57
    ENDIF(hpp-fcl_FOUND)
jcarpent's avatar
jcarpent committed
58
59
60

    ADD_HEADER_GROUP(HEADERS)
    ADD_SOURCE_GROUP(${PROJECT_NAME}_SOURCES)
Francois Keith's avatar
Francois Keith committed
61
    
Francois Keith's avatar
Francois Keith committed
62
63
64
    INSTALL(TARGETS ${PROJECT_NAME}
        EXPORT ${TARGETS_EXPORT_NAME}
        DESTINATION lib)
Francois Keith's avatar
Francois Keith committed
65
ENDIF(UNIX OR "${CMAKE_GENERATOR_TOOLSET}" MATCHES "ClangCl")
jcarpent's avatar
jcarpent committed
66