gtsam/cmake
Varun Agrawal 569eeb9202 update Config.cmake.in to conditionally include Boost 2024-09-25 16:45:06 -04:00
..
example_cmake_find_gtsam Move to cmake 3.5 2024-08-29 15:16:04 -07:00
obsolete update CppUnitLite to not rely on boost 2023-02-06 10:48:10 -05:00
CMakeLists.txt Make matlab wrapping rely completely on the wrap project 2021-03-09 16:10:08 -05:00
Config.cmake.in update Config.cmake.in to conditionally include Boost 2024-09-25 16:45:06 -04:00
FindGooglePerfTools.cmake Added cmake subdirectory without history (at SVN r20364) 2013-12-22 13:04:47 -05:00
FindMKL.cmake add path to find iomp5 mkl library 2020-05-07 09:07:16 -04:00
FindNumPy.cmake Use cmake to identify best Python version if Default requested 2020-09-17 21:26:11 -04: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
GtsamAddPch.cmake Adding a pre-compiled header for MSVC 2018-11-04 12:37:43 -05:00
GtsamBuildTypes.cmake mark private options as advanced and move GTSAM specific options to HandleGeneralOptions.cmake 2023-10-08 11:23:54 -04:00
GtsamMakeConfigFile.cmake update cmake function to set default package version number 2021-10-23 12:45:44 -04:00
GtsamPrinting.cmake only print cmake compile options for current build version 2023-02-13 19:38:21 -05:00
GtsamTesting.cmake remove extra spaces 2023-10-08 15:02:01 -04:00
HandleAllocators.cmake Use camel case for cmake files 2020-10-07 17:02:55 +02:00
HandleBoost.cmake Set policies 2024-08-29 15:32:26 -07:00
HandleCCache.cmake Use camel case for cmake files 2020-10-07 17:02:55 +02:00
HandleCPack.cmake set lowest common boost version 2021-08-20 11:10:13 -04:00
HandleCephes.cmake only used built in version of Cephes since there doesn't seem to be an easy packaged version 2023-12-29 11:18:58 -05:00
HandleEigen.cmake Minor cleanup on HandleEigen.cmake 2023-02-12 13:39:39 -08:00
HandleFinalChecks.cmake Use camel case for cmake files 2020-10-07 17:02:55 +02:00
HandleGeneralOptions.cmake Merge branch 'develop' into remove-nrAssignments 2023-11-06 17:32:41 -05:00
HandleGlobalBuildFlags.cmake memory sanitizer flag in CMake 2023-06-05 15:08:06 -04:00
HandleMKL.cmake Use camel case for cmake files 2020-10-07 17:02:55 +02:00
HandleMetis.cmake fix typo 2022-03-25 17:11:05 -04:00
HandleOpenMP.cmake Use camel case for cmake files 2020-10-07 17:02:55 +02:00
HandlePerfTools.cmake Use camel case for cmake files 2020-10-07 17:02:55 +02:00
HandlePrintConfiguration.cmake print GTSAM_DT_MERGING cmake config 2023-06-26 18:05:05 -04:00
HandlePython.cmake include patch version for Python interpreter to help disambiguate 2022-05-11 12:06:33 -04:00
HandleTBB.cmake Handle latest ttb 2023-07-03 22:23:00 +03:00
HandleUninstall.cmake Avoid target collision if gtsam used as submodule 2021-02-05 02:26:35 +01:00
README.html update gtsamAddExamplesGlob and gtsamAddTimingGlob to take an additional argument rather than using a global variable 2023-10-08 12:16:24 -04:00
README.md update gtsamAddExamplesGlob and gtsamAddTimingGlob to take an additional argument rather than using a global variable 2023-10-08 12:16:24 -04:00
cmake_uninstall.cmake.in provide 2019-06-10 12:41:27 +02:00
dllexport.h.in Allow override of BUILD_SHARED_LIBS 2023-02-12 13:29:30 -08: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 buildWithAll) 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" ON)
    

    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.
    buildWithAll: Build examples with `make` and/or `make all`
    

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.