CMake scripts compatible with gtsam as git submodule

release/4.3a0
Jose-Luis Blanco Claraco 2021-01-17 22:19:54 +01:00 committed by Jose Luis Blanco Claraco
parent b384b0cee4
commit 35aeaf5246
No known key found for this signature in database
GPG Key ID: D443304FBD70A641
6 changed files with 26 additions and 27 deletions

View File

@ -34,7 +34,7 @@ include(GtsamTesting)
include(GtsamPrinting) include(GtsamPrinting)
# guard against in-source builds # guard against in-source builds
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) if(${GTSAM_SOURCE_DIR} STREQUAL ${GTSAM_BINARY_DIR})
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. ") 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() endif()

View File

@ -6,7 +6,7 @@
get_filename_component(OUR_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) get_filename_component(OUR_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
if(EXISTS "${OUR_CMAKE_DIR}/CMakeCache.txt") if(EXISTS "${OUR_CMAKE_DIR}/CMakeCache.txt")
# In build tree # In build tree
set(@PACKAGE_NAME@_INCLUDE_DIR @CMAKE_SOURCE_DIR@ CACHE PATH "@PACKAGE_NAME@ include directory") set(@PACKAGE_NAME@_INCLUDE_DIR @GTSAM_SOURCE_DIR@ CACHE PATH "@PACKAGE_NAME@ include directory")
else() else()
# Find installed library # Find installed library
set(@PACKAGE_NAME@_INCLUDE_DIR "${OUR_CMAKE_DIR}/@CONF_REL_INCLUDE_DIR@" CACHE PATH "@PACKAGE_NAME@ include directory") set(@PACKAGE_NAME@_INCLUDE_DIR "${OUR_CMAKE_DIR}/@CONF_REL_INCLUDE_DIR@" CACHE PATH "@PACKAGE_NAME@ include directory")
@ -15,7 +15,7 @@ endif()
# Find dependencies, required by cmake exported targets: # Find dependencies, required by cmake exported targets:
include(CMakeFindDependencyMacro) include(CMakeFindDependencyMacro)
# Allow using cmake < 3.8 # Allow using cmake < 3.8
if(${CMAKE_VERSION} VERSION_LESS "3.8.0") if(${CMAKE_VERSION} VERSION_LESS "3.8.0")
find_package(Boost @BOOST_FIND_MINIMUM_VERSION@ COMPONENTS @BOOST_FIND_MINIMUM_COMPONENTS@) find_package(Boost @BOOST_FIND_MINIMUM_VERSION@ COMPONENTS @BOOST_FIND_MINIMUM_COMPONENTS@)
else() else()
find_dependency(Boost @BOOST_FIND_MINIMUM_VERSION@ COMPONENTS @BOOST_FIND_MINIMUM_COMPONENTS@) find_dependency(Boost @BOOST_FIND_MINIMUM_VERSION@ COMPONENTS @BOOST_FIND_MINIMUM_COMPONENTS@)

View File

@ -204,9 +204,9 @@ endif()
# Make common binary output directory when on Windows # Make common binary output directory when on Windows
if(WIN32) if(WIN32)
set(RUNTIME_OUTPUT_PATH "${CMAKE_BINARY_DIR}/bin") set(RUNTIME_OUTPUT_PATH "${GTSAM_BINARY_DIR}/bin")
set(EXECUTABLE_OUTPUT_PATH "${CMAKE_BINARY_DIR}/bin") set(EXECUTABLE_OUTPUT_PATH "${GTSAM_BINARY_DIR}/bin")
set(LIBRARY_OUTPUT_PATH "${CMAKE_BINARY_DIR}/lib") set(LIBRARY_OUTPUT_PATH "${GTSAM_BINARY_DIR}/lib")
endif() endif()
# Set up build type list for cmake-gui # Set up build type list for cmake-gui

View File

@ -146,7 +146,7 @@ function(wrap_library_internal interfaceHeader linkLibraries extraIncludeDirs ex
endif() endif()
endif() endif()
endforeach() endforeach()
## CHRIS: Temporary fix. On my system the get_target_property above returned Not-found for gtsam module ## CHRIS: Temporary fix. On my system the get_target_property above returned Not-found for gtsam module
## This needs to be fixed!! ## This needs to be fixed!!
if(UNIX AND NOT APPLE) if(UNIX AND NOT APPLE)
@ -159,7 +159,7 @@ function(wrap_library_internal interfaceHeader linkLibraries extraIncludeDirs ex
endif() endif()
endif() endif()
endif() endif()
#message("AUTOMATIC DEPENDENCIES: ${automaticDependencies}") #message("AUTOMATIC DEPENDENCIES: ${automaticDependencies}")
## CHRIS: End temporary fix ## CHRIS: End temporary fix
@ -213,7 +213,7 @@ function(wrap_library_internal interfaceHeader linkLibraries extraIncludeDirs ex
endif() endif()
endif() endif()
endforeach() endforeach()
# Check libraries for conflicting versions built-in to MATLAB # Check libraries for conflicting versions built-in to MATLAB
set(dependentLibraries "") set(dependentLibraries "")
if(NOT "${otherLibraryTargets}" STREQUAL "") if(NOT "${otherLibraryTargets}" STREQUAL "")
@ -257,7 +257,7 @@ function(wrap_library_internal interfaceHeader linkLibraries extraIncludeDirs ex
--ignore ${_ignore} --ignore ${_ignore}
VERBATIM VERBATIM
WORKING_DIRECTORY ${generated_files_path}) WORKING_DIRECTORY ${generated_files_path})
# Set up building of mex module # Set up building of mex module
string(REPLACE ";" " " extraMexFlagsSpaced "${extraMexFlags}") string(REPLACE ";" " " extraMexFlagsSpaced "${extraMexFlags}")
string(REPLACE ";" " " mexFlagsSpaced "${GTSAM_BUILD_MEX_BINARY_FLAGS}") string(REPLACE ";" " " mexFlagsSpaced "${GTSAM_BUILD_MEX_BINARY_FLAGS}")
@ -295,8 +295,8 @@ function(wrap_library_internal interfaceHeader linkLibraries extraIncludeDirs ex
endif() endif()
# Hacking around output issue with custom command # Hacking around output issue with custom command
# Deletes generated build folder # Deletes generated build folder
add_custom_target(wrap_${moduleName}_matlab_distclean add_custom_target(wrap_${moduleName}_matlab_distclean
COMMAND cmake -E remove_directory ${generated_files_path} COMMAND cmake -E remove_directory ${generated_files_path}
COMMAND cmake -E remove_directory ${compiled_mex_modules_root}) COMMAND cmake -E remove_directory ${compiled_mex_modules_root})
endfunction() endfunction()
@ -347,17 +347,17 @@ function(check_conflicting_libraries_internal libraries)
set(mxLibPath "${MATLAB_ROOT}/bin/glnx86") set(mxLibPath "${MATLAB_ROOT}/bin/glnx86")
endif() endif()
endif() endif()
# List matlab's built-in libraries # List matlab's built-in libraries
file(GLOB matlabLibs RELATIVE "${mxLibPath}" "${mxLibPath}/lib*") file(GLOB matlabLibs RELATIVE "${mxLibPath}" "${mxLibPath}/lib*")
# Convert to base names # Convert to base names
set(matlabLibNames "") set(matlabLibNames "")
foreach(lib ${matlabLibs}) foreach(lib ${matlabLibs})
get_filename_component(libName "${lib}" NAME_WE) get_filename_component(libName "${lib}" NAME_WE)
list(APPEND matlabLibNames "${libName}") list(APPEND matlabLibNames "${libName}")
endforeach() endforeach()
# Get names of link libraries # Get names of link libraries
set(linkLibNames "") set(linkLibNames "")
foreach(lib ${libraries}) foreach(lib ${libraries})
@ -379,10 +379,10 @@ function(check_conflicting_libraries_internal libraries)
endif() endif()
endif() endif()
endforeach() endforeach()
# Remove duplicates # Remove duplicates
list(REMOVE_DUPLICATES linkLibNames) list(REMOVE_DUPLICATES linkLibNames)
set(conflictingLibs "") set(conflictingLibs "")
foreach(lib ${linkLibNames}) foreach(lib ${linkLibNames})
list(FIND matlabLibNames "${lib}" libPos) list(FIND matlabLibNames "${lib}" libPos)
@ -393,7 +393,7 @@ function(check_conflicting_libraries_internal libraries)
set(conflictingLibs "${conflictingLibs}${lib}") set(conflictingLibs "${conflictingLibs}${lib}")
endif() endif()
endforeach() endforeach()
if(NOT "${conflictingLibs}" STREQUAL "") if(NOT "${conflictingLibs}" STREQUAL "")
message(WARNING "GTSAM links to the libraries [ ${conflictingLibs} ] on your system, but " message(WARNING "GTSAM links to the libraries [ ${conflictingLibs} ] on your system, but "
"MATLAB is distributed with its own versions of these libraries which may conflict. " "MATLAB is distributed with its own versions of these libraries which may conflict. "
@ -435,4 +435,3 @@ function(install_matlab_scripts source_directory patterns)
endif() endif()
endfunction() endfunction()

View File

@ -42,7 +42,7 @@ else()
set(GTSAM_EIGEN_INCLUDE_FOR_INSTALL "include/gtsam/3rdparty/Eigen/") set(GTSAM_EIGEN_INCLUDE_FOR_INSTALL "include/gtsam/3rdparty/Eigen/")
# The actual include directory (for BUILD cmake target interface): # The actual include directory (for BUILD cmake target interface):
set(GTSAM_EIGEN_INCLUDE_FOR_BUILD "${CMAKE_SOURCE_DIR}/gtsam/3rdparty/Eigen/") set(GTSAM_EIGEN_INCLUDE_FOR_BUILD "${GTSAM_SOURCE_DIR}/gtsam/3rdparty/Eigen/")
endif() endif()
# Detect Eigen version: # Detect Eigen version:

View File

@ -134,15 +134,15 @@ endif()
# of any previously installed GTSAM headers. # of any previously installed GTSAM headers.
target_include_directories(gtsam BEFORE PUBLIC target_include_directories(gtsam BEFORE PUBLIC
# main gtsam includes: # main gtsam includes:
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}> $<BUILD_INTERFACE:${GTSAM_SOURCE_DIR}>
$<INSTALL_INTERFACE:include/> $<INSTALL_INTERFACE:include/>
# config.h # config.h
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}> $<BUILD_INTERFACE:${GTSAM_BINARY_DIR}>
# unit tests: # unit tests:
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/CppUnitLite> $<BUILD_INTERFACE:${GTSAM_SOURCE_DIR}/CppUnitLite>
) )
# 3rdparty libraries: use the "system" flag so they are included via "-isystem" # 3rdparty libraries: use the "system" flag so they are included via "-isystem"
# and warnings (and warnings-considered-errors) in those headers are not # and warnings (and warnings-considered-errors) in those headers are not
# reported as warnings/errors in our targets: # reported as warnings/errors in our targets:
target_include_directories(gtsam SYSTEM BEFORE PUBLIC target_include_directories(gtsam SYSTEM BEFORE PUBLIC
# SuiteSparse_config # SuiteSparse_config
@ -156,9 +156,9 @@ target_include_directories(gtsam SYSTEM BEFORE PUBLIC
) )
if(GTSAM_SUPPORT_NESTED_DISSECTION) if(GTSAM_SUPPORT_NESTED_DISSECTION)
target_include_directories(gtsam BEFORE PUBLIC target_include_directories(gtsam BEFORE PUBLIC
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/gtsam/3rdparty/metis/include> $<BUILD_INTERFACE:${GTSAM_SOURCE_DIR}/gtsam/3rdparty/metis/include>
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/gtsam/3rdparty/metis/libmetis> $<BUILD_INTERFACE:${GTSAM_SOURCE_DIR}/gtsam/3rdparty/metis/libmetis>
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/gtsam/3rdparty/metis/GKlib> $<BUILD_INTERFACE:${GTSAM_SOURCE_DIR}/gtsam/3rdparty/metis/GKlib>
$<INSTALL_INTERFACE:include/gtsam/3rdparty/metis/> $<INSTALL_INTERFACE:include/gtsam/3rdparty/metis/>
) )
endif() endif()