From 910beebb8fe6af2c9db6abe28c783def98f4d304 Mon Sep 17 00:00:00 2001 From: Alex Cunningham Date: Tue, 31 Jan 2012 05:28:03 +0000 Subject: [PATCH] Added wrap to build, assorted cleanup --- .cproject | 16 ++++++++++++++++ CMakeLists.txt | 21 ++++++++------------- tests/CMakeLists.txt | 1 - wrap/CMakeLists.txt | 18 ++++++++++++------ 4 files changed, 36 insertions(+), 20 deletions(-) diff --git a/.cproject b/.cproject index 78cc6a563..61f731517 100644 --- a/.cproject +++ b/.cproject @@ -1874,6 +1874,22 @@ true true + + make + -j2 + wrap + true + true + true + + + make + -j2 + check.wrap + true + true + true + make -j2 diff --git a/CMakeLists.txt b/CMakeLists.txt index 591f0c4bc..071be753c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,15 +23,10 @@ if( NOT cmake_build_type_tolower STREQUAL "debug" message(FATAL_ERROR "Unknown build type \"${CMAKE_BUILD_TYPE}\". Allowed values are Debug, Release, RelWithDebInfo (case-insensitive).") endif() -# Turn off function inlining when debugging -set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -fno-inline -Wall") -set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-inline -Wall") -# No optimization in relwithdebinfo -set(CMAKE_C_FLAGS_RELWITHDEBINFO "-g -fno-inline -Wall") -set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g -fno-inline -Wall") -# Eigen no debug in release mode -set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DEIGEN_NO_DEBUG") -set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DEIGEN_NO_DEBUG") +# Add debugging flags +set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-inline -Wall") +set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g -fno-inline -Wall -DNDEBUG") +set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DNDEBUG -Wall") # Configurable Options # TODO @@ -57,17 +52,17 @@ include_directories( ${BOOST_INCLUDE_DIR}) link_directories(${Boost_LIBRARY_DIRS}) -# Build GTSAM library -add_subdirectory(gtsam) - # Build CppUnitLite add_subdirectory(CppUnitLite) +# Build GTSAM library +add_subdirectory(gtsam) + # Build Tests add_subdirectory(tests) # Build wrap -#add_subdirectory(wrap) +add_subdirectory(wrap) # Build examples add_subdirectory(examples) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 5aa278169..234c321d3 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -28,4 +28,3 @@ foreach(time_src ${timing_srcs}) target_link_libraries(${time_bin} gtsam-static CppUnitLite ${Boost_LIBRARIES}) add_custom_target(${time_bin}.run ${EXECUTABLE_OUTPUT_PATH}${time_bin} ${ARGN}) endforeach(time_src) - diff --git a/wrap/CMakeLists.txt b/wrap/CMakeLists.txt index 08f9b63c0..4583ac007 100644 --- a/wrap/CMakeLists.txt +++ b/wrap/CMakeLists.txt @@ -3,11 +3,19 @@ # Build the executable itself file(GLOB wrap_srcs "*.cpp") list(REMOVE_ITEM wrap_srcs wrap.cpp) -add_library(wrapLib STATIC ${wrap_srcs}) +add_library(wrap_lib STATIC ${wrap_srcs}) add_executable(wrap wrap.cpp) -target_link_libraries(wrap wrapLib) +target_link_libraries(wrap wrap_lib) + +# Install wrap binary install(TARGETS wrap DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) +# Install matlab header +install(FILES matlab.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include/wrap) + +# Build tests +add_custom_target(check.wrap COMMAND ${CMAKE_CTEST_COMMAND}) + # Build tests file(GLOB wrap_test_srcs "tests/test*.cpp") add_definitions(-DTOPSRCDIR="${CMAKE_SOURCE_DIR}") @@ -17,9 +25,7 @@ foreach(test_src ${wrap_test_srcs} ) add_executable(${test_bin} EXCLUDE_FROM_ALL ${test_src}) add_test(${test_base} ${EXECUTABLE_OUTPUT_PATH}${test_bin}) add_dependencies(check ${test_bin}) - target_link_libraries(${test_bin} CppUnitLite gtsam-static wrapLib) + add_dependencies(check.wrap ${test_bin}) + target_link_libraries(${test_bin} CppUnitLite gtsam-static wrap_lib) add_custom_target(${test_bin}.run ${EXECUTABLE_OUTPUT_PATH}${test_bin} ${ARGN}) endforeach(test_src) - -# Install matlab header -install(FILES matlab.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include/wrap)