diff --git a/CMakeLists.txt b/CMakeLists.txt index 5d2acb464..8bdbc486a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,7 +15,7 @@ include(GtsamTesting) include(GtsamPrinting) # guard against in-source builds -if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) +if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR} AND NOT MSVC) message(FATAL_ERROR "In-source builds not allowed. Please make a new directory (called a build directory) and run CMake from there. You may need to remove CMakeCache.txt. ") endif() @@ -94,6 +94,9 @@ if (GTSAM_BUILD_TESTS) endif() # Find boost +if(MSVC) + set(Boost_USE_STATIC_LIBS 1) +endif() find_package(Boost 1.40 COMPONENTS serialization REQUIRED) # General build settings diff --git a/gtsam/CMakeLists.txt b/gtsam/CMakeLists.txt index b3e639917..2adc83365 100644 --- a/gtsam/CMakeLists.txt +++ b/gtsam/CMakeLists.txt @@ -71,6 +71,8 @@ set(gtsam_srcs ${slam_srcs} ) +#gtsam_assign_source_folders("${gtsam_srcs}") + # Versions set(gtsam_version ${GTSAM_VERSION_MAJOR}.${GTSAM_VERSION_MINOR}.${GTSAM_VERSION_PATCH}) set(gtsam_soversion ${GTSAM_VERSION_MAJOR}) @@ -97,6 +99,6 @@ if (GTSAM_BUILD_SHARED_LIBRARY) CLEAN_DIRECT_OUTPUT 1 VERSION ${gtsam_version} SOVERSION ${gtsam_soversion}) - install(TARGETS gtsam-shared LIBRARY DESTINATION lib ) + install(TARGETS gtsam-shared LIBRARY DESTINATION lib ARCHIVE DESTINATION lib RUNTIME DESTINATION bin) endif(GTSAM_BUILD_SHARED_LIBRARY) diff --git a/gtsam/base/timing.cpp b/gtsam/base/timing.cpp index 1388c2f18..393791e6a 100644 --- a/gtsam/base/timing.cpp +++ b/gtsam/base/timing.cpp @@ -20,7 +20,6 @@ #include #include #include -#include #include #include #include @@ -153,15 +152,13 @@ const boost::shared_ptr& TimingOutline::child(size_t child, const void TimingOutline::tic() { assert(!timerActive_); timerActive_ = true; - gettimeofday(&t0_, NULL); + t0_ = clock_t::now(); } /* ************************************************************************* */ void TimingOutline::toc() { - struct timeval t; - gettimeofday(&t, NULL); assert(timerActive_); - add(t.tv_sec*1000000 + t.tv_usec - (t0_.tv_sec*1000000 + t0_.tv_usec)); + add(boost::chrono::duration_cast(clock_t::now() - t0_).count()); timerActive_ = false; } diff --git a/gtsam/base/timing.h b/gtsam/base/timing.h index 94498c3b3..56ac1a762 100644 --- a/gtsam/base/timing.h +++ b/gtsam/base/timing.h @@ -22,6 +22,7 @@ #include #include #include +#include class TimingOutline; extern boost::shared_ptr timingRoot; @@ -29,6 +30,9 @@ extern boost::weak_ptr timingCurrent; class TimingOutline { protected: + typedef boost::chrono::high_resolution_clock clock_t; + typedef boost::chrono::microseconds duration_t; + size_t t_; double t2_ ; /* cache the \sum t_i^2 */ size_t tIt_; @@ -39,7 +43,7 @@ protected: boost::weak_ptr parent_; std::vector > children_; - struct timeval t0_; + clock_t::time_point t0_; bool timerActive_; void add(size_t usecs);