114 lines
3.5 KiB
CMake
114 lines
3.5 KiB
CMake
project(GTSAM CXX C)
|
|
cmake_minimum_required(VERSION 3.0)
|
|
|
|
# new feature to Cmake Version > 2.8.12
|
|
# Mac ONLY. Define Relative Path on Mac OS
|
|
if(NOT DEFINED CMAKE_MACOSX_RPATH)
|
|
set(CMAKE_MACOSX_RPATH 0)
|
|
endif()
|
|
|
|
# Set the version number for the library
|
|
set (GTSAM_VERSION_MAJOR 4)
|
|
set (GTSAM_VERSION_MINOR 1)
|
|
set (GTSAM_VERSION_PATCH 0)
|
|
math (EXPR GTSAM_VERSION_NUMERIC "10000 * ${GTSAM_VERSION_MAJOR} + 100 * ${GTSAM_VERSION_MINOR} + ${GTSAM_VERSION_PATCH}")
|
|
set (GTSAM_VERSION_STRING "${GTSAM_VERSION_MAJOR}.${GTSAM_VERSION_MINOR}.${GTSAM_VERSION_PATCH}")
|
|
|
|
set (CMAKE_PROJECT_VERSION ${GTSAM_VERSION_STRING})
|
|
set (CMAKE_PROJECT_VERSION_MAJOR ${GTSAM_VERSION_MAJOR})
|
|
set (CMAKE_PROJECT_VERSION_MINOR ${GTSAM_VERSION_MINOR})
|
|
set (CMAKE_PROJECT_VERSION_PATCH ${GTSAM_VERSION_PATCH})
|
|
|
|
###############################################################################
|
|
# Gather information, perform checks, set defaults
|
|
|
|
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
|
include(GtsamMakeConfigFile)
|
|
include(GNUInstallDirs)
|
|
|
|
# Load build type flags and default to Debug mode
|
|
include(GtsamBuildTypes)
|
|
|
|
# Use macros for creating tests/timing scripts
|
|
include(GtsamTesting)
|
|
include(GtsamPrinting)
|
|
|
|
# guard against in-source builds
|
|
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
|
|
message(FATAL_ERROR "In-source builds not allowed. Please make a new directory (called a build directory) and run CMake from there. You may need to remove CMakeCache.txt. ")
|
|
endif()
|
|
|
|
include(cmake/handle_boost.cmake) # Boost
|
|
include(cmake/handle_ccache.cmake) # ccache
|
|
include(cmake/handle_cpack.cmake) # CPack
|
|
include(cmake/handle_eigen.cmake) # Eigen3
|
|
include(cmake/handle_general_options.cmake) # CMake build options
|
|
include(cmake/handle_mkl.cmake) # MKL
|
|
include(cmake/handle_openmp.cmake) # OpenMP
|
|
include(cmake/handle_perftools.cmake) # Google perftools
|
|
include(cmake/handle_python.cmake) # Python options and commands
|
|
include(cmake/handle_tbb.cmake) # TBB
|
|
include(cmake/handle_uninstall.cmake) # for "make uninstall"
|
|
|
|
include(cmake/handle_allocators.cmake) # Must be after tbb, pertools
|
|
|
|
include(cmake/handle_global_build_flags.cmake) # Build flags
|
|
|
|
###############################################################################
|
|
# Add components
|
|
|
|
# Build CppUnitLite
|
|
add_subdirectory(CppUnitLite)
|
|
|
|
# This is the new wrapper
|
|
if(GTSAM_BUILD_PYTHON)
|
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/wrap/cmake")
|
|
add_subdirectory(python)
|
|
endif()
|
|
|
|
# Build GTSAM library
|
|
add_subdirectory(gtsam)
|
|
|
|
# Build Tests
|
|
add_subdirectory(tests)
|
|
|
|
# Build examples
|
|
add_subdirectory(examples)
|
|
|
|
# Build timing
|
|
add_subdirectory(timing)
|
|
|
|
# Build gtsam_unstable
|
|
if (GTSAM_BUILD_UNSTABLE)
|
|
add_subdirectory(gtsam_unstable)
|
|
endif()
|
|
|
|
# Matlab toolbox
|
|
if (GTSAM_INSTALL_MATLAB_TOOLBOX)
|
|
add_subdirectory(matlab)
|
|
endif()
|
|
|
|
# Install config and export files
|
|
GtsamMakeConfigFile(GTSAM "${CMAKE_CURRENT_SOURCE_DIR}/gtsam_extra.cmake.in")
|
|
export(TARGETS ${GTSAM_EXPORTED_TARGETS} FILE GTSAM-exports.cmake)
|
|
|
|
# Check for doxygen availability - optional dependency
|
|
find_package(Doxygen)
|
|
|
|
# Doxygen documentation - enabling options in subfolder
|
|
if (DOXYGEN_FOUND)
|
|
add_subdirectory(doc)
|
|
endif()
|
|
|
|
# CMake Tools
|
|
add_subdirectory(cmake)
|
|
|
|
# Print configuration variables
|
|
include(cmake/handle_print_configuration.cmake)
|
|
|
|
# Print warnings at the end
|
|
include(cmake/handle_final_checks.cmake)
|
|
|
|
# Include CPack *after* all flags
|
|
include(CPack)
|