From 099ab88b5db492dcee46c02243f69b79274b05db Mon Sep 17 00:00:00 2001 From: Alex Cunningham Date: Wed, 14 Dec 2011 02:24:19 +0000 Subject: [PATCH] Added more cmake functionality --- .cproject | 31 ++++++++++++++++++++++++++++ CMakeLists.txt | 11 +++++++--- CppUnitLite/CMakeLists.txt | 9 ++++++++ gtsam/CMakeLists.txt | 42 +++++++++++++++++++++++++++++++++----- 4 files changed, 85 insertions(+), 8 deletions(-) create mode 100644 CppUnitLite/CMakeLists.txt diff --git a/.cproject b/.cproject index 35f7946a4..0e31dd254 100644 --- a/.cproject +++ b/.cproject @@ -1617,6 +1617,37 @@ true true + + cmake + .. + true + false + true + + + make + -j2 VERBOSE=1 + all + true + false + true + + + make + -j5 VERBOSE=1 + all + true + false + true + + + make + -j2 + clean + true + true + true + make -j2 diff --git a/CMakeLists.txt b/CMakeLists.txt index d98b500b5..e3a754810 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,6 +21,11 @@ set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DEIGEN_NO_DEBUG") # Configurable Options + +# Pull in tests +ENABLE_TESTING() +INCLUDE(Dart) + # General build settings include_directories(gtsam CppUnitLite) @@ -31,10 +36,10 @@ add_subdirectory(gtsam) add_subdirectory(CppUnitLite) # Build Tests -add_subdirectory(tests) +#add_subdirectory(tests) # Build wrap -add_subdirectory(wrap) +#add_subdirectory(wrap) # Build examples -add_subdirectory(examples) \ No newline at end of file +#add_subdirectory(examples) \ No newline at end of file diff --git a/CppUnitLite/CMakeLists.txt b/CppUnitLite/CMakeLists.txt new file mode 100644 index 000000000..6fba22eac --- /dev/null +++ b/CppUnitLite/CMakeLists.txt @@ -0,0 +1,9 @@ +# Build/install CppUnitLite + +FILE(GLOB cppunitlite_headers "*.h") +FILE(GLOB cppunitlite_src "*.cpp") + +ADD_LIBRARY(CppUnitLite STATIC ${cppunitlite_src}) + +install(FILES ${cppunitlite_headers} DESTINATION include/CppUnitLite) +install(TARGETS CppUnitLite ARCHIVE DESTINATION lib) diff --git a/gtsam/CMakeLists.txt b/gtsam/CMakeLists.txt index 1e40dbb68..a47b0c858 100644 --- a/gtsam/CMakeLists.txt +++ b/gtsam/CMakeLists.txt @@ -1,6 +1,3 @@ -# build 3rd party libraries -add_subdirectory(3rdparty) - # Build full gtsam library as a single library # and also build tests set (gtsam_subdirs @@ -11,8 +8,43 @@ set (gtsam_subdirs nonlinear slam) +# Include CCOLAMD source directly into gtsam +include_directories( + 3rdparty/UFconfig + 3rdparty/CCOLAMD/Include + ${CMAKE_SOURCE_DIR}) + +set (ccolamd_srcs + 3rdparty/CCOLAMD/Source/ccolamd.c + 3rdparty/CCOLAMD/Source/ccolamd_global.c + 3rdparty/UFconfig/UFconfig.c) + +set(gtsam_srcs ${ccolamd_srcs}) + +add_library(ccolamd STATIC ${ccolamd_srcs}) + +# Get all sources and headers from each foreach(subdir ${gtsam_subdirs}) - file(GLOB sub_gtsam_srcs ${subdir} "*.cpp") - list(APPEND gtsam_srcs sub_gtsam_srcs) + message(STATUS "Building ${subdir}") + file(GLOB sub_gtsam_srcs "${subdir}/*.cpp") + list(APPEND gtsam_srcs ${sub_gtsam_srcs}) + + # Make a convenience library + add_library(${subdir} STATIC ${sub_gtsam_srcs}) + list(APPEND inner_libs ${subdir}) + + # Build tests + file(GLOB tests_srcs "${subdir}/tests/test*.cpp") + foreach(test_src ${tests_srcs}) + get_filename_component(test_base ${test_src} NAME_WE) + set( test_bin ${EXECUTABLE_OUTPUT_PATH}/${subdir}/${test_base} ) + add_executable(${test_bin} ${test_src}) + #add_test(${subdir}/${test_base} ${subdir}/${test_base}) + #target_link_libraries(${subdir}/${test_base} ${inner_libs} CppUnitLite ccolamd) + #add_custom_target(${test_base}.run ${EXECUTABLE_OUTPUT_PATH}/${test_base} ${ARGN}) + endforeach(test_src) endforeach(subdir) +# build a single shared library +add_library(gtsam SHARED ${gtsam_srcs}) +