2016-11-25 15:27:12 +08:00
|
|
|
# Install cython components
|
|
|
|
include(GtsamCythonWrap)
|
2017-04-07 15:29:27 +08:00
|
|
|
|
2017-05-24 23:51:45 +08:00
|
|
|
# Create the cython toolbox for the gtsam library
|
|
|
|
if (GTSAM_INSTALL_CYTHON_TOOLBOX)
|
2017-07-28 10:26:53 +08:00
|
|
|
# build and include the eigency version of eigency
|
2017-07-29 03:26:19 +08:00
|
|
|
add_subdirectory(gtsam_eigency)
|
|
|
|
include_directories(${PROJECT_BINARY_DIR}/cython/gtsam_eigency)
|
2017-07-23 10:40:43 +08:00
|
|
|
|
|
|
|
# wrap gtsam
|
2017-07-26 04:33:09 +08:00
|
|
|
add_custom_target(gtsam_header DEPENDS "../gtsam.h")
|
2017-05-24 23:51:45 +08:00
|
|
|
wrap_and_install_library_cython("../gtsam.h" # interface_header
|
|
|
|
"" # extra imports
|
|
|
|
"${GTSAM_CYTHON_INSTALL_PATH}/gtsam" # install path
|
2017-05-31 08:45:54 +08:00
|
|
|
gtsam # library to link with
|
2017-07-28 10:26:53 +08:00
|
|
|
"wrap;cythonize_eigency;gtsam;gtsam_header" # dependencies which need to be built before wrapping
|
2017-05-24 23:51:45 +08:00
|
|
|
)
|
2017-04-07 15:29:27 +08:00
|
|
|
|
2017-05-24 23:51:45 +08:00
|
|
|
# wrap gtsam_unstable
|
|
|
|
if(GTSAM_BUILD_UNSTABLE)
|
2017-07-26 04:33:09 +08:00
|
|
|
add_custom_target(gtsam_unstable_header DEPENDS "../gtsam_unstable/gtsam_unstable.h")
|
2017-05-24 23:51:45 +08:00
|
|
|
wrap_and_install_library_cython("../gtsam_unstable/gtsam_unstable.h" # interface_header
|
|
|
|
"from gtsam.gtsam cimport *" # extra imports
|
2019-02-08 23:34:09 +08:00
|
|
|
"${GTSAM_CYTHON_INSTALL_PATH}/gtsam_unstable" # install path
|
2017-05-31 08:45:54 +08:00
|
|
|
gtsam_unstable # library to link with
|
2017-10-09 10:11:54 +08:00
|
|
|
"gtsam_unstable;gtsam_unstable_header;cythonize_gtsam" # dependencies to be built before wrapping
|
2017-05-24 23:51:45 +08:00
|
|
|
)
|
|
|
|
endif()
|
2017-04-07 15:29:27 +08:00
|
|
|
|
2019-02-13 22:38:46 +08:00
|
|
|
file(READ "${PROJECT_SOURCE_DIR}/cython/requirements.txt" CYTHON_INSTALL_REQUIREMENTS)
|
|
|
|
file(READ "${PROJECT_SOURCE_DIR}/README.md" README_CONTENTS)
|
|
|
|
|
2017-08-15 23:16:13 +08:00
|
|
|
# Install the custom-generated __init__.py
|
2017-05-24 23:51:45 +08:00
|
|
|
# This is to make the build/cython/gtsam folder a python package, so gtsam can be found while wrapping gtsam_unstable
|
2019-02-09 00:03:51 +08:00
|
|
|
configure_file(${PROJECT_SOURCE_DIR}/cython/gtsam/__init__.py ${PROJECT_BINARY_DIR}/cython/gtsam/__init__.py COPYONLY)
|
|
|
|
configure_file(${PROJECT_SOURCE_DIR}/cython/gtsam_unstable/__init__.py ${PROJECT_BINARY_DIR}/cython/gtsam_unstable/__init__.py COPYONLY)
|
2019-02-08 19:57:05 +08:00
|
|
|
configure_file(${PROJECT_SOURCE_DIR}/cython/setup.py.in ${PROJECT_BINARY_DIR}/cython/setup.py)
|
2019-02-08 23:57:52 +08:00
|
|
|
install_cython_files("${PROJECT_BINARY_DIR}/cython/setup.py" "${GTSAM_CYTHON_INSTALL_PATH}")
|
2017-05-24 23:51:45 +08:00
|
|
|
# install scripts and tests
|
|
|
|
install_cython_scripts("${PROJECT_SOURCE_DIR}/cython/gtsam" "${GTSAM_CYTHON_INSTALL_PATH}" "*.py")
|
2019-02-08 23:38:25 +08:00
|
|
|
install_cython_scripts("${PROJECT_SOURCE_DIR}/cython/gtsam_unstable" "${GTSAM_CYTHON_INSTALL_PATH}" "*.py")
|
2017-05-24 23:51:45 +08:00
|
|
|
|
|
|
|
endif ()
|