From 57193a7f65e29a188b2677a0aeb6abc47293dd40 Mon Sep 17 00:00:00 2001 From: Richard Roberts Date: Tue, 9 Jul 2013 17:50:24 +0000 Subject: [PATCH] Link with TBB and use auto-generated dllexport.h --- CMakeLists.txt | 16 ++++++++++++++++ gtsam/CMakeLists.txt | 15 +++++++++------ gtsam/dllexport.h | 45 -------------------------------------------- 3 files changed, 25 insertions(+), 51 deletions(-) delete mode 100644 gtsam/dllexport.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 7096eaa44..3352f6ec2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 diff --git a/gtsam/CMakeLists.txt b/gtsam/CMakeLists.txt index a1ae94f9a..6e283ae72 100644 --- a/gtsam/CMakeLists.txt +++ b/gtsam/CMakeLists.txt @@ -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) diff --git a/gtsam/dllexport.h b/gtsam/dllexport.h deleted file mode 100644 index 008d59c92..000000000 --- a/gtsam/dllexport.h +++ /dev/null @@ -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