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) ...@@ -163,18 +163,14 @@ ADD_HEADER_GROUP(${PROJECT_NAME}_HEADERS)
ADD_SOURCE_GROUP(${PROJECT_NAME}_SOURCES) ADD_SOURCE_GROUP(${PROJECT_NAME}_SOURCES)
# ---------------------------------------------------- # ----------------------------------------------------
# --- UNIT TEST -------------------------------------- # --- PYTHON LIBRARY ---------------------------------
# ----------------------------------------------------
ADD_SUBDIRECTORY(unittest)
# ----------------------------------------------------
# --- EXECUTABLES ------------------------------------
# ---------------------------------------------------- # ----------------------------------------------------
ADD_SUBDIRECTORY(python)
# ---------------------------------------------------- # ----------------------------------------------------
# --- PYTHON BINDINGS -------------------------------- # --- UNIT TEST --------------------------------------
# ---------------------------------------------------- # ----------------------------------------------------
ADD_SUBDIRECTORY(python) ADD_SUBDIRECTORY(unittest)
IF(EIGEN_NUMPY_ALIGNED) IF(EIGEN_NUMPY_ALIGNED)
PKG_CONFIG_APPEND_CFLAGS("-DEIGENPY_ALIGNED") PKG_CONFIG_APPEND_CFLAGS("-DEIGENPY_ALIGNED")
......
...@@ -38,7 +38,7 @@ TARGET_LINK_BOOST_PYTHON(${PYWRAP}) ...@@ -38,7 +38,7 @@ TARGET_LINK_BOOST_PYTHON(${PYWRAP})
#IF(BUILD_WITH_COMMIT_VERSION) #IF(BUILD_WITH_COMMIT_VERSION)
# TAG_LIBRARY_VERSION(${PYWRAP}) # TAG_LIBRARY_VERSION(${PYWRAP})
#ENDIF(BUILD_WITH_COMMIT_VERSION) #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) SET_PROPERTY(TARGET ${PYWRAP} PROPERTY LINKER_LANGUAGE CXX)
IF(APPLE) IF(APPLE)
...@@ -54,35 +54,35 @@ SET_TARGET_PROPERTIES(${PYWRAP} PROPERTIES OUTPUT_NAME "${PROJECT_NAME}") ...@@ -54,35 +54,35 @@ SET_TARGET_PROPERTIES(${PYWRAP} PROPERTIES OUTPUT_NAME "${PROJECT_NAME}")
INSTALL(TARGETS ${PYWRAP} DESTINATION ${${PYWRAP}_INSTALL_DIR}) INSTALL(TARGETS ${PYWRAP} DESTINATION ${${PYWRAP}_INSTALL_DIR})
# --- INSTALL SCRIPTS ## --- INSTALL SCRIPTS
SET(PYTHON_FILES #SET(PYTHON_FILES
__init__.py # __init__.py
) # )
#
FOREACH(python ${PYTHON_FILES}) #FOREACH(python ${PYTHON_FILES})
GET_FILENAME_COMPONENT(pythonFile ${python} NAME) # GET_FILENAME_COMPONENT(pythonFile ${python} NAME)
EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E ${LINK} # EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E ${LINK}
${${PROJECT_NAME}_SOURCE_DIR}/python/scripts/${python} # ${${PROJECT_NAME}_SOURCE_DIR}/python/scripts/${python}
${${PROJECT_NAME}_BINARY_DIR}/python/${PROJECT_NAME}/${pythonFile}) # ${${PROJECT_NAME}_BINARY_DIR}/python/${PROJECT_NAME}/${pythonFile})
#
# Generate pyc file # # Generate pyc file
EXECUTE_PROCESS(COMMAND # EXECUTE_PROCESS(COMMAND
${PYTHON_EXECUTABLE} -m py_compile # ${PYTHON_EXECUTABLE} -m py_compile
${${PROJECT_NAME}_BINARY_DIR}/python/${PROJECT_NAME}/${pythonFile}) # ${${PROJECT_NAME}_BINARY_DIR}/python/${PROJECT_NAME}/${pythonFile})
# Tag pyc file as generated. # # Tag pyc file as generated.
SET_SOURCE_FILES_PROPERTIES( # SET_SOURCE_FILES_PROPERTIES(
"${${PROJECT_NAME}_BINARY_DIR}/python/${PROJECT_NAME}/${pythonFile}c" # "${${PROJECT_NAME}_BINARY_DIR}/python/${PROJECT_NAME}/${pythonFile}c"
PROPERTIES GENERATED TRUE) # PROPERTIES GENERATED TRUE)
#
# Clean generated files. # # Clean generated files.
SET_PROPERTY( # SET_PROPERTY(
DIRECTORY APPEND PROPERTY # DIRECTORY APPEND PROPERTY
ADDITIONAL_MAKE_CLEAN_FILES # ADDITIONAL_MAKE_CLEAN_FILES
"${${PROJECT_NAME}_BINARY_DIR}/python/${PROJECT_NAME}/${pythonFile}c") # "${${PROJECT_NAME}_BINARY_DIR}/python/${PROJECT_NAME}/${pythonFile}c")
#
INSTALL(FILES # INSTALL(FILES
"${${PROJECT_NAME}_SOURCE_DIR}/python/scripts/${python}" # "${${PROJECT_NAME}_SOURCE_DIR}/python/scripts/${python}"
"${${PROJECT_NAME}_BINARY_DIR}/python/${PROJECT_NAME}/${pythonFile}c" # "${${PROJECT_NAME}_BINARY_DIR}/python/${PROJECT_NAME}/${pythonFile}c"
DESTINATION ${${PYWRAP}_INSTALL_DIR}) # DESTINATION ${${PYWRAP}_INSTALL_DIR})
ENDFOREACH(python) #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