Make building of metis/partition optional via cmake flag

release/4.3a0
Andrew Melim 2014-04-04 15:49:04 -04:00
parent 49c11e8fa7
commit e98b90bd2a
4 changed files with 25 additions and 15 deletions

View File

@ -25,8 +25,11 @@ if(NOT GTSAM_USE_SYSTEM_EIGEN)
FILES_MATCHING PATTERN "*.h") FILES_MATCHING PATTERN "*.h")
endif() endif()
option(GTSAM_BUILD_METIS "Build metis library" ON)
option(GTSAM_BUILD_METIS_EXECUTABLES "Build metis library executables" OFF) option(GTSAM_BUILD_METIS_EXECUTABLES "Build metis library executables" OFF)
add_subdirectory(metis-5.1.0) if(GTSAM_BUILD_METIS)
add_subdirectory(metis-5.1.0)
endif(GTSAM_BUILD_METIS)
############ NOTE: When updating GeographicLib be sure to disable building their examples ############ NOTE: When updating GeographicLib be sure to disable building their examples
############ and unit tests by commenting out their lines: ############ and unit tests by commenting out their lines:
# add_subdirectory (examples) # add_subdirectory (examples)

View File

@ -8,6 +8,7 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
endif() endif()
add_definitions(-Wno-unknown-pragmas) add_definitions(-Wno-unknown-pragmas)
add_definitions(-Wunused-but-set-variable)
set(GKLIB_PATH ${PROJECT_SOURCE_DIR}/GKlib CACHE PATH "path to GKlib") set(GKLIB_PATH ${PROJECT_SOURCE_DIR}/GKlib CACHE PATH "path to GKlib")
set(SHARED FALSE CACHE BOOL "build a shared library") set(SHARED FALSE CACHE BOOL "build a shared library")

View File

