Updated find scripts to work by testing against gtsam2, no longer depends on build folders
parent
1345a5fe86
commit
12351dbfea
|
@ -3,22 +3,19 @@
|
|||
# The following variables will be defined:
|
||||
#
|
||||
# CppUnitLite_FOUND : TRUE if the package has been successfully found
|
||||
# CppUnitLite_INCLUDE_DIRS : paths to CppUnitLite's INCLUDE directories
|
||||
# CppUnitLite_INCLUDE_DIR : paths to CppUnitLite's INCLUDE directories
|
||||
# CppUnitLite_LIBS : paths to CppUnitLite's libraries
|
||||
|
||||
|
||||
# Find include dirs
|
||||
find_path(_CppUnitLite_INCLUDE_DIR CppUnitLite/Test.h
|
||||
PATHS ${GTSAM_ROOT} ${CMAKE_INSTALL_PREFIX}/include ${HOME}/include /usr/local/include /usr/include )
|
||||
PATHS ${CMAKE_INSTALL_PREFIX}/include "$ENV{HOME}/include" /usr/local/include /usr/include )
|
||||
|
||||
# Find libraries
|
||||
find_library(_CppUnitLite_LIB NAMES CppUnitLite
|
||||
HINTS ${_CppUnitLite_INCLUDE_DIR}/build/CppUnitLite ${_CppUnitLite_INCLUDE_DIR}/CppUnitLite)
|
||||
|
||||
set (CppUnitLite_INCLUDE_DIRS ${_CppUnitLite_INCLUDE_DIR})
|
||||
set (CppUnitLite_LIBS ${_CppUnitLite_LIB})
|
||||
|
||||
HINTS ${CMAKE_INSTALL_PREFIX}/lib "$ENV{HOME}/lib" /usr/local/lib /usr/lib)
|
||||
|
||||
set (CppUnitLite_INCLUDE_DIR ${_CppUnitLite_INCLUDE_DIR} CACHE STRING "CppUnitLite INCLUDE directories")
|
||||
set (CppUnitLite_LIBS ${_CppUnitLite_LIB} CACHE STRING "CppUnitLite libraries")
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set LIBXML2_FOUND to TRUE
|
||||
# if all listed variables are TRUE
|
||||
|
|
|
@ -3,23 +3,19 @@
|
|||
# The following variables will be defined:
|
||||
#
|
||||
# GTSAM_FOUND : TRUE if the package has been successfully found
|
||||
# GTSAM_INCLUDE_DIRS : paths to GTSAM's INCLUDE directories
|
||||
# GTSAM_INCLUDE_DIR : paths to GTSAM's INCLUDE directories
|
||||
# GTSAM_LIBS : paths to GTSAM's libraries
|
||||
|
||||
|
||||
# Find include dirs
|
||||
find_path(_gtsam_INCLUDE_DIR gtsam/inference/FactorGraph.h
|
||||
PATHS ${GTSAM_ROOT} ${CMAKE_INSTALL_PREFIX}/include ${HOME}/include /usr/local/include /usr/include )
|
||||
PATHS ${CMAKE_INSTALL_PREFIX}/include "$ENV{HOME}/include" /usr/local/include /usr/include )
|
||||
|
||||
# Find libraries
|
||||
find_library(_gtsam_LIB NAMES gtsam
|
||||
HINTS ${_gtsam_INCLUDE_DIR}/build-debug/gtsam/.libs ${_gtsam_INCLUDE_DIR}/build/gtsam/.libs ${_gtsam_INCLUDE_DIR}/gtsam/.libs
|
||||
NO_DEFAULT_PATH)
|
||||
|
||||
set (GTSAM_INCLUDE_DIRS ${_gtsam_INCLUDE_DIR} CACHE STRING "GTSAM INCLUDE directories")
|
||||
set (GTSAM_LIBS ${_gtsam_LIB} CACHE STRING "GTSAM libraries")
|
||||
|
||||
HINTS ${CMAKE_INSTALL_PREFIX}/lib "$ENV{HOME}/lib" /usr/local/lib /usr/lib)
|
||||
|
||||
set (GTSAM_INCLUDE_DIR ${_gtsam_INCLUDE_DIR} CACHE STRING "GTSAM INCLUDE directories")
|
||||
set (GTSAM_LIBS ${_gtsam_LIB} CACHE STRING "GTSAM libraries")
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set LIBXML2_FOUND to TRUE
|
||||
# if all listed variables are TRUE
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
# This is FindWrap.cmake
|
||||
# CMake module to locate the Wrap tool and header after installation package
|
||||
# The following variables will be defined:
|
||||
#
|
||||
# Wrap_FOUND : TRUE if the package has been successfully found
|
||||
# Wrap_CMD : command for executing wrap
|
||||
# Wrap_INCLUDE_DIR : paths to Wrap's INCLUDE directories
|
||||
|
||||
# Find include dir
|
||||
find_path(_Wrap_INCLUDE_DIR wrap/matlab.h
|
||||
PATHS ${CMAKE_INSTALL_PREFIX}/include "$ENV{HOME}/include" /usr/local/include /usr/include )
|
||||
|
||||
# Find the installed executable
|
||||
find_program(_Wrap_CMD NAMES wrap
|
||||
PATHS ${CMAKE_INSTALL_PREFIX}/bin "$ENV{HOME}/bin" /usr/local/bin /usr/bin )
|
||||
|
||||
set (Wrap_INCLUDE_DIR ${_Wrap_INCLUDE_DIR} CACHE STRING "Wrap INCLUDE directories")
|
||||
set (Wrap_CMD ${_Wrap_CMD} CACHE STRING "Wrap executable location")
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set LIBXML2_FOUND to TRUE
|
||||
# if all listed variables are TRUE
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Wrap DEFAULT_MSG
|
||||
_Wrap_INCLUDE_DIR _Wrap_CMD)
|
||||
|
||||
mark_as_advanced(_Wrap_INCLUDE_DIR _Wrap_CMD )
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
# Macros for using wrap functionality
|
||||
macro(find_mexextension)
|
||||
## Determine the mex extension
|
||||
# Apple Macintosh (64-bit) mexmaci64
|
||||
# Linux (32-bit) mexglx
|
||||
# Linux (64-bit) mexa64
|
||||
# Microsoft Windows (32-bit) mexw32
|
||||
# Windows (64-bit) mexw64
|
||||
|
||||
# only support 64-bit apple
|
||||
if(CMAKE_HOST_APPLE)
|
||||
set(GTSAM_MEX_BIN_EXTENSION_default mexmaci64)
|
||||
endif(CMAKE_HOST_APPLE)
|
||||
|
||||
if(NOT CMAKE_HOST_APPLE)
|
||||
# check 64 bit
|
||||
if( ${CMAKE_SIZEOF_VOID_P} EQUAL 4 )
|
||||
set( HAVE_64_BIT 0 )
|
||||
endif( ${CMAKE_SIZEOF_VOID_P} EQUAL 4 )
|
||||
|
||||
if( ${CMAKE_SIZEOF_VOID_P} EQUAL 8 )
|
||||
set( HAVE_64_BIT 1 )
|
||||
endif( ${CMAKE_SIZEOF_VOID_P} EQUAL 8 )
|
||||
|
||||
# Check for linux machines
|
||||
if (CMAKE_HOST_UNIX)
|
||||
if (HAVE_64_BIT)
|
||||
set(GTSAM_MEX_BIN_EXTENSION_default mexa64)
|
||||
else (HAVE_64_BIT)
|
||||
set(GTSAM_MEX_BIN_EXTENSION_default mexglx)
|
||||
endif (HAVE_64_BIT)
|
||||
endif(CMAKE_HOST_UNIX)
|
||||
|
||||
# Check for windows machines
|
||||
if (CMAKE_HOST_WIN32)
|
||||
if (HAVE_64_BIT)
|
||||
set(GTSAM_MEX_BIN_EXTENSION_default mexw64)
|
||||
else (HAVE_64_BIT)
|
||||
set(GTSAM_MEX_BIN_EXTENSION_default mexw32)
|
||||
endif (HAVE_64_BIT)
|
||||
endif(CMAKE_HOST_WIN32)
|
||||
endif(NOT CMAKE_HOST_APPLE)
|
||||
|
||||
# Allow for setting mex extension manually
|
||||
set(GTSAM_MEX_BIN_EXTENSION ${GTSAM_MEX_BIN_EXTENSION_default} CACHE DOCSTRING "Extension for matlab mex files")
|
||||
message(STATUS "Detected Matlab mex extension: ${GTSAM_MEX_BIN_EXTENSION_default}")
|
||||
message(STATUS "Current Matlab mex extension: ${GTSAM_MEX_BIN_EXTENSION}")
|
||||
endmacro(find_mexextension)
|
|
@ -34,53 +34,10 @@ set(mexFlags "-I${Boost_INCLUDE_DIR} -I${CMAKE_INSTALL_PREFIX}/include -I${CMAKE
|
|||
set(toolbox_path ${CMAKE_BINARY_DIR}/wrap/gtsam)
|
||||
set(moduleName gtsam)
|
||||
|
||||
## Determine the mex extension
|
||||
# Apple Macintosh (64-bit) mexmaci64
|
||||
# Linux (32-bit) mexglx
|
||||
# Linux (64-bit) mexa64
|
||||
# Microsoft Windows (32-bit) mexw32
|
||||
# Windows (64-bit) mexw64
|
||||
include(GtsamMatlabWrap)
|
||||
find_mexextension()
|
||||
|
||||
# only support 64-bit apple
|
||||
if(CMAKE_HOST_APPLE)
|
||||
set(GTSAM_MEX_BIN_EXTENSION_default mexmaci64)
|
||||
endif(CMAKE_HOST_APPLE)
|
||||
|
||||
if(NOT CMAKE_HOST_APPLE)
|
||||
# check 64 bit
|
||||
if( ${CMAKE_SIZEOF_VOID_P} EQUAL 4 )
|
||||
set( HAVE_64_BIT 0 )
|
||||
endif( ${CMAKE_SIZEOF_VOID_P} EQUAL 4 )
|
||||
|
||||
if( ${CMAKE_SIZEOF_VOID_P} EQUAL 8 )
|
||||
set( HAVE_64_BIT 1 )
|
||||
endif( ${CMAKE_SIZEOF_VOID_P} EQUAL 8 )
|
||||
|
||||
# Check for linux machines
|
||||
if (CMAKE_HOST_UNIX)
|
||||
if (HAVE_64_BIT)
|
||||
set(GTSAM_MEX_BIN_EXTENSION_default mexa64)
|
||||
else (HAVE_64_BIT)
|
||||
set(GTSAM_MEX_BIN_EXTENSION_default mexglx)
|
||||
endif (HAVE_64_BIT)
|
||||
endif(CMAKE_HOST_UNIX)
|
||||
|
||||
# Check for windows machines
|
||||
if (CMAKE_HOST_WIN32)
|
||||
if (HAVE_64_BIT)
|
||||
set(GTSAM_MEX_BIN_EXTENSION_default mexw64)
|
||||
else (HAVE_64_BIT)
|
||||
set(GTSAM_MEX_BIN_EXTENSION_default mexw32)
|
||||
endif (HAVE_64_BIT)
|
||||
endif(CMAKE_HOST_WIN32)
|
||||
endif(NOT CMAKE_HOST_APPLE)
|
||||
|
||||
# Allow for setting mex extension manually
|
||||
set(GTSAM_MEX_BIN_EXTENSION ${GTSAM_MEX_BIN_EXTENSION_default} CACHE DOCSTRING "Extension for matlab mex files")
|
||||
message(STATUS "Detected Matlab mex extension: ${GTSAM_MEX_BIN_EXTENSION_default}")
|
||||
message(STATUS "Current Matlab mex extension: ${GTSAM_MEX_BIN_EXTENSION}")
|
||||
|
||||
# Actual build commands - separated by OS
|
||||
# Code generation command
|
||||
add_custom_target(wrap_gtsam ALL COMMAND
|
||||
./wrap ${GTSAM_MEX_BIN_EXTENSION} ${CMAKE_SOURCE_DIR} ${moduleName} ${toolbox_path} "${mexFlags}"
|
||||
DEPENDS wrap)
|
||||
|
|
Loading…
Reference in New Issue