Merged in jlblancoc/gtsam (pull request #383)

close issue #426
fix missing Eigen in Cython wrapper
release/4.3a0
José Luis Blanco-Claraco 2019-02-17 02:44:30 +00:00 committed by Frank Dellaert
commit 034f69c7aa
4 changed files with 20 additions and 13 deletions

View File

@ -252,7 +252,7 @@ if(GTSAM_USE_SYSTEM_EIGEN)
find_package(Eigen3 REQUIRED) find_package(Eigen3 REQUIRED)
# Use generic Eigen include paths e.g. <Eigen/Core> # Use generic Eigen include paths e.g. <Eigen/Core>
set(GTSAM_EIGEN_INCLUDE_PREFIX "${EIGEN3_INCLUDE_DIR}") set(GTSAM_EIGEN_INCLUDE_FOR_INSTALL "${EIGEN3_INCLUDE_DIR}")
# check if MKL is also enabled - can have one or the other, but not both! # check if MKL is also enabled - can have one or the other, but not both!
# Note: Eigen >= v3.2.5 includes our patches # Note: Eigen >= v3.2.5 includes our patches
@ -266,6 +266,8 @@ if(GTSAM_USE_SYSTEM_EIGEN)
message(FATAL_ERROR "MKL does not work with Eigen 3.3.4 because of a bug in Eigen. See http://eigen.tuxfamily.org/bz/show_bug.cgi?id=1527. Disable GTSAM_USE_SYSTEM_EIGEN to use GTSAM's copy of Eigen, disable GTSAM_WITH_EIGEN_MKL, or upgrade/patch your installation of Eigen.") message(FATAL_ERROR "MKL does not work with Eigen 3.3.4 because of a bug in Eigen. See http://eigen.tuxfamily.org/bz/show_bug.cgi?id=1527. Disable GTSAM_USE_SYSTEM_EIGEN to use GTSAM's copy of Eigen, disable GTSAM_WITH_EIGEN_MKL, or upgrade/patch your installation of Eigen.")
endif() endif()
# The actual include directory (for BUILD cmake target interface):
set(GTSAM_EIGEN_INCLUDE_FOR_BUILD "${EIGEN3_INCLUDE_DIR}")
else() else()
# Use bundled Eigen include path. # Use bundled Eigen include path.
# Clear any variables set by FindEigen3 # Clear any variables set by FindEigen3
@ -275,8 +277,10 @@ else()
# set full path to be used by external projects # set full path to be used by external projects
# this will be added to GTSAM_INCLUDE_DIR by gtsam_extra.cmake.in # this will be added to GTSAM_INCLUDE_DIR by gtsam_extra.cmake.in
set(GTSAM_EIGEN_INCLUDE_PREFIX "include/gtsam/3rdparty/Eigen/") set(GTSAM_EIGEN_INCLUDE_FOR_INSTALL "include/gtsam/3rdparty/Eigen/")
# The actual include directory (for BUILD cmake target interface):
set(GTSAM_EIGEN_INCLUDE_FOR_BUILD "${CMAKE_SOURCE_DIR}/gtsam/3rdparty/Eigen/")
endif() endif()
if (MSVC) if (MSVC)

View File

@ -22,6 +22,17 @@ cythonize(cythonize_eigency_conversions "../gtsam_eigency/conversions.pyx" "conv
"${OUTPUT_DIR}" "${EIGENCY_INCLUDE_DIR}" "" "" "") "${OUTPUT_DIR}" "${EIGENCY_INCLUDE_DIR}" "" "" "")
cythonize(cythonize_eigency_core "../gtsam_eigency/core.pyx" "core" cythonize(cythonize_eigency_core "../gtsam_eigency/core.pyx" "core"
${OUTPUT_DIR} "${EIGENCY_INCLUDE_DIR}" "" "" "") ${OUTPUT_DIR} "${EIGENCY_INCLUDE_DIR}" "" "" "")
# Include Eigen headers:
target_include_directories(cythonize_eigency_conversions PUBLIC
$<BUILD_INTERFACE:${GTSAM_EIGEN_INCLUDE_FOR_BUILD}>
$<INSTALL_INTERFACE:${GTSAM_EIGEN_INCLUDE_FOR_INSTALL}>
)
target_include_directories(cythonize_eigency_core PUBLIC
$<BUILD_INTERFACE:${GTSAM_EIGEN_INCLUDE_FOR_BUILD}>
$<INSTALL_INTERFACE:${GTSAM_EIGEN_INCLUDE_FOR_INSTALL}>
)
add_dependencies(cythonize_eigency_core cythonize_eigency_conversions) add_dependencies(cythonize_eigency_core cythonize_eigency_conversions)
add_custom_target(cythonize_eigency) add_custom_target(cythonize_eigency)
add_dependencies(cythonize_eigency cythonize_eigency_conversions cythonize_eigency_core) add_dependencies(cythonize_eigency cythonize_eigency_conversions cythonize_eigency_core)

View File

@ -1,7 +1,7 @@
import os import os
import numpy as np import numpy as np
__eigen_dir__ = "${GTSAM_EIGEN_INCLUDE_PREFIX}" __eigen_dir__ = "${GTSAM_EIGEN_INCLUDE_FOR_INSTALL}"
def get_includes(include_eigen=True): def get_includes(include_eigen=True):
root = os.path.dirname(__file__) root = os.path.dirname(__file__)

View File

@ -117,17 +117,9 @@ set_target_properties(gtsam PROPERTIES
# Append Eigen include path, set in top-level CMakeLists.txt to either # Append Eigen include path, set in top-level CMakeLists.txt to either
# system-eigen, or GTSAM eigen path # system-eigen, or GTSAM eigen path
if (GTSAM_USE_SYSTEM_EIGEN)
target_include_directories(gtsam PUBLIC
$<BUILD_INTERFACE:${EIGEN3_INCLUDE_DIR}>
)
else()
target_include_directories(gtsam PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/Eigen/>
)
endif()
target_include_directories(gtsam PUBLIC target_include_directories(gtsam PUBLIC
$<INSTALL_INTERFACE:${GTSAM_EIGEN_INCLUDE_PREFIX}> $<BUILD_INTERFACE:${GTSAM_EIGEN_INCLUDE_FOR_BUILD}>
$<INSTALL_INTERFACE:${GTSAM_EIGEN_INCLUDE_FOR_INSTALL}>
) )
# MKL include dir: # MKL include dir:
if (GTSAM_USE_EIGEN_MKL) if (GTSAM_USE_EIGEN_MKL)