Added support for timing scripts to build tools
parent
996517916c
commit
17c7e02003
|
@ -46,7 +46,6 @@ endif()
|
||||||
# Set up options
|
# Set up options
|
||||||
|
|
||||||
# Configurable Options
|
# Configurable Options
|
||||||
option(GTSAM_BUILD_TIMING "Enable/Disable building of timing scripts" OFF) # These do not currently work
|
|
||||||
if(GTSAM_UNSTABLE_AVAILABLE)
|
if(GTSAM_UNSTABLE_AVAILABLE)
|
||||||
option(GTSAM_BUILD_UNSTABLE "Enable/Disable libgtsam_unstable" ON)
|
option(GTSAM_BUILD_UNSTABLE "Enable/Disable libgtsam_unstable" ON)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -38,21 +38,46 @@ endmacro()
|
||||||
#
|
#
|
||||||
# Add scripts that will serve as examples of how to use the library. A list of files or
|
# 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
|
# 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
|
# file. These executables will not be installed. They are built with 'make all' if
|
||||||
# GTSAM_BUILD_EXAMPLES_ALWAYS is enabled. They may also be built with 'make examples'.
|
# GTSAM_BUILD_EXAMPLES_ALWAYS is enabled. They may also be built with 'make examples'.
|
||||||
#
|
#
|
||||||
# Usage example:
|
# Usage example:
|
||||||
# gtsamAddExamplesGlob("*.cpp" "BrokenExample.cpp" "gtsam;GeographicLib")
|
# gtsamAddExamplesGlob("*.cpp" "BrokenExample.cpp" "gtsam;GeographicLib")
|
||||||
#
|
#
|
||||||
# Arguments:
|
# Arguments:
|
||||||
# globPatterns: The list of files or glob patterns from which to create unit tests, with
|
# globPatterns: The list of files or glob patterns from which to create examples, with
|
||||||
# one test created for each cpp file. e.g. "*.cpp", or
|
# one program created for each cpp file. e.g. "*.cpp", or
|
||||||
# "A*.cpp;B*.cpp;MyExample.cpp".
|
# "A*.cpp;B*.cpp;MyExample.cpp".
|
||||||
# excludedFiles: A list of files or globs to exclude, e.g. "C*.cpp;BrokenExample.cpp". Pass
|
# 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.
|
# an empty string "" if nothing needs to be excluded.
|
||||||
# linkLibraries: The list of libraries to link to.
|
# linkLibraries: The list of libraries to link to.
|
||||||
macro(gtsamAddExamplesGlob globPatterns excludedFiles linkLibraries)
|
macro(gtsamAddExamplesGlob globPatterns excludedFiles linkLibraries)
|
||||||
gtsamAddExamplesGlob_impl("${globPatterns}" "${excludedFiles}" "${linkLibraries}")
|
gtsamAddExesGlob_impl("${globPatterns}" "${excludedFiles}" "${linkLibraries}" "examples" "${GTSAM_BUILD_EXAMPLES_ALWAYS}")
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Macro:
|
||||||
|
#
|
||||||
|
# gtsamAddTimingGlob(globPatterns excludedFiles linkLibraries)
|
||||||
|
#
|
||||||
|
# Add scripts that time aspects of 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 not built with 'make all',
|
||||||
|
# but they may be built with 'make timing'.
|
||||||
|
#
|
||||||
|
# Usage example:
|
||||||
|
# gtsamAddTimingGlob("*.cpp" "DisabledTimingScript.cpp" "gtsam;GeographicLib")
|
||||||
|
#
|
||||||
|
# Arguments:
|
||||||
|
# globPatterns: The list of files or glob patterns from which to create programs, with
|
||||||
|
# one program 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.
|
||||||
|
macro(gtsamAddTimingGlob globPatterns excludedFiles linkLibraries)
|
||||||
|
gtsamAddExesGlob_impl("${globPatterns}" "${excludedFiles}" "${linkLibraries}" "timing" "FALSE")
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
|
|
||||||
|
@ -63,6 +88,7 @@ enable_testing()
|
||||||
|
|
||||||
option(GTSAM_BUILD_TESTS "Enable/Disable building of tests" ON)
|
option(GTSAM_BUILD_TESTS "Enable/Disable building of tests" ON)
|
||||||
option(GTSAM_BUILD_EXAMPLES_ALWAYS "Build examples with 'make all' (build with 'make examples' if not)" ON)
|
option(GTSAM_BUILD_EXAMPLES_ALWAYS "Build examples with 'make all' (build with 'make examples' if not)" ON)
|
||||||
|
option(GTSAM_BUILD_TIMING "Enable/Disable building of timing scripts" OFF) # These do not currently work
|
||||||
|
|
||||||
# Add option for combining unit tests
|
# Add option for combining unit tests
|
||||||
if(MSVC OR XCODE_VERSION)
|
if(MSVC OR XCODE_VERSION)
|
||||||
|
@ -80,6 +106,11 @@ endif()
|
||||||
# Add examples target
|
# Add examples target
|
||||||
add_custom_target(examples)
|
add_custom_target(examples)
|
||||||
|
|
||||||
|
# Add timing target
|
||||||
|
if(GTSAM_BUILD_TIMING)
|
||||||
|
add_custom_target(timing)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Include obsolete macros - will be removed in the near future
|
# Include obsolete macros - will be removed in the near future
|
||||||
include(GtsamTestingObsolete)
|
include(GtsamTestingObsolete)
|
||||||
|
|
||||||
|
@ -180,7 +211,7 @@ macro(gtsamAddTestsGlob_impl groupName globPatterns excludedFiles linkLibraries)
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
|
|
||||||
macro(gtsamAddExamplesGlob_impl globPatterns excludedFiles linkLibraries)
|
macro(gtsamAddExesGlob_impl globPatterns excludedFiles linkLibraries groupName buildWithAll)
|
||||||
# Get all script files
|
# Get all script files
|
||||||
file(GLOB script_files ${globPatterns})
|
file(GLOB script_files ${globPatterns})
|
||||||
|
|
||||||
|
@ -220,7 +251,7 @@ macro(gtsamAddExamplesGlob_impl globPatterns excludedFiles linkLibraries)
|
||||||
target_link_libraries(${script_name} ${linkLibraries})
|
target_link_libraries(${script_name} ${linkLibraries})
|
||||||
|
|
||||||
# Add target dependencies
|
# Add target dependencies
|
||||||
add_dependencies(examples ${script_name})
|
add_dependencies(${groupName} ${script_name})
|
||||||
if(NOT MSVC AND NOT XCODE_VERSION)
|
if(NOT MSVC AND NOT XCODE_VERSION)
|
||||||
add_custom_target(${script_name}.run ${EXECUTABLE_OUTPUT_PATH}${script_name})
|
add_custom_target(${script_name}.run ${EXECUTABLE_OUTPUT_PATH}${script_name})
|
||||||
endif()
|
endif()
|
||||||
|
@ -228,12 +259,12 @@ macro(gtsamAddExamplesGlob_impl globPatterns excludedFiles linkLibraries)
|
||||||
# Add TOPSRCDIR
|
# Add TOPSRCDIR
|
||||||
set_property(SOURCE ${script_src} APPEND PROPERTY COMPILE_DEFINITIONS "TOPSRCDIR=\"${PROJECT_SOURCE_DIR}\"")
|
set_property(SOURCE ${script_src} APPEND PROPERTY COMPILE_DEFINITIONS "TOPSRCDIR=\"${PROJECT_SOURCE_DIR}\"")
|
||||||
|
|
||||||
if(NOT GTSAM_BUILD_EXAMPLES_ALWAYS)
|
if(NOT buildWithAll)
|
||||||
# Exclude from 'make all' and 'make install'
|
# Exclude from 'make all' and 'make install'
|
||||||
set_target_properties(${target_name} PROPERTIES EXCLUDE_FROM_ALL ON)
|
set_target_properties(${target_name} PROPERTIES EXCLUDE_FROM_ALL ON)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Configure target folder (for MSVC and Xcode)
|
# Configure target folder (for MSVC and Xcode)
|
||||||
set_property(TARGET ${script_name} PROPERTY FOLDER "Examples")
|
set_property(TARGET ${script_name} PROPERTY FOLDER "${groupName}")
|
||||||
endforeach()
|
endforeach()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
Loading…
Reference in New Issue