Verified Commit 3a414034 authored by Justin Carpentier's avatar Justin Carpentier
Browse files

cmake: add stub generation

parent f95a5db8
......@@ -56,6 +56,7 @@ include(cmake/python.cmake)
include(cmake/hpp.cmake)
include(cmake/apple.cmake)
include(cmake/ide.cmake)
include(CMakeDependentOption)
SET(CMAKE_MODULE_PATH
${CMAKE_SOURCE_DIR}/cmake-modules/
......@@ -64,11 +65,11 @@ SET(CMAKE_MODULE_PATH
# If needed, fix CMake policy for APPLE systems
APPLY_DEFAULT_APPLE_CONFIGURATION()
OPTION(BUILD_PYTHON_INTERFACE "Build the python bindings" ON)
COMPUTE_PROJECT_ARGS(PROJECT_ARGS LANGUAGES CXX)
PROJECT(${PROJECT_NAME} ${PROJECT_ARGS})
OPTION(BUILD_PYTHON_INTERFACE "Build the python bindings" ON)
CMAKE_DEPENDENT_OPTION(GENERATE_PYTHON_STUBS "Generate the Python stubs associated to the Python library" OFF BUILD_PYTHON_INTERFACE OFF)
ADD_PROJECT_DEPENDENCY(Eigen3 REQUIRED PKG_CONFIG_REQUIRES "eigen3 >= 3.0.0")
if(BUILD_PYTHON_INTERFACE)
......
......@@ -32,6 +32,8 @@
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
include(${PROJECT_SOURCE_DIR}/cmake/stubs.cmake)
ADD_CUSTOM_TARGET(python)
SET_TARGET_PROPERTIES(python PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD True)
......@@ -137,14 +139,21 @@ IF(UNIX AND NOT APPLE)
ENDIF()
IF(IS_ABSOLUTE ${PYTHON_SITELIB})
SET(${LIBRARY_NAME}_INSTALL_DIR ${PYTHON_SITELIB}/${LIBRARY_NAME})
SET(ABSOLUTE_PYTHON_SITELIB ${PYTHON_SITELIB})
ELSE()
SET(${LIBRARY_NAME}_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/${PYTHON_SITELIB}/${LIBRARY_NAME})
SET(ABSOLUTE_PYTHON_SITELIB ${CMAKE_INSTALL_PREFIX}/${PYTHON_SITELIB})
ENDIF()
SET(${LIBRARY_NAME}_INSTALL_DIR ${ABSOLUTE_PYTHON_SITELIB}/${LIBRARY_NAME})
INSTALL(TARGETS ${LIBRARY_NAME}
DESTINATION ${${LIBRARY_NAME}_INSTALL_DIR})
# --- GENERATE STUBS
IF(GENERATE_PYTHON_STUBS)
LOAD_STUBGEN()
GENERATE_STUBS(${CMAKE_CURRENT_BINARY_DIR} ${LIBRARY_NAME} ${ABSOLUTE_PYTHON_SITELIB})
ENDIF(GENERATE_PYTHON_STUBS)
# --- INSTALL SCRIPTS
SET(PYTHON_FILES
__init__.py
......
Markdown is supported
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