CMakeLists.txt 1.39 KB
Newer Older
1
#
Justin Carpentier's avatar
Justin Carpentier committed
2
# Copyright (c) 2014-2020 CNRS INRIA
3
#
4
5
6

# --- LIBRARY --- #
SET(PYWRAP ${PROJECT_NAME}_pywrap) 
7
8
SET(PYWRAP ${PYWRAP} PARENT_SCOPE)

9
10
MAKE_DIRECTORY("${${PROJECT_NAME}_BINARY_DIR}/python/${PROJECT_NAME}")

Justin Carpentier's avatar
Justin Carpentier committed
11
12
13
ADD_CUSTOM_TARGET(python)
SET_TARGET_PROPERTIES(python PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD True)

14
ADD_LIBRARY(${PYWRAP} SHARED main.cpp)
Justin Carpentier's avatar
Justin Carpentier committed
15
ADD_DEPENDENCIES(python ${PYWRAP})
Justin Carpentier's avatar
Justin Carpentier committed
16
TARGET_LINK_LIBRARIES(${PYWRAP} PUBLIC ${PROJECT_NAME}) 
Wolfgang Merkt's avatar
Wolfgang Merkt committed
17
18
# 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:
19
20
21
IF(NOT WIN32)
  TARGET_COMPILE_OPTIONS(${PYWRAP} PRIVATE "-Wno-conversion")
ENDIF()
Justin Carpentier's avatar
Justin Carpentier committed
22
IF(EIGENPY_SITELIB_ROOT)
23
  SET(${PYWRAP}_INSTALL_DIR ${EIGENPY_SITELIB_ROOT}/${PYTHON_SITELIB}/${PROJECT_NAME})
24
ELSE()
25
  SET(${PYWRAP}_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/${PYTHON_SITELIB}/${PROJECT_NAME})
26
ENDIF()
27

28
29
30
31
32
33
34
SET_TARGET_PROPERTIES(${PYWRAP}
  PROPERTIES 
  PREFIX ""
  SUFFIX ${PYTHON_EXT_SUFFIX}
  OUTPUT_NAME "${PROJECT_NAME}"
  LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/python/${PROJECT_NAME}"
  )
35
36
37

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

38
39
40
41
42
43
44
45
46
47
# --- INSTALL SCRIPTS 
SET(PYTHON_FILES
  __init__.py
  )

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