Initial changes to compile on windows
parent
7fc7bd8f4d
commit
2060f1dd22
|
@ -15,7 +15,7 @@ include(GtsamTesting)
|
||||||
include(GtsamPrinting)
|
include(GtsamPrinting)
|
||||||
|
|
||||||
# guard against in-source builds
|
# 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. ")
|
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()
|
endif()
|
||||||
|
|
||||||
|
@ -94,6 +94,9 @@ if (GTSAM_BUILD_TESTS)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Find boost
|
# Find boost
|
||||||
|
if(MSVC)
|
||||||
|
set(Boost_USE_STATIC_LIBS 1)
|
||||||
|
endif()
|
||||||
find_package(Boost 1.40 COMPONENTS serialization REQUIRED)
|
find_package(Boost 1.40 COMPONENTS serialization REQUIRED)
|
||||||
|
|
||||||
# General build settings
|
# General build settings
|
||||||
|
|
|
@ -71,6 +71,8 @@ set(gtsam_srcs
|
||||||
${slam_srcs}
|
${slam_srcs}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
#gtsam_assign_source_folders("${gtsam_srcs}")
|
||||||
|
|
||||||
# Versions
|
# Versions
|
||||||
set(gtsam_version ${GTSAM_VERSION_MAJOR}.${GTSAM_VERSION_MINOR}.${GTSAM_VERSION_PATCH})
|
set(gtsam_version ${GTSAM_VERSION_MAJOR}.${GTSAM_VERSION_MINOR}.${GTSAM_VERSION_PATCH})
|
||||||
set(gtsam_soversion ${GTSAM_VERSION_MAJOR})
|
set(gtsam_soversion ${GTSAM_VERSION_MAJOR})
|
||||||
|
@ -97,6 +99,6 @@ if (GTSAM_BUILD_SHARED_LIBRARY)
|
||||||
CLEAN_DIRECT_OUTPUT 1
|
CLEAN_DIRECT_OUTPUT 1
|
||||||
VERSION ${gtsam_version}
|
VERSION ${gtsam_version}
|
||||||
SOVERSION ${gtsam_soversion})
|
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)
|
endif(GTSAM_BUILD_SHARED_LIBRARY)
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <sys/time.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <boost/foreach.hpp>
|
#include <boost/foreach.hpp>
|
||||||
#include <boost/format.hpp>
|
#include <boost/format.hpp>
|
||||||
|
@ -153,15 +152,13 @@ const boost::shared_ptr<TimingOutline>& TimingOutline::child(size_t child, const
|
||||||
void TimingOutline::tic() {
|
void TimingOutline::tic() {
|
||||||
assert(!timerActive_);
|
assert(!timerActive_);
|
||||||
timerActive_ = true;
|
timerActive_ = true;
|
||||||
gettimeofday(&t0_, NULL);
|
t0_ = clock_t::now();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
void TimingOutline::toc() {
|
void TimingOutline::toc() {
|
||||||
struct timeval t;
|
|
||||||
gettimeofday(&t, NULL);
|
|
||||||
assert(timerActive_);
|
assert(timerActive_);
|
||||||
add(t.tv_sec*1000000 + t.tv_usec - (t0_.tv_sec*1000000 + t0_.tv_usec));
|
add(boost::chrono::duration_cast<duration_t>(clock_t::now() - t0_).count());
|
||||||
timerActive_ = false;
|
timerActive_ = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <boost/shared_ptr.hpp>
|
#include <boost/shared_ptr.hpp>
|
||||||
#include <boost/weak_ptr.hpp>
|
#include <boost/weak_ptr.hpp>
|
||||||
|
#include <boost/chrono.hpp>
|
||||||
|
|
||||||
class TimingOutline;
|
class TimingOutline;
|
||||||
extern boost::shared_ptr<TimingOutline> timingRoot;
|
extern boost::shared_ptr<TimingOutline> timingRoot;
|
||||||
|
@ -29,6 +30,9 @@ extern boost::weak_ptr<TimingOutline> timingCurrent;
|
||||||
|
|
||||||
class TimingOutline {
|
class TimingOutline {
|
||||||
protected:
|
protected:
|
||||||
|
typedef boost::chrono::high_resolution_clock clock_t;
|
||||||
|
typedef boost::chrono::microseconds duration_t;
|
||||||
|
|
||||||
size_t t_;
|
size_t t_;
|
||||||
double t2_ ; /* cache the \sum t_i^2 */
|
double t2_ ; /* cache the \sum t_i^2 */
|
||||||
size_t tIt_;
|
size_t tIt_;
|
||||||
|
@ -39,7 +43,7 @@ protected:
|
||||||
|
|
||||||
boost::weak_ptr<TimingOutline> parent_;
|
boost::weak_ptr<TimingOutline> parent_;
|
||||||
std::vector<boost::shared_ptr<TimingOutline> > children_;
|
std::vector<boost::shared_ptr<TimingOutline> > children_;
|
||||||
struct timeval t0_;
|
clock_t::time_point t0_;
|
||||||
bool timerActive_;
|
bool timerActive_;
|
||||||
|
|
||||||
void add(size_t usecs);
|
void add(size_t usecs);
|
||||||
|
|
Loading…
Reference in New Issue