Link with TBB and use auto-generated dllexport.h
parent
21f8079924
commit
57193a7f65
|
@ -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)
|
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
|
# Global compile options
|
||||||
|
|
||||||
|
|
|
@ -89,6 +89,13 @@ set(gtsam_srcs
|
||||||
${gtsam_core_headers}
|
${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
|
# 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})
|
||||||
|
@ -99,7 +106,7 @@ message(STATUS "Install prefix: ${CMAKE_INSTALL_PREFIX}")
|
||||||
if (GTSAM_BUILD_STATIC_LIBRARY)
|
if (GTSAM_BUILD_STATIC_LIBRARY)
|
||||||
message(STATUS "Building GTSAM - static")
|
message(STATUS "Building GTSAM - static")
|
||||||
add_library(gtsam-static STATIC ${gtsam_srcs})
|
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
|
set_target_properties(gtsam-static PROPERTIES
|
||||||
OUTPUT_NAME gtsam
|
OUTPUT_NAME gtsam
|
||||||
CLEAN_DIRECT_OUTPUT 1
|
CLEAN_DIRECT_OUTPUT 1
|
||||||
|
@ -118,7 +125,7 @@ endif ()
|
||||||
if (GTSAM_BUILD_SHARED_LIBRARY)
|
if (GTSAM_BUILD_SHARED_LIBRARY)
|
||||||
message(STATUS "Building GTSAM - shared")
|
message(STATUS "Building GTSAM - shared")
|
||||||
add_library(gtsam-shared SHARED ${gtsam_srcs})
|
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
|
set_target_properties(gtsam-shared PROPERTIES
|
||||||
OUTPUT_NAME gtsam
|
OUTPUT_NAME gtsam
|
||||||
CLEAN_DIRECT_OUTPUT 1
|
CLEAN_DIRECT_OUTPUT 1
|
||||||
|
@ -147,10 +154,6 @@ if(MSVC)
|
||||||
APPEND PROPERTY COMPILE_FLAGS "/bigobj")
|
APPEND PROPERTY COMPILE_FLAGS "/bigobj")
|
||||||
endif()
|
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
|
# Create the matlab toolbox for the gtsam library
|
||||||
if (GTSAM_INSTALL_MATLAB_TOOLBOX)
|
if (GTSAM_INSTALL_MATLAB_TOOLBOX)
|
||||||
# Set up codegen
|
# Set up codegen
|
||||||
|
|
|
@ -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
|
|
Loading…
Reference in New Issue