Link with TBB and use auto-generated dllexport.h

release/4.3a0
Richard Roberts 2013-07-09 17:50:24 +00:00
parent 21f8079924
commit 57193a7f65
3 changed files with 25 additions and 51 deletions

View File

@ -155,6 +155,22 @@ configure_file(gtsam/3rdparty/gtsam_eigen_includes.h.in gtsam/3rdparty/gtsam_eig
install(FILES ${CMAKE_BINARY_DIR}/gtsam/3rdparty/gtsam_eigen_includes.h DESTINATION include/gtsam/3rdparty)
###############################################################################
# Find TBB
set(ENV{TBB_ARCH_PLATFORM} "intel64/vc11")
set(ENV{TBB_BIN_DIR} "C:/Program Files/Intel/TBB/bin")
set(ENV{TBB_TARGET_ARCH} intel64)
set(ENV{TBB_TARGET_VS} vc11)
find_package(TBB REQUIRED)
set(TBB_LIBS "")
foreach(lib ${TBB_LIBRARIES})
list(APPEND TBB_LIBS optimized "${lib}")
endforeach()
foreach(lib ${TBB_DEBUG_LIBRARIES})
list(APPEND TBB_LIBS debug "${lib}")
endforeach()
###############################################################################
# Global compile options

View File

@ -88,6 +88,13 @@ set(gtsam_srcs
${navigation_srcs}
${gtsam_core_headers}
)
# Generate and install config and dllexport files
configure_file(config.h.in config.h)
set(library_name GTSAM) # For substitution in dllexport.h.in
configure_file("${PROJECT_SOURCE_DIR}/cmake/dllexport.h.in" "dllexport.h")
list(APPEND gtsam_srcs "${CMAKE_BINARY_DIR}/gtsam/config.h" "${CMAKE_BINARY_DIR}/gtsam/dllexport.h")
install(FILES "${CMAKE_BINARY_DIR}/gtsam/config.h" "${CMAKE_BINARY_DIR}/gtsam/dllexport.h" DESTINATION include/gtsam)
# Versions
set(gtsam_version ${GTSAM_VERSION_MAJOR}.${GTSAM_VERSION_MINOR}.${GTSAM_VERSION_PATCH})
@ -99,7 +106,7 @@ message(STATUS "Install prefix: ${CMAKE_INSTALL_PREFIX}")
if (GTSAM_BUILD_STATIC_LIBRARY)
message(STATUS "Building GTSAM - static")
add_library(gtsam-static STATIC ${gtsam_srcs})
target_link_libraries(gtsam-static ${GTSAM_BOOST_LIBRARIES})
target_link_libraries(gtsam-static ${GTSAM_BOOST_LIBRARIES} ${TBB_LIBS})
set_target_properties(gtsam-static PROPERTIES
OUTPUT_NAME gtsam
CLEAN_DIRECT_OUTPUT 1
@ -118,7 +125,7 @@ endif ()
if (GTSAM_BUILD_SHARED_LIBRARY)
message(STATUS "Building GTSAM - shared")
add_library(gtsam-shared SHARED ${gtsam_srcs})
target_link_libraries(gtsam-shared ${GTSAM_BOOST_LIBRARIES})
target_link_libraries(gtsam-shared ${GTSAM_BOOST_LIBRARIES} ${TBB_LIBS})
set_target_properties(gtsam-shared PROPERTIES
OUTPUT_NAME gtsam
CLEAN_DIRECT_OUTPUT 1
@ -146,10 +153,6 @@ if(MSVC)
set_property(SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/slam/serialization.cpp"
APPEND PROPERTY COMPILE_FLAGS "/bigobj")
endif()
# Generate and install config file
configure_file(config.h.in config.h)
install(FILES ${CMAKE_BINARY_DIR}/gtsam/config.h DESTINATION include/gtsam)
# Create the matlab toolbox for the gtsam library
if (GTSAM_INSTALL_MATLAB_TOOLBOX)

View File

@ -1,45 +0,0 @@
/* ----------------------------------------------------------------------------
* GTSAM Copyright 2010, Georgia Tech Research Corporation,
* Atlanta, Georgia 30332-0415
* All Rights Reserved
* Authors: Frank Dellaert, et al. (see THANKS for the full author list)
* See LICENSE for the license information
* -------------------------------------------------------------------------- */
/**
* @file dllexport.h
* @brief Symbols for exporting classes and methods from DLLs
* @author Richard Roberts
* @date Mar 9, 2013
*/
// Macros for exporting DLL symbols on Windows
// Usage example:
// In header file:
// class GTSAM_EXPORT MyClass { ... };
//
// Results in the following declarations:
// When included while compiling the GTSAM library itself:
// class __declspec(dllexport) MyClass { ... };
// When included while compiling other code against GTSAM:
// class __declspec(dllimport) MyClass { ... };
#ifdef _WIN32
# ifdef GTSAM_EXPORTS
# define GTSAM_EXPORT __declspec(dllexport)
# define GTSAM_EXTERN_EXPORT __declspec(dllexport) extern
# else
# ifndef GTSAM_IMPORT_STATIC
# define GTSAM_EXPORT __declspec(dllimport)
# define GTSAM_EXTERN_EXPORT __declspec(dllimport)
# else /* GTSAM_IMPORT_STATIC */
# define GTSAM_EXPORT
# define GTSAM_EXTERN_EXPORT extern
# endif /* GTSAM_IMPORT_STATIC */
# endif /* GTSAM_EXPORTS */
#else /* _WIN32 */
# define GTSAM_EXPORT
# define GTSAM_EXTERN_EXPORT extern
#endif