@ -1,15 +1,18 @@
# Build full gtsam_unstable library as a single library # Build full gtsam_unstable library as a single library
# and also build tests # and also build tests
set (gtsam_unstable_subdirs set (gtsam_unstable_subdirs
base base
geometry geometry
discrete discrete
dynamics dynamics
nonlinear nonlinear
partition
slam slam
) )
if(GTSAM_BUILD_METIS) # Only build partition if metis is built
set (gtsam_unstable_subdirs ${gtsam_unstable_subdirs} partition)
endif(GTSAM_BUILD_METIS)
set(GTSAM_UNSTABLE_BOOST_LIBRARIES ${GTSAM_BOOST_LIBRARIES}) set(GTSAM_UNSTABLE_BOOST_LIBRARIES ${GTSAM_BOOST_LIBRARIES})
add_custom_target(check.unstable COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure) add_custom_target(check.unstable COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure)
@ -22,7 +25,7 @@ set (excluded_sources # "")
) )
set (excluded_headers # "") set (excluded_headers # "")
"${CMAKE_CURRENT_SOURCE_DIR}/slam/serialization.h" "${CMAKE_CURRENT_SOURCE_DIR}/slam/serialization.h"
) )
# assemble core libaries # assemble core libaries
@ -36,32 +39,35 @@ foreach(subdir ${gtsam_unstable_subdirs})
gtsam_assign_source_folders("${${subdir}_srcs}") # Create MSVC structure gtsam_assign_source_folders("${${subdir}_srcs}") # Create MSVC structure
# Build local library and tests # Build local library and tests
message(STATUS "Building ${subdir}_unstable") message(STATUS "Building ${subdir}_unstable")
add_subdirectory(${subdir}) add_subdirectory(${subdir})
endforeach(subdir) endforeach(subdir)
# assemble gtsam_unstable components # assemble gtsam_unstable components
set(gtsam_unstable_srcs set(gtsam_unstable_srcs
${base_srcs} ${base_srcs}
${geometry_srcs} ${geometry_srcs}
${discrete_srcs} ${discrete_srcs}
${dynamics_srcs} ${dynamics_srcs}
${nonlinear_srcs} ${nonlinear_srcs}
${partition_srcs}
${slam_srcs} ${slam_srcs}
) )
if(GTSAM_BUILD_METIS) # Only build partition if metis is built
set (gtsam_unstable_srcs ${gtsam_unstable_srcs} ${partition_srcs})
endif(GTSAM_BUILD_METIS)
# Versions - same as core gtsam library # Versions - same as core gtsam library
set(gtsam_unstable_version ${GTSAM_VERSION_MAJOR}.${GTSAM_VERSION_MINOR}.${GTSAM_VERSION_PATCH}) set(gtsam_unstable_version ${GTSAM_VERSION_MAJOR}.${GTSAM_VERSION_MINOR}.${GTSAM_VERSION_PATCH})
set(gtsam_unstable_soversion ${GTSAM_VERSION_MAJOR}) set(gtsam_unstable_soversion ${GTSAM_VERSION_MAJOR})
message(STATUS "GTSAM_UNSTABLE Version: ${gtsam_unstable_version}") message(STATUS "GTSAM_UNSTABLE Version: ${gtsam_unstable_version}")
message(STATUS "Install prefix: ${CMAKE_INSTALL_PREFIX}") message(STATUS "Install prefix: ${CMAKE_INSTALL_PREFIX}")
# build shared and static versions of the library # build shared and static versions of the library
if (GTSAM_BUILD_STATIC_LIBRARY) if (GTSAM_BUILD_STATIC_LIBRARY)
message(STATUS "Building GTSAM_UNSTABLE - static") message(STATUS "Building GTSAM_UNSTABLE - static")
add_library(gtsam_unstable STATIC ${gtsam_unstable_srcs}) add_library(gtsam_unstable STATIC ${gtsam_unstable_srcs})
set_target_properties(gtsam_unstable PROPERTIES set_target_properties(gtsam_unstable PROPERTIES
OUTPUT_NAME gtsam_unstable OUTPUT_NAME gtsam_unstable
CLEAN_DIRECT_OUTPUT 1 CLEAN_DIRECT_OUTPUT 1
VERSION ${gtsam_unstable_version} VERSION ${gtsam_unstable_version}
@ -78,7 +84,7 @@ if (GTSAM_BUILD_STATIC_LIBRARY)
else() else()
message(STATUS "Building GTSAM_UNSTABLE - shared") message(STATUS "Building GTSAM_UNSTABLE - shared")
add_library(gtsam_unstable SHARED ${gtsam_unstable_srcs}) add_library(gtsam_unstable SHARED ${gtsam_unstable_srcs})
set_target_properties(gtsam_unstable PROPERTIES set_target_properties(gtsam_unstable PROPERTIES
OUTPUT_NAME gtsam_unstable OUTPUT_NAME gtsam_unstable
CLEAN_DIRECT_OUTPUT 1 CLEAN_DIRECT_OUTPUT 1
VERSION ${gtsam_unstable_version} VERSION ${gtsam_unstable_version}
@ -99,7 +105,7 @@ endif()
if (GTSAM_INSTALL_MATLAB_TOOLBOX) if (GTSAM_INSTALL_MATLAB_TOOLBOX)
# Set up codegen # Set up codegen
include(GtsamMatlabWrap) include(GtsamMatlabWrap)
# Generate, build and install toolbox # Generate, build and install toolbox
set(mexFlags "${GTSAM_BUILD_MEX_BINARY_FLAGS}") set(mexFlags "${GTSAM_BUILD_MEX_BINARY_FLAGS}")
if(GTSAM_BUILD_STATIC_LIBRARY) if(GTSAM_BUILD_STATIC_LIBRARY)

View File

@ -4,4 +4,4 @@ install(FILES ${partition_headers} DESTINATION include/gtsam_unstable/parition)
set(ignore_test "tests/testNestedDissection.cpp") set(ignore_test "tests/testNestedDissection.cpp")
# Add all tests # Add all tests
gtsamAddTestsGlob(partition_unstable "tests/*.cpp" "${ignore_test}" "gtsam_unstable;metis") gtsamAddTestsGlob(partition_unstable "tests/*.cpp" "${ignore_test}" "gtsam_unstable;metis")