CMakeLists.txt 2.66 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
27
28
29
30
31
MAKE_DIRECTORY("${${PROJECT_NAME}_BINARY_DIR}/python/${PROJECT_NAME}")

ADD_LIBRARY(${PYWRAP} SHARED main.cpp)
TARGET_LINK_LIBRARIES(${PYWRAP} ${PROJECT_NAME}) 
TARGET_LINK_BOOST_PYTHON(${PYWRAP})
#IF(BUILD_WITH_COMMIT_VERSION)
#  TAG_LIBRARY_VERSION(${PYWRAP})
#ENDIF(BUILD_WITH_COMMIT_VERSION)
32
SET(${PYWRAP}_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/${PYTHON_SITELIB})
33
34

SET_PROPERTY(TARGET ${PYWRAP} PROPERTY LINKER_LANGUAGE CXX)
seanyen's avatar
seanyen committed
35
SET_TARGET_PROPERTIES(${PYWRAP} PROPERTIES SUFFIX ${PYTHON_EXT_SUFFIX})
36
37
38
39
40
41
42
43
44

SET_TARGET_PROPERTIES(${PYWRAP} PROPERTIES
  LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/python/${PROJECT_NAME}")

SET_TARGET_PROPERTIES(${PYWRAP} PROPERTIES PREFIX "")
SET_TARGET_PROPERTIES(${PYWRAP} PROPERTIES OUTPUT_NAME "${PROJECT_NAME}")

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

45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
## --- INSTALL SCRIPTS 
#SET(PYTHON_FILES
#  __init__.py
#  )
#
#FOREACH(python ${PYTHON_FILES})
#  GET_FILENAME_COMPONENT(pythonFile ${python} NAME)
#  EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E ${LINK}
#    ${${PROJECT_NAME}_SOURCE_DIR}/python/scripts/${python}
#    ${${PROJECT_NAME}_BINARY_DIR}/python/${PROJECT_NAME}/${pythonFile})
#    
#  # Generate pyc file
#  EXECUTE_PROCESS(COMMAND
#    ${PYTHON_EXECUTABLE} -m py_compile
#    ${${PROJECT_NAME}_BINARY_DIR}/python/${PROJECT_NAME}/${pythonFile})
#  # Tag pyc file as generated.
#  SET_SOURCE_FILES_PROPERTIES(
#    "${${PROJECT_NAME}_BINARY_DIR}/python/${PROJECT_NAME}/${pythonFile}c"
#    PROPERTIES GENERATED TRUE)
#    
#  # Clean generated files.
#  SET_PROPERTY(
#    DIRECTORY APPEND PROPERTY
#    ADDITIONAL_MAKE_CLEAN_FILES
#    "${${PROJECT_NAME}_BINARY_DIR}/python/${PROJECT_NAME}/${pythonFile}c")
#    
#  INSTALL(FILES
#    "${${PROJECT_NAME}_SOURCE_DIR}/python/scripts/${python}"
#    "${${PROJECT_NAME}_BINARY_DIR}/python/${PROJECT_NAME}/${pythonFile}c"
#    DESTINATION ${${PYWRAP}_INSTALL_DIR})
#ENDFOREACH(python)
76