Commit 5ade5701 authored by jcarpent's avatar jcarpent
Browse files

[CMake] Simplify Python lib installation

parent 61253b97
......@@ -163,18 +163,14 @@ ADD_HEADER_GROUP(${PROJECT_NAME}_HEADERS)
ADD_SOURCE_GROUP(${PROJECT_NAME}_SOURCES)
# ----------------------------------------------------
# --- UNIT TEST --------------------------------------
# ----------------------------------------------------
ADD_SUBDIRECTORY(unittest)
# ----------------------------------------------------
# --- EXECUTABLES ------------------------------------
# --- PYTHON LIBRARY ---------------------------------
# ----------------------------------------------------
ADD_SUBDIRECTORY(python)
# ----------------------------------------------------
# --- PYTHON BINDINGS --------------------------------
# --- UNIT TEST --------------------------------------
# ----------------------------------------------------
ADD_SUBDIRECTORY(python)
ADD_SUBDIRECTORY(unittest)
IF(EIGEN_NUMPY_ALIGNED)
PKG_CONFIG_APPEND_CFLAGS("-DEIGENPY_ALIGNED")
......
......@@ -38,7 +38,7 @@ TARGET_LINK_BOOST_PYTHON(${PYWRAP})
#IF(BUILD_WITH_COMMIT_VERSION)
# TAG_LIBRARY_VERSION(${PYWRAP})
#ENDIF(BUILD_WITH_COMMIT_VERSION)
SET(${PYWRAP}_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/${PYTHON_SITELIB}/${PROJECT_NAME})
SET(${PYWRAP}_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/${PYTHON_SITELIB})
SET_PROPERTY(TARGET ${PYWRAP} PROPERTY LINKER_LANGUAGE CXX)
IF(APPLE)
......@@ -54,35 +54,35 @@ SET_TARGET_PROPERTIES(${PYWRAP} PROPERTIES OUTPUT_NAME "${PROJECT_NAME}")
INSTALL(TARGETS ${PYWRAP} DESTINATION ${${PYWRAP}_INSTALL_DIR})
# --- 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)
## --- 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)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment