Initial changes to compile on windows

release/4.3a0
Richard Roberts 2012-05-22 20:37:13 +00:00
parent 7fc7bd8f4d
commit 2060f1dd22
4 changed files with 14 additions and 8 deletions

View File

@ -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

View File

@ -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)

View File

@ -20,7 +20,6 @@
#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <sys/time.h>
#include <stdlib.h>
#include <boost/foreach.hpp>
#include <boost/format.hpp>
@ -153,15 +152,13 @@ const boost::shared_ptr<TimingOutline>& 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<duration_t>(clock_t::now() - t0_).count());
timerActive_ = false;
}

View File

@ -22,6 +22,7 @@
#include <vector>
#include <boost/shared_ptr.hpp>
#include <boost/weak_ptr.hpp>
#include <boost/chrono.hpp>
class TimingOutline;
extern boost::shared_ptr<TimingOutline> timingRoot;
@ -29,6 +30,9 @@ extern boost::weak_ptr<TimingOutline> 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<TimingOutline> parent_;
std::vector<boost::shared_ptr<TimingOutline> > children_;
struct timeval t0_;
clock_t::time_point t0_;
bool timerActive_;
void add(size_t usecs);