diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 000000000..d98b500b5 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,40 @@ +project(GTSAM CXX C) +set (GTSAM_VERSION_MAJOR 0) +set (GTSAM_VERSION_MINOR 9) +set (GTSAM_VERSION_PATCH 3) +cmake_minimum_required(VERSION 2.6) + +# 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() + +# Turn off function inlining when debugging +set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -fno-inline -Wall") +set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-inline -Wall") +# No optimization in relwithdebinfo +set(CMAKE_C_FLAGS_RELWITHDEBINFO "-g -fno-inline -Wall") +set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g -fno-inline -Wall") +# Eigen no debug in release mode +set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DEIGEN_NO_DEBUG") +set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DEIGEN_NO_DEBUG") + +# Configurable Options + +# General build settings +include_directories(gtsam CppUnitLite) + +# Build GTSAM library +add_subdirectory(gtsam) + +# Build CppUnitLite +add_subdirectory(CppUnitLite) + +# Build Tests +add_subdirectory(tests) + +# Build wrap +add_subdirectory(wrap) + +# Build examples +add_subdirectory(examples) \ No newline at end of file diff --git a/gtsam/CMakeLists.txt b/gtsam/CMakeLists.txt new file mode 100644 index 000000000..1e40dbb68 --- /dev/null +++ b/gtsam/CMakeLists.txt @@ -0,0 +1,18 @@ +# build 3rd party libraries +add_subdirectory(3rdparty) + +# Build full gtsam library as a single library +# and also build tests +set (gtsam_subdirs + base + geometry + inference + linear + nonlinear + slam) + +foreach(subdir ${gtsam_subdirs}) + file(GLOB sub_gtsam_srcs ${subdir} "*.cpp") + list(APPEND gtsam_srcs sub_gtsam_srcs) +endforeach(subdir) +