From d3d566597cd22dcd0cfa16576ab7eb60245ef15e Mon Sep 17 00:00:00 2001 From: Richard Roberts Date: Tue, 18 Feb 2014 13:27:17 -0500 Subject: [PATCH 01/11] Comment fix --- gtsam/nonlinear/DoglegOptimizerImpl.h | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/gtsam/nonlinear/DoglegOptimizerImpl.h b/gtsam/nonlinear/DoglegOptimizerImpl.h index c0b52f88b..a6c04681b 100644 --- a/gtsam/nonlinear/DoglegOptimizerImpl.h +++ b/gtsam/nonlinear/DoglegOptimizerImpl.h @@ -26,15 +26,8 @@ namespace gtsam { /** This class contains the implementation of the Dogleg algorithm. It is used * by DoglegOptimizer and can be used to easily put together custom versions of * Dogleg. Each function is well-documented and unit-tested. The notation - * here matches that in "trustregion.pdf" in gtsam_experimental/doc, see this - * file for further explanation of the computations performed by this class. - * - * \tparam VALUES The Values or TupleValues type to hold the values to be - * estimated. - * - * \tparam GAUSSIAN_SOLVER The linear solver to use at each iteration, - * currently either GaussianSequentialSolver or GaussianMultifrontalSolver. - * The latter is typically faster, especially for non-trivial problems. + * here matches that in "trustregion.pdf" in doc, see this file for further + * explanation of the computations performed by this class. */ struct GTSAM_EXPORT DoglegOptimizerImpl { From 753f59747cd321965914fcdf6ac9f4e5ce86fe02 Mon Sep 17 00:00:00 2001 From: Richard Roberts Date: Tue, 18 Feb 2014 13:43:54 -0500 Subject: [PATCH 02/11] Removed obsolete wrap functions (sent email about this) --- cmake/GtsamMatlabWrap.cmake | 52 +++---------------------------------- 1 file changed, 4 insertions(+), 48 deletions(-) diff --git a/cmake/GtsamMatlabWrap.cmake b/cmake/GtsamMatlabWrap.cmake index a8592f16c..1fde266f4 100644 --- a/cmake/GtsamMatlabWrap.cmake +++ b/cmake/GtsamMatlabWrap.cmake @@ -53,6 +53,7 @@ function(wrap_and_install_library interfaceHeader linkLibraries extraIncludeDirs endfunction() +# Internal function that wraps a library and compiles the wrapper function(wrap_library_internal interfaceHeader linkLibraries extraIncludeDirs extraMexFlags) if(UNIX AND NOT APPLE) if(CMAKE_SIZEOF_VOID_P EQUAL 8) @@ -187,6 +188,7 @@ function(wrap_library_internal interfaceHeader linkLibraries extraIncludeDirs ex COMMAND cmake -E remove_directory ${compiled_mex_modules_root}) endfunction() +# Internal function that installs a wrap toolbox function(install_wrapped_library_internal interfaceHeader) get_filename_component(moduleName "${interfaceHeader}" NAME_WE) set(generated_files_path "${PROJECT_BINARY_DIR}/wrap/${moduleName}") @@ -218,6 +220,8 @@ function(install_wrapped_library_internal interfaceHeader) endif() endfunction() +# Internal function to check for libraries installed with MATLAB that may conflict +# and prints a warning to move them if problems occur. function(check_conflicting_libraries_internal libraries) if(UNIX) # Set path for matlab's built-in libraries @@ -288,54 +292,6 @@ function(check_conflicting_libraries_internal libraries) endif() endfunction() - -# Function to setup codegen and building of the wrap toolbox -# -# params: -# moduleName : the name of the module, interface file must be called moduleName.h -# mexFlags : Compilation flags to be passed to the mex compiler -# modulePath : relative path to module markup header file (called moduleName.h) -# otherLibraries : list of library targets this should depend on -# toolboxPath : the directory in which to generate/build wrappers -# wrap_header_path : path to the installed wrap header -function(wrap_library_generic moduleName mexFlags modulePath otherLibraries toolbox_path wrap_header_path) - - if(NOT "${CMAKE_PROJECT_NAME}" STREQUAL "GTSAM") - message("Your project uses wrap_library or wrap_library_generic - this is deprecated, please use the more user-friendly function wrap_and_install_library") - endif() - - # Append module name to link libraries to keep original behavior - list(APPEND otherLibraries ${moduleName}) - - # Set up arguments - set(interfaceHeader ${modulePath}/${moduleName}.h) - - # Call internal function - wrap_library_internal("${interfaceHeader}" "${otherLibraries}" "" "${mexFlags}") -endfunction(wrap_library_generic) - -# Function to setup codegen, building and installation of the wrap toolbox -# This wrap setup function assumes that the toolbox will be installed directly, -# with predictable matlab.h sourcing. Use this version when the toolbox will be used -# from the installed version, rather than in place. -# Assumes variable GTSAM_WRAP_HEADER_PATH has been set -# params: -# moduleName : the name of the module, interface file must be called moduleName.h -# mexFlags : Compilation flags to be passed to the mex compiler -# modulePath : relative path to module markup header file (called moduleName.h) -# otherLibraries : list of library targets this should depend on -function(wrap_library moduleName mexFlags modulePath otherLibraries) - # Toolbox generation path goes in build folder - set(toolbox_base_path ${PROJECT_BINARY_DIR}/wrap) - set(toolbox_path ${toolbox_base_path}/${moduleName}) - - # Call generic version of function - wrap_library_generic("${moduleName}" "${mexFlags}" "${modulePath}" "${otherLibraries}" "${toolbox_path}" "${GTSAM_WRAP_HEADER_PATH}") - - install_wrapped_library_internal("${modulePath}/${moduleName}.h") - -endfunction(wrap_library) - # Helper function to install MATLAB scripts and handle multiple build types where the scripts # should be installed to all build type toolboxes function(install_matlab_scripts source_directory patterns) From 89e6d2f1e8b55a059e90fab4596513e8dc18fc50 Mon Sep 17 00:00:00 2001 From: Richard Roberts Date: Tue, 18 Feb 2014 13:44:25 -0500 Subject: [PATCH 03/11] Removed some commented-out includes --- gtsam_unstable/slam/tests/testBetweenFactorEM.cpp | 4 ---- .../slam/tests/testTransformBtwRobotsUnaryFactor.cpp | 2 -- .../slam/tests/testTransformBtwRobotsUnaryFactorEM.cpp | 2 -- 3 files changed, 8 deletions(-) diff --git a/gtsam_unstable/slam/tests/testBetweenFactorEM.cpp b/gtsam_unstable/slam/tests/testBetweenFactorEM.cpp index 340a3202a..a7934c622 100644 --- a/gtsam_unstable/slam/tests/testBetweenFactorEM.cpp +++ b/gtsam_unstable/slam/tests/testBetweenFactorEM.cpp @@ -15,10 +15,6 @@ #include -//#include -//#include -//#include - using namespace std; using namespace gtsam; diff --git a/gtsam_unstable/slam/tests/testTransformBtwRobotsUnaryFactor.cpp b/gtsam_unstable/slam/tests/testTransformBtwRobotsUnaryFactor.cpp index e20d8bbcf..c8357aba4 100644 --- a/gtsam_unstable/slam/tests/testTransformBtwRobotsUnaryFactor.cpp +++ b/gtsam_unstable/slam/tests/testTransformBtwRobotsUnaryFactor.cpp @@ -19,8 +19,6 @@ #include #include -//#include - using namespace std; using namespace gtsam; diff --git a/gtsam_unstable/slam/tests/testTransformBtwRobotsUnaryFactorEM.cpp b/gtsam_unstable/slam/tests/testTransformBtwRobotsUnaryFactorEM.cpp index 68060997b..1ffb2bebe 100644 --- a/gtsam_unstable/slam/tests/testTransformBtwRobotsUnaryFactorEM.cpp +++ b/gtsam_unstable/slam/tests/testTransformBtwRobotsUnaryFactorEM.cpp @@ -19,8 +19,6 @@ #include #include -//#include - using namespace std; using namespace gtsam; From 25bd93359a29620075c93c0ec36601e5e28b6b65 Mon Sep 17 00:00:00 2001 From: Richard Roberts Date: Tue, 18 Feb 2014 14:13:07 -0500 Subject: [PATCH 04/11] Fixed warning --- gtsam/linear/HessianFactor.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/gtsam/linear/HessianFactor.cpp b/gtsam/linear/HessianFactor.cpp index cfa698dca..0868cd663 100644 --- a/gtsam/linear/HessianFactor.cpp +++ b/gtsam/linear/HessianFactor.cpp @@ -265,11 +265,6 @@ HessianFactor::HessianFactor(const GaussianFactor& gf) : } } -/* ************************************************************************* */ -namespace { -DenseIndex _dimFromScatterEntry(const Scatter::value_type& key_slotentry) { - return key_slotentry.second.dimension; } } - /* ************************************************************************* */ HessianFactor::HessianFactor(const GaussianFactorGraph& factors, boost::optional scatter) From 7efe7cefcadc460c4aa67f64949503773c6ae591 Mon Sep 17 00:00:00 2001 From: cbeall3 Date: Tue, 18 Feb 2014 18:24:27 -0500 Subject: [PATCH 05/11] Removing unimplemented method optimize() --- gtsam/nonlinear/ISAM2.h | 8 -------- 1 file changed, 8 deletions(-) diff --git a/gtsam/nonlinear/ISAM2.h b/gtsam/nonlinear/ISAM2.h index 469c78f33..04569e22d 100644 --- a/gtsam/nonlinear/ISAM2.h +++ b/gtsam/nonlinear/ISAM2.h @@ -559,14 +559,6 @@ public: /** Access the current linearization point */ const Values& getLinearizationPoint() const { return theta_; } - /// Compute the current solution. This is the "standard" function for computing the solution that - /// uses: - /// - Partial relinearization and backsubstitution using the thresholds provided in ISAM2Params. - /// - Dogleg trust-region step, if enabled in ISAM2Params. - /// - Equivalent to getLinearizationPoint().retract(getDelta()) - /// The solution returned is in general not the same as that returned by getLinearizationPoint(). - Values optimize() const; - /** Compute an estimate from the incomplete linear delta computed during the last update. * This delta is incomplete because it was not updated below wildfire_threshold. If only * a single variable is needed, it is faster to call calculateEstimate(const KEY&). From e029204c01f714d9cfbe25e78da65d66138d35a8 Mon Sep 17 00:00:00 2001 From: Richard Roberts Date: Wed, 19 Feb 2014 13:10:37 -0500 Subject: [PATCH 06/11] Added cmake code to install cmake tools, and a GTSAM-CMakeToolsConfig file to automatically find them. --- CMakeLists.txt | 3 +++ cmake/CMakeLists.txt | 26 ++++++++++++++++++++++++++ cmake/GTSAM-CMakeToolsConfig.cmake | 3 +++ 3 files changed, 32 insertions(+) create mode 100644 cmake/CMakeLists.txt create mode 100644 cmake/GTSAM-CMakeToolsConfig.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index cf5a1a962..c6f5852b9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -321,6 +321,9 @@ if (DOXYGEN_FOUND) add_subdirectory(doc) endif() +# CMake Tools +add_subdirectory(cmake) + ############################################################################### # Set up CPack diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt new file mode 100644 index 000000000..d201fc1d7 --- /dev/null +++ b/cmake/CMakeLists.txt @@ -0,0 +1,26 @@ +# This file installs the scripts from this directory that may be used in other +# projects. See README.txt in this directory for documentation. + +# Set the install directory depending on the platform so it will be found by +# find_package(GTSAM-CMakeTools) +if(WIN32 AND NOT CYGWIN) + set(SCRIPT_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/CMake") +else() + set(SCRIPT_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib/cmake") +endif() + +# Install scripts +install(FILES + GTSAM-CMakeToolsConfig.cmake + Config.cmake.in + dllexport.h.in + GtsamBuildTypes.cmake + GtsamMakeConfigFile.cmake + GtsamMatlabWrap.cmake + GtsamPrinting.cmake + GtsamPythonWrap.cmake + GtsamTesting.cmake + GtsamTestingObsolete.cmake + DESTINATION "${SCRIPT_INSTALL_DIR}/GTSAM-CMakeTools") + + diff --git a/cmake/GTSAM-CMakeToolsConfig.cmake b/cmake/GTSAM-CMakeToolsConfig.cmake new file mode 100644 index 000000000..c79a2f5c2 --- /dev/null +++ b/cmake/GTSAM-CMakeToolsConfig.cmake @@ -0,0 +1,3 @@ +# This config file modifies CMAKE_MODULE_PATH so that the GTSAM-CMakeTools files may be included + +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}") From 781349ec86989eb2724b7697782ebe33f5494d7d Mon Sep 17 00:00:00 2001 From: Richard Roberts Date: Wed, 19 Feb 2014 13:12:22 -0500 Subject: [PATCH 07/11] Renamed to GTSAMCMakeTools --- cmake/CMakeLists.txt | 6 +++--- ...M-CMakeToolsConfig.cmake => GTSAMCMakeToolsConfig.cmake} | 0 2 files changed, 3 insertions(+), 3 deletions(-) rename cmake/{GTSAM-CMakeToolsConfig.cmake => GTSAMCMakeToolsConfig.cmake} (100%) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index d201fc1d7..89cf53898 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -2,7 +2,7 @@ # projects. See README.txt in this directory for documentation. # Set the install directory depending on the platform so it will be found by -# find_package(GTSAM-CMakeTools) +# find_package(GTSAMCMakeTools) if(WIN32 AND NOT CYGWIN) set(SCRIPT_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/CMake") else() @@ -11,7 +11,7 @@ endif() # Install scripts install(FILES - GTSAM-CMakeToolsConfig.cmake + GTSAMCMakeToolsConfig.cmake Config.cmake.in dllexport.h.in GtsamBuildTypes.cmake @@ -21,6 +21,6 @@ install(FILES GtsamPythonWrap.cmake GtsamTesting.cmake GtsamTestingObsolete.cmake - DESTINATION "${SCRIPT_INSTALL_DIR}/GTSAM-CMakeTools") + DESTINATION "${SCRIPT_INSTALL_DIR}/GTSAMCMakeTools") diff --git a/cmake/GTSAM-CMakeToolsConfig.cmake b/cmake/GTSAMCMakeToolsConfig.cmake similarity index 100% rename from cmake/GTSAM-CMakeToolsConfig.cmake rename to cmake/GTSAMCMakeToolsConfig.cmake From b4d7ede12330dc86007923335a707bd62ceffb2d Mon Sep 17 00:00:00 2001 From: Richard Roberts Date: Wed, 19 Feb 2014 15:43:16 -0500 Subject: [PATCH 08/11] Better debug flag for Profiling build type --- cmake/GtsamBuildTypes.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/GtsamBuildTypes.cmake b/cmake/GtsamBuildTypes.cmake index 51e66627d..64c616de5 100644 --- a/cmake/GtsamBuildTypes.cmake +++ b/cmake/GtsamBuildTypes.cmake @@ -45,8 +45,8 @@ if(NOT FIRST_PASS_DONE) set(CMAKE_EXE_LINKER_FLAGS_TIMING "${CMAKE_EXE_LINKER_FLAGS_RELEASE}" CACHE STRING "Linker flags during timing builds." FORCE) set(CMAKE_SHARED_LINKER_FLAGS_TIMING "${CMAKE_EXE_LINKER_FLAGS_RELEASE}" CACHE STRING "Linker flags during timing builds." FORCE) mark_as_advanced(CMAKE_C_FLAGS_TIMING CMAKE_CXX_FLAGS_TIMING CMAKE_EXE_LINKER_FLAGS_TIMING CMAKE_SHARED_LINKER_FLAGS_TIMING) - set(CMAKE_C_FLAGS_PROFILING "-g -O3 -Wall -DNDEBUG" CACHE STRING "Flags used by the compiler during profiling builds." FORCE) - set(CMAKE_CXX_FLAGS_PROFILING "-g -O3 -Wall -DNDEBUG" CACHE STRING "Flags used by the compiler during profiling builds." FORCE) + set(CMAKE_C_FLAGS_PROFILING "-g1 -O3 -Wall -DNDEBUG" CACHE STRING "Flags used by the compiler during profiling builds." FORCE) + set(CMAKE_CXX_FLAGS_PROFILING "-g1 -O3 -Wall -DNDEBUG" CACHE STRING "Flags used by the compiler during profiling builds." FORCE) set(CMAKE_EXE_LINKER_FLAGS_PROFILING "${CMAKE_EXE_LINKER_FLAGS_RELEASE}" CACHE STRING "Linker flags during profiling builds." FORCE) set(CMAKE_SHARED_LINKER_FLAGS_PROFILING "${CMAKE__LINKER_FLAGS_RELEASE}" CACHE STRING "Linker flags during profiling builds." FORCE) mark_as_advanced(CMAKE_C_FLAGS_PROFILING CMAKE_CXX_FLAGS_PROFILING CMAKE_EXE_LINKER_FLAGS_PROFILING CMAKE_SHARED_LINKER_FLAGS_PROFILING) From ee274419fb9c8ac0523b2353db619f1550a432e9 Mon Sep 17 00:00:00 2001 From: Richard Roberts Date: Wed, 19 Feb 2014 15:43:25 -0500 Subject: [PATCH 09/11] Documentation improvement --- cmake/GtsamMatlabWrap.cmake | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/cmake/GtsamMatlabWrap.cmake b/cmake/GtsamMatlabWrap.cmake index 1fde266f4..98bd7f469 100644 --- a/cmake/GtsamMatlabWrap.cmake +++ b/cmake/GtsamMatlabWrap.cmake @@ -40,13 +40,21 @@ set(MATLAB_ROOT "${MATLAB_ROOT}" CACHE PATH "Path to MATLAB installation root (e # User-friendly wrapping function. Builds a mex module from the provided -# interfaceHeader. For example, for the interface header /path/to/gtsam.h, +# interfaceHeader. For example, for the interface header gtsam.h, # this will build the wrap module 'gtsam'. -# Params: -# interfaceHeader : Absolute or relative path to the interface definition file -# linkLibraries : All dependent CMake target names, library names, or full library paths -# extraIncludeDirs : Extra include directories, in addition to those already passed to include_directories(...) -# extraMexFlags : Any additional compiler flags +# +# Arguments: +# +# interfaceHeader: The relative 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. function(wrap_and_install_library interfaceHeader linkLibraries extraIncludeDirs extraMexFlags) wrap_library_internal("${interfaceHeader}" "${linkLibraries}" "${extraIncludeDirs}" "${mexFlags}") install_wrapped_library_internal("${interfaceHeader}") From c629339a7ca46e31903392cb1829a482cb76389f Mon Sep 17 00:00:00 2001 From: Richard Roberts Date: Wed, 19 Feb 2014 15:43:37 -0500 Subject: [PATCH 10/11] Added README file for cmake tools --- cmake/CMakeLists.txt | 2 +- cmake/README.html | 92 +++++++++++++++++++++++++++++++++++++ cmake/README.md | 105 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 198 insertions(+), 1 deletion(-) create mode 100644 cmake/README.html create mode 100644 cmake/README.md diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 89cf53898..49069c57f 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -17,10 +17,10 @@ install(FILES GtsamBuildTypes.cmake GtsamMakeConfigFile.cmake GtsamMatlabWrap.cmake - GtsamPrinting.cmake GtsamPythonWrap.cmake GtsamTesting.cmake GtsamTestingObsolete.cmake + README.html DESTINATION "${SCRIPT_INSTALL_DIR}/GTSAMCMakeTools") diff --git a/cmake/README.html b/cmake/README.html new file mode 100644 index 000000000..8170cd489 --- /dev/null +++ b/cmake/README.html @@ -0,0 +1,92 @@ +

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}/bin.
  • +
+

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.

\ No newline at end of file diff --git a/cmake/README.md b/cmake/README.md new file mode 100644 index 000000000..0b9f7e853 --- /dev/null +++ b/cmake/README.md @@ -0,0 +1,105 @@ +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}/bin`. + +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. \ No newline at end of file From 7fa9ca8b9b4c13f22dbe4e871b6c90ee8e06e9da Mon Sep 17 00:00:00 2001 From: Richard Roberts Date: Wed, 19 Feb 2014 15:45:39 -0500 Subject: [PATCH 11/11] Fixed typo --- cmake/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/README.md b/cmake/README.md index 0b9f7e853..34d1ffb52 100644 --- a/cmake/README.md +++ b/cmake/README.md @@ -23,7 +23,7 @@ Including this file immediately sets up the following build types and a drop-dow 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}/bin`. +* 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: