Improved handling of Boost shared libraries on Windows

release/4.3a0
Richard Roberts 2013-02-04 21:28:39 +00:00
parent 40929e9cc3
commit 6572400bc3
3 changed files with 10 additions and 5 deletions

View File

@ -107,8 +107,10 @@ endif()
###############################################################################
# Find boost
if(CYGWIN OR MSVC OR WIN32)
set(Boost_USE_STATIC_LIBS 1) # Use static libs on Windows
# If using Boost shared libs, set up auto linking for shared libs
if(NOT Boost_USE_STATIC_LIBS)
add_definitions(-DBOOST_ALL_DYN_LINK)
endif()
find_package(Boost 1.43 COMPONENTS serialization system filesystem thread date_time regex timer chrono)
@ -122,7 +124,7 @@ endif()
# Allow for not using the timer libraries on boost < 1.48 (GTSAM timing code falls back to old timer library)
set(GTSAM_BOOST_LIBRARIES ${Boost_SERIALIZATION_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${Boost_FILESYSTEM_LIBRARY})
if(Boost_TIMER_LIBRARY)
set(GTSAM_BOOST_LIBRARIES ${GTSAM_BOOST_LIBRARIES} ${Boost_TIMER_LIBRARY} ${Boost_CHRONO_LIBRARY})
list(APPEND GTSAM_BOOST_LIBRARIES ${GTSAM_BOOST_LIBRARIES} ${Boost_TIMER_LIBRARY} ${Boost_CHRONO_LIBRARY})
else()
message("WARNING: Boost older than 1.48 was found, GTSAM timing instrumentation will use the older, less accurate, Boost timer library.")
endif()

View File

@ -10,6 +10,8 @@ set (gtsam_unstable_subdirs
slam
)
set(GTSAM_UNSTABLE_BOOST_LIBRARIES ${GTSAM_BOOST_LIBRARIES} ${Boost_THREAD_LIBRARY})
add_custom_target(check.unstable COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure)
# assemble core libaries
@ -58,7 +60,7 @@ set_target_properties(gtsam_unstable-static PROPERTIES
CLEAN_DIRECT_OUTPUT 1
VERSION ${gtsam_unstable_version}
SOVERSION ${gtsam_unstable_soversion})
target_link_libraries(gtsam_unstable-static gtsam-static)
target_link_libraries(gtsam_unstable-static gtsam-static ${GTSAM_UNSTABLE_BOOST_LIBRARIES})
set(gtsam_unstable-lib "gtsam_unstable-static")
install(TARGETS gtsam_unstable-static EXPORT GTSAM-exports ARCHIVE DESTINATION lib)
list(APPEND GTSAM_EXPORTED_TARGETS gtsam_unstable-static)
@ -72,7 +74,7 @@ if (GTSAM_UNSTABLE_BUILD_SHARED_LIBRARY)
CLEAN_DIRECT_OUTPUT 1
VERSION ${gtsam_unstable_version}
SOVERSION ${gtsam_unstable_soversion})
target_link_libraries(gtsam_unstable-shared gtsam-shared)
target_link_libraries(gtsam_unstable-shared gtsam-shared ${GTSAM_UNSTABLE_BOOST_LIBRARIES})
install(TARGETS gtsam_unstable-shared EXPORT GTSAM-exports LIBRARY DESTINATION lib ARCHIVE DESTINATION lib RUNTIME DESTINATION bin)
list(APPEND GTSAM_EXPORTED_TARGETS gtsam_unstable-shared)
set(GTSAM_EXPORTED_TARGETS "${GTSAM_EXPORTED_TARGETS}" PARENT_SCOPE)

View File

@ -7,6 +7,7 @@ file(GLOB wrap_srcs "*.cpp")
file(GLOB wrap_headers "*.h")
list(REMOVE_ITEM wrap_srcs ${CMAKE_CURRENT_SOURCE_DIR}/wrap.cpp)
add_library(wrap_lib STATIC ${wrap_srcs} ${wrap_headers})
target_link_libraries(wrap_lib ${WRAP_BOOST_LIBRARIES})
gtsam_assign_source_folders(${wrap_srcs} ${wrap_headers})
add_executable(wrap wrap.cpp)
target_link_libraries(wrap wrap_lib ${WRAP_BOOST_LIBRARIES})