gtsam/cmake
Jing Dong a1b0408f5b fix CMAKE_BUILD_TYPE var to cache varible in default 2016-05-13 12:18:18 -04:00
..
example_project Fixed another comment 2014-05-06 19:14:03 -07:00
obsolete Move obsolete testing macros 2015-02-12 15:43:12 -05:00
CMakeLists.txt Remove obsolete test macro file from install 2015-02-12 15:53:18 -05:00
Config.cmake.in Added cmake subdirectory without history (at SVN r20364) 2013-12-22 13:04:47 -05:00
FindEigen3.cmake Added cmake subdirectory without history (at SVN r20364) 2013-12-22 13:04:47 -05:00
FindGooglePerfTools.cmake Added cmake subdirectory without history (at SVN r20364) 2013-12-22 13:04:47 -05:00
FindMKL.cmake Fix building with MKL on Mac OS 2014-10-14 00:04:28 -04:00
FindNumPy.cmake Look for NumPy C-API if building the python module 2015-12-02 13:35:17 +01:00
FindTBB.cmake Added cmake subdirectory without history (at SVN r20364) 2013-12-22 13:04:47 -05:00
GTSAMCMakeToolsConfig.cmake When calling find_package(GTSAMCMakeTools), set the variable GTSAM_CMAKE_TOOLS_DIR so that files installed from there can be configured in projects and not only in GTSAM, e.g. dllexport.h.in 2014-06-01 18:59:03 -04:00
GtsamBuildTypes.cmake fix CMAKE_BUILD_TYPE var to cache varible in default 2016-05-13 12:18:18 -04:00
GtsamMakeConfigFile.cmake Path fix for projects referencing cmake libs without using a submodule 2013-12-29 15:13:13 -05:00
GtsamMatlabWrap.cmake Only install (and run) testSerialization.m if GTSAM_WRAP_SERIALIZATION is on. 2015-05-20 22:44:33 -04:00
GtsamPrinting.cmake Added cmake subdirectory without history (at SVN r20364) 2013-12-22 13:04:47 -05:00
GtsamPythonWrap.cmake Fix cmake to use default python and boost python versions 2015-12-02 13:35:17 +01:00
GtsamTesting.cmake Many small improvements, bug-fixes, and tests 2016-02-24 11:01:19 -08:00
README.html Added README file for cmake tools 2014-02-19 15:43:37 -05:00
README.md Fixed typo 2014-02-19 15:45:39 -05:00
dllexport.h.in Added cmake subdirectory without history (at SVN r20364) 2013-12-22 13:04:47 -05:00

README.md

GTSAMCMakeTools

This is the collection of GTSAM CMake tools that may be useful in external projects. The way to use this collection is by first making a find_package call:

find_package(GTSAMCMakeTools)

which will add a directory containing the GTSAM CMake tools to the CMAKE_MODULE_PATH variable. After that, you may include the files you would like to use. These files and the functions they define are explained below.

GtsamBuildTypes

include(GtsamBuildTypes)

Including this file immediately sets up the following build types and a drop-down list in cmake-gui:

  • Debug
  • Release
  • RelWithDebInfo
  • Profiling: All optimizations enabled and minimal debug symbols
  • Timing: Defines the symbol GTSAM_ENABLE_TIMING for using GTSAM timing instrumentation

It also configures several minor details, as follows:

  • The compile flag -ftemplate-depth=1024 is set for newer versions of Clang to handle complex templates.
  • On Windows, executable and dll output paths are set to ${CMAKE_BINARY_DIR}/bin and import library output to ${CMAKE_BINARY_DIR}/lib.

It defines the following functions:

  • gtsam_assign_source_folders( [files] ) Organizes files in the IDE into folders to reflect the actual directory structure of those files. Folders will be determined relative to the current source folder when this function is called.
  • gtsam_assign_all_source_folders() Calls gtsam_assign_source_folders on all cpp, c, and h files recursively in the current source folder.

GtsamTesting

include(GtsamTesting)

Defines two useful functions for creating CTest unit tests. Also immediately creates a check target that builds and runs all unit tests.

  • gtsamAddTestsGlob(groupName globPatterns excludedFiles linkLibraries) Add a group of unit tests. A list of unit test .cpp files or glob patterns specifies the tests to create. Tests are assigned into a group name so they can easily by run independently with a make target. Running 'make check' builds and runs all tests.

    Usage example:

    gtsamAddTestsGlob(basic "test*.cpp" "testBroken.cpp" "gtsam;GeographicLib")
    

    Arguments:

    groupName:     A name that will allow this group of tests to be run independently, e.g.
                   'basic' causes a 'check.basic' target to be created to run this test
                   group.
    globPatterns:  The list of files or glob patterns from which to create unit tests, with
                   one test created for each cpp file.  e.g. "test*.cpp", or
                   "testA*.cpp;testB*.cpp;testOneThing.cpp".
    excludedFiles: A list of files or globs to exclude, e.g. "testC*.cpp;testBroken.cpp".
                   Pass an empty string "" if nothing needs to be excluded.
    linkLibraries: The list of libraries to link to in addition to CppUnitLite.
    
  • gtsamAddExamplesGlob(globPatterns excludedFiles linkLibraries) Add scripts that will serve as examples of how to use the library. A list of files or glob patterns is specified, and one executable will be created for each matching .cpp file. These executables will not be installed. They are build with 'make all' if GTSAM_BUILD_EXAMPLES_ALWAYS is enabled. They may also be built with 'make examples'.

    Usage example:

    gtsamAddExamplesGlob("*.cpp" "BrokenExample.cpp" "gtsam;GeographicLib")
    

    Arguments:

    globPatterns:  The list of files or glob patterns from which to create unit tests, with
                   one test created for each cpp file.  e.g. "*.cpp", or
                   "A*.cpp;B*.cpp;MyExample.cpp".
    excludedFiles: A list of files or globs to exclude, e.g. "C*.cpp;BrokenExample.cpp".  Pass
                   an empty string "" if nothing needs to be excluded.
    linkLibraries: The list of libraries to link to.
    

GtsamMatlabWrap

include(GtsamMatlabWrap)

Defines functions for generating MATLAB wrappers. Also immediately creates several CMake options for configuring the wrapper.

  • wrap_and_install_library(interfaceHeader linkLibraries extraIncludeDirs extraMexFlags) Generates wrap code and compiles the wrapper.

    Usage example:

    `wrap_and_install_library("lba.h" "" "" "")`
    

    Arguments:

    interfaceHeader:  The relative or absolute path to the wrapper interface
                      definition file.
    linkLibraries:    Any *additional* libraries to link.  Your project library
                      (e.g. `lba`), libraries it depends on, and any necessary
                      MATLAB libraries will be linked automatically.  So normally,
                      leave this empty.
    extraIncludeDirs: Any *additional* include paths required by dependent
                      libraries that have not already been added by
                      include_directories.  Again, normally, leave this empty.
    extraMexFlags:    Any *additional* flags to pass to the compiler when building
                      the wrap code.  Normally, leave this empty.
    

GtsamMakeConfigFile

include(GtsamMakeConfigFile)

Defines a function for generating a config file so your project may be found with the CMake find_package function. TODO: Write documentation.