CMakeLists.txt 2.11 KB
Newer Older
1
2
3
4
#
# Copyright (c) 2014-2019 CNRS
# Copyright (c) 2018-2019 INRIA
#
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

MACRO(SYMLINK_AND_INSTALL_HEADERS HEADERS SUBPATH)
  FOREACH(header ${HEADERS})
    GET_FILENAME_COMPONENT(headerName ${header} NAME)
    GET_FILENAME_COMPONENT(headerPath ${header} PATH)
    EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E ${LINK}
      ${CMAKE_CURRENT_SOURCE_DIR}/${header}
      ${${PROJECT_NAME}_BINARY_DIR}/include/${PROJECT_NAME}/${SUBPATH}/${header})

    INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${header}
      DESTINATION ${CMAKE_INSTALL_PREFIX}/include/${PROJECT_NAME}/${SUBPATH}/${headerPath}
            PERMISSIONS OWNER_READ GROUP_READ WORLD_READ OWNER_WRITE)
  ENDFOREACH(header)
ENDMACRO(SYMLINK_AND_INSTALL_HEADERS HEADERS SUBPATH)

# --- LIBRARY --- #
SET(PYWRAP ${PROJECT_NAME}_pywrap) 
22
23
SET(PYWRAP ${PYWRAP} PARENT_SCOPE)

24
25
26
MAKE_DIRECTORY("${${PROJECT_NAME}_BINARY_DIR}/python/${PROJECT_NAME}")

ADD_LIBRARY(${PYWRAP} SHARED main.cpp)
Justin Carpentier's avatar
Justin Carpentier committed
27
TARGET_LINK_LIBRARIES(${PYWRAP} PUBLIC ${PROJECT_NAME}) 
Wolfgang Merkt's avatar
Wolfgang Merkt committed
28
29
# BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS spews conversion warnings from int to long unsigned int.
# Unfortunately, using literals does not work in a macro. As such, this turns them off for the entire wrapper:
30
31
32
IF(NOT WIN32)
  TARGET_COMPILE_OPTIONS(${PYWRAP} PRIVATE "-Wno-conversion")
ENDIF()
33
34
35
#IF(BUILD_WITH_COMMIT_VERSION)
#  TAG_LIBRARY_VERSION(${PYWRAP})
#ENDIF(BUILD_WITH_COMMIT_VERSION)
36
IF(DEFINED EIGENPY_SITELIB_ROOT AND EIGENPY_SITELIB_ROOT)
37
  SET(${PYWRAP}_INSTALL_DIR ${EIGENPY_SITELIB_ROOT}/${PYTHON_SITELIB}/${PROJECT_NAME})
38
ELSE()
39
  SET(${PYWRAP}_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/${PYTHON_SITELIB}/${PROJECT_NAME})
40
ENDIF()
41

42
43
44
45
46
47
48
SET_TARGET_PROPERTIES(${PYWRAP}
  PROPERTIES 
  PREFIX ""
  SUFFIX ${PYTHON_EXT_SUFFIX}
  OUTPUT_NAME "${PROJECT_NAME}"
  LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/python/${PROJECT_NAME}"
  )
49
50
51

INSTALL(TARGETS ${PYWRAP} DESTINATION ${${PYWRAP}_INSTALL_DIR})

52
53
54
55
56
57
58
59
60
61
62
# --- INSTALL SCRIPTS 
SET(PYTHON_FILES
  __init__.py
  )

FOREACH(python ${PYTHON_FILES})
  PYTHON_BUILD(${PROJECT_NAME} ${python})
  INSTALL(FILES
    "${CMAKE_CURRENT_SOURCE_DIR}/eigenpy/${python}"
    DESTINATION ${${PYWRAP}_INSTALL_DIR})
ENDFOREACH(python)
63