update Matlab CMakeLists.txt to use the wrapper

release/4.3a0
Varun Agrawal 2021-03-10 09:17:22 -05:00
parent f03b12e420
commit 827f3feb6b
1 changed files with 111 additions and 105 deletions

View File

@ -1,7 +1,11 @@
# Install matlab components
# Check if flag is enabled
if(NOT GTSAM_INSTALL_MATLAB_TOOLBOX)
return()
endif()
# Create the matlab toolbox for the gtsam library
if(GTSAM_INSTALL_MATLAB_TOOLBOX)
# Set the wrapping script variable
set(MATLAB_WRAP_SCRIPT "${GTSAM_SOURCE_DIR}/wrap/scripts/matlab_wrap.py")
@ -47,16 +51,19 @@ if(GTSAM_INSTALL_MATLAB_TOOLBOX)
)
endif()
# ############################################################################
# ##############################################################################
# Generate, build and install toolbox
set(mexFlags "${GTSAM_BUILD_MEX_BINARY_FLAGS}")
if(NOT BUILD_SHARED_LIBS)
list(APPEND mexFlags -DGTSAM_IMPORT_STATIC)
endif()
set(ignore gtsam::Point2 gtsam::Point3 gtsam::BearingRangeFactor
gtsam::BearingRangeFactor2D gtsam::BearingRangeFactorPose2)
# Wrap
wrap_and_install_library(${GTSAM_SOURCE_DIR}/gtsam/gtsam.i "${GTSAM_ADDITIONAL_LIBRARIES}" ""
"${mexFlags}")
matlab_wrap(${GTSAM_SOURCE_DIR}/gtsam/gtsam.i "${GTSAM_ADDITIONAL_LIBRARIES}"
"" "${mexFlags}" "${ignore}")
# Wrap version for gtsam_unstable
if(GTSAM_UNSTABLE_INSTALL_MATLAB_TOOLBOX)
@ -67,7 +74,8 @@ if(GTSAM_INSTALL_MATLAB_TOOLBOX)
endif()
# Wrap
wrap_and_install_library(${GTSAM_SOURCE_DIR}/gtsam_unstable/gtsam_unstable.i "gtsam" "" "${mexFlags}")
matlab_wrap(${GTSAM_SOURCE_DIR}/gtsam_unstable/gtsam_unstable.i "gtsam" ""
"${mexFlags}")
endif(GTSAM_UNSTABLE_INSTALL_MATLAB_TOOLBOX)
# Record the root dir for gtsam - needed during external builds, e.g., ROS
@ -87,8 +95,8 @@ if(GTSAM_INSTALL_MATLAB_TOOLBOX)
# Utilities message(STATUS "Installing Matlab Toolbox Utilities")
# install_matlab_scripts("${GTSAM_SOURCE_ROOT_DIR}/matlab/+gtsam" "*.m")
# message(STATUS "Installing Matlab Toolbox Example Data") Data files:
# *.graph, *.mat, and *.txt
# message(STATUS "Installing Matlab Toolbox Example Data") Data files: *.graph,
# *.mat, and *.txt
file(GLOB matlab_examples_data_graph
"${GTSAM_SOURCE_ROOT_DIR}/examples/Data/*.graph")
file(GLOB matlab_examples_data_mat
@ -120,5 +128,3 @@ if(GTSAM_INSTALL_MATLAB_TOOLBOX)
install(FILES ${matlab_examples_data}
DESTINATION ${GTSAM_TOOLBOX_INSTALL_PATH}/gtsam_examples/Data)
endif()
endif(GTSAM_INSTALL_MATLAB_TOOLBOX)