parent
22a344b946
commit
99f449543f
|
@ -44,25 +44,11 @@ endif()
|
||||||
# Install catkin package.xml
|
# Install catkin package.xml
|
||||||
install(FILES package.xml DESTINATION share/cartographer)
|
install(FILES package.xml DESTINATION share/cartographer)
|
||||||
|
|
||||||
set(CARTOGRAPHER_CONFIGURATION_FILES_DIRECTORY "${CMAKE_INSTALL_PREFIX}/share/cartographer/configuration_files")
|
set(CARTOGRAPHER_CONFIGURATION_FILES_DIRECTORY ${CMAKE_INSTALL_PREFIX}/share/cartographer/configuration_files)
|
||||||
install(DIRECTORY configuration_files DESTINATION share/cartographer/)
|
install(DIRECTORY configuration_files DESTINATION share/cartographer/)
|
||||||
|
|
||||||
install(DIRECTORY cmake DESTINATION share/cartographer/)
|
install(DIRECTORY cmake DESTINATION share/cartographer/)
|
||||||
|
|
||||||
include(CMakePackageConfigHelpers)
|
|
||||||
|
|
||||||
# Create a cartographer-config.cmake file for the use from the install tree
|
|
||||||
# and install it
|
|
||||||
set(CARTOGRAPHER_LIBRARY_DIRS "${CMAKE_INSTALL_PREFIX}/lib")
|
|
||||||
list(APPEND CARTOGRAPHER_LIBRARY_DIRS "${LUA_LIBRARY_DIR}")
|
|
||||||
|
|
||||||
set(CARTOGRAPHER_INCLUDE_DIRS "${CMAKE_INSTALL_PREFIX}/include")
|
|
||||||
list(APPEND CARTOGRAPHER_INCLUDE_DIRS "${LUA_INCLUDE_DIR}")
|
|
||||||
list(APPEND CARTOGRAPHER_INCLUDE_DIRS "${CERES_INCLUDE_DIRS}")
|
|
||||||
list(APPEND CARTOGRAPHER_INCLUDE_DIRS "${PROTOBUF_INCLUDE_DIR}")
|
|
||||||
|
|
||||||
set(CARTOGRAPHER_CMAKE_DIR "${CMAKE_INSTALL_PREFIX}/share/cartographer/cmake")
|
|
||||||
|
|
||||||
file(GLOB_RECURSE ALL_SRCS "*.cc" "*.h")
|
file(GLOB_RECURSE ALL_SRCS "*.cc" "*.h")
|
||||||
file(GLOB_RECURSE ALL_TESTS "*_test.cc")
|
file(GLOB_RECURSE ALL_TESTS "*_test.cc")
|
||||||
file(GLOB_RECURSE ALL_EXECUTABLES "*_main.cc")
|
file(GLOB_RECURSE ALL_EXECUTABLES "*_main.cc")
|
||||||
|
@ -95,62 +81,65 @@ endforeach()
|
||||||
set_source_files_properties(${ALL_PROTO_SRCS} ${ALL_PROTO_HDRS} PROPERTIES GENERATED TRUE)
|
set_source_files_properties(${ALL_PROTO_SRCS} ${ALL_PROTO_HDRS} PROPERTIES GENERATED TRUE)
|
||||||
list(APPEND ALL_SRCS ${ALL_PROTO_SRCS} ${ALL_PROTO_HDRS})
|
list(APPEND ALL_SRCS ${ALL_PROTO_SRCS} ${ALL_PROTO_HDRS})
|
||||||
|
|
||||||
add_library(cartographer ${ALL_SRCS})
|
add_library(${PROJECT_NAME} ${ALL_SRCS})
|
||||||
add_subdirectory("cartographer")
|
add_subdirectory("cartographer")
|
||||||
|
|
||||||
target_include_directories(cartographer SYSTEM PUBLIC
|
target_include_directories(${PROJECT_NAME} SYSTEM PUBLIC
|
||||||
"${EIGEN3_INCLUDE_DIR}")
|
"${EIGEN3_INCLUDE_DIR}")
|
||||||
target_link_libraries(cartographer PUBLIC ${EIGEN3_LIBRARIES})
|
target_link_libraries(${PROJECT_NAME} PUBLIC ${EIGEN3_LIBRARIES})
|
||||||
|
|
||||||
target_include_directories(cartographer SYSTEM PUBLIC
|
target_include_directories(${PROJECT_NAME} SYSTEM PUBLIC
|
||||||
"${CERES_INCLUDE_DIRS}")
|
"${CERES_INCLUDE_DIRS}")
|
||||||
target_link_libraries(cartographer PUBLIC ${CERES_LIBRARIES})
|
target_link_libraries(${PROJECT_NAME} PUBLIC ${CERES_LIBRARIES})
|
||||||
|
|
||||||
target_include_directories(cartographer SYSTEM PUBLIC
|
target_include_directories(${PROJECT_NAME} SYSTEM PUBLIC
|
||||||
"${LUA_INCLUDE_DIR}")
|
"${LUA_INCLUDE_DIR}")
|
||||||
target_link_libraries(cartographer PUBLIC ${LUA_LIBRARIES})
|
target_link_libraries(${PROJECT_NAME} PUBLIC ${LUA_LIBRARIES})
|
||||||
|
|
||||||
target_include_directories(cartographer SYSTEM PUBLIC
|
target_include_directories(${PROJECT_NAME} SYSTEM PUBLIC
|
||||||
"${Boost_INCLUDE_DIRS}")
|
"${Boost_INCLUDE_DIRS}")
|
||||||
target_link_libraries(cartographer PUBLIC ${Boost_LIBRARIES})
|
target_link_libraries(${PROJECT_NAME} PUBLIC ${Boost_LIBRARIES})
|
||||||
|
|
||||||
target_link_libraries(cartographer PUBLIC webp)
|
target_link_libraries(${PROJECT_NAME} PUBLIC webp)
|
||||||
|
|
||||||
# We expect find_package(Ceres) to have located these for us.
|
# We expect find_package(Ceres) to have located these for us.
|
||||||
target_link_libraries(cartographer PUBLIC glog)
|
target_link_libraries(${PROJECT_NAME} PUBLIC glog)
|
||||||
target_link_libraries(cartographer PUBLIC gflags)
|
target_link_libraries(${PROJECT_NAME} PUBLIC gflags)
|
||||||
|
|
||||||
target_include_directories(cartographer SYSTEM PUBLIC
|
target_include_directories(${PROJECT_NAME} SYSTEM PUBLIC
|
||||||
"${CAIRO_INCLUDE_DIRS}")
|
"${CAIRO_INCLUDE_DIRS}")
|
||||||
target_link_libraries(cartographer PUBLIC ${CAIRO_LIBRARIES})
|
target_link_libraries(${PROJECT_NAME} PUBLIC ${CAIRO_LIBRARIES})
|
||||||
|
|
||||||
target_include_directories(cartographer SYSTEM PUBLIC
|
target_include_directories(${PROJECT_NAME} SYSTEM PUBLIC
|
||||||
${PROTOBUF_INCLUDE_DIR})
|
${PROTOBUF_INCLUDE_DIR})
|
||||||
# TODO(hrapp): This should not explicitly list pthread and use
|
# TODO(hrapp): This should not explicitly list pthread and use
|
||||||
# PROTOBUF_LIBRARIES, but that failed on first try.
|
# PROTOBUF_LIBRARIES, but that failed on first try.
|
||||||
target_link_libraries(cartographer PUBLIC ${PROTOBUF_LIBRARY} pthread)
|
target_link_libraries(${PROJECT_NAME} PUBLIC ${PROTOBUF_LIBRARY} pthread)
|
||||||
|
|
||||||
# Add the binary directory first, so that port.h is included after it has
|
# Add the binary directory first, so that port.h is included after it has
|
||||||
# been generated.
|
# been generated.
|
||||||
target_include_directories(cartographer PUBLIC
|
target_include_directories(${PROJECT_NAME} PUBLIC
|
||||||
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}>
|
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}>
|
||||||
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}>
|
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}>
|
||||||
$<INSTALL_INTERFACE:include>
|
$<INSTALL_INTERFACE:include>
|
||||||
)
|
)
|
||||||
|
|
||||||
# TODO(damonkohler): Create a testing library.
|
# TODO(damonkohler): Create a testing library.
|
||||||
target_include_directories(cartographer SYSTEM PRIVATE
|
target_include_directories(${PROJECT_NAME} SYSTEM PRIVATE
|
||||||
"${GMOCK_INCLUDE_DIRS}")
|
"${GMOCK_INCLUDE_DIRS}")
|
||||||
target_link_libraries(cartographer PUBLIC ${GMOCK_LIBRARIES})
|
target_link_libraries(${PROJECT_NAME} PUBLIC ${GMOCK_LIBRARY})
|
||||||
|
|
||||||
set(TARGET_COMPILE_FLAGS "${TARGET_COMPILE_FLAGS} ${GOOG_CXX_FLAGS}")
|
set(TARGET_COMPILE_FLAGS "${TARGET_COMPILE_FLAGS} ${GOOG_CXX_FLAGS}")
|
||||||
set_target_properties(cartographer PROPERTIES
|
set_target_properties(${PROJECT_NAME} PROPERTIES
|
||||||
COMPILE_FLAGS ${TARGET_COMPILE_FLAGS})
|
COMPILE_FLAGS ${TARGET_COMPILE_FLAGS})
|
||||||
|
|
||||||
install(TARGETS cartographer
|
install(
|
||||||
ARCHIVE DESTINATION lib
|
TARGETS ${PROJECT_NAME}
|
||||||
LIBRARY DESTINATION lib
|
EXPORT CartographerExport
|
||||||
RUNTIME DESTINATION bin)
|
ARCHIVE DESTINATION lib
|
||||||
|
LIBRARY DESTINATION lib
|
||||||
|
RUNTIME DESTINATION bin
|
||||||
|
)
|
||||||
|
|
||||||
# Install source headers.
|
# Install source headers.
|
||||||
file(GLOB_RECURSE hdrs "*.h")
|
file(GLOB_RECURSE hdrs "*.h")
|
||||||
|
@ -191,26 +180,22 @@ foreach(HDR ${ALL_PROTO_HDRS})
|
||||||
)
|
)
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
set(CARTOGRAPHER_LIBRARIES "")
|
set(CARTOGRAPHER_CMAKE_DIR share/cartographer/cmake)
|
||||||
list(APPEND CARTOGRAPHER_LIBRARIES "${CMAKE_INSTALL_PREFIX}/lib/libcartographer.a")
|
include(CMakePackageConfigHelpers)
|
||||||
list(APPEND CARTOGRAPHER_LIBRARIES "${CERES_LIBRARIES}")
|
configure_package_config_file(
|
||||||
list(APPEND CARTOGRAPHER_LIBRARIES "${Boost_LIBRARIES}")
|
|
||||||
list(APPEND CARTOGRAPHER_LIBRARIES "${LUA_LIBRARIES}")
|
|
||||||
list(APPEND CARTOGRAPHER_LIBRARIES "${PROTOBUF_LIBRARIES}")
|
|
||||||
list(APPEND CARTOGRAPHER_LIBRARIES "${CAIRO_LIBRARIES}")
|
|
||||||
list(APPEND CARTOGRAPHER_LIBRARIES "webp")
|
|
||||||
list(APPEND CARTOGRAPHER_LIBRARIES "glog")
|
|
||||||
|
|
||||||
CONFIGURE_PACKAGE_CONFIG_FILE(
|
|
||||||
cartographer-config.cmake.in
|
cartographer-config.cmake.in
|
||||||
"${CMAKE_BINARY_DIR}/cmake/cartographer/cartographer-config.cmake"
|
${CMAKE_BINARY_DIR}/cmake/cartographer/cartographer-config.cmake
|
||||||
PATH_VARS CARTOGRAPHER_INCLUDE_DIRS CARTOGRAPHER_LIBRARY_DIRS CARTOGRAPHER_CMAKE_DIR
|
PATH_VARS CARTOGRAPHER_CMAKE_DIR
|
||||||
INSTALL_DESTINATION ${CMAKE_INSTALL_PREFIX}/share/cartographer
|
INSTALL_DESTINATION ${CMAKE_INSTALL_PREFIX}/share/cartographer
|
||||||
)
|
)
|
||||||
|
|
||||||
install(
|
install(
|
||||||
FILES
|
EXPORT CartographerExport
|
||||||
"${CMAKE_BINARY_DIR}/cmake/cartographer/cartographer-config.cmake"
|
DESTINATION share/cartographer/cmake/
|
||||||
DESTINATION
|
FILE CartographerTargets.cmake
|
||||||
share/cartographer/
|
)
|
||||||
|
|
||||||
|
install(
|
||||||
|
FILES ${CMAKE_BINARY_DIR}/cmake/cartographer/cartographer-config.cmake
|
||||||
|
DESTINATION share/cartographer/
|
||||||
)
|
)
|
||||||
|
|
|
@ -16,25 +16,10 @@
|
||||||
# In your CMakeLists.txt, add these lines:
|
# In your CMakeLists.txt, add these lines:
|
||||||
#
|
#
|
||||||
# find_package(cartographer REQUIRED)
|
# find_package(cartographer REQUIRED)
|
||||||
# include_directories(${CARTOGRAPHER_INCLUDE_DIRS})
|
# target_link_libraries(MY_TARGET_NAME PUBLIC cartographer)
|
||||||
# target_link_libraries(MY_TARGET_NAME PUBLIC ${CARTOGRAPHER_LIBRARIES})
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# This file will define the following variables:
|
|
||||||
# - CARTOGRAPHER_LIBRARIES
|
|
||||||
# - CARTOGRAPHER_LIBRARY_DIRS
|
|
||||||
# - CARTOGRAPHER_INCLUDE_DIRS
|
|
||||||
|
|
||||||
@PACKAGE_INIT@
|
@PACKAGE_INIT@
|
||||||
|
|
||||||
set(CARTOGRAPHER_INCLUDE_DIRS "@PACKAGE_CARTOGRAPHER_INCLUDE_DIRS@")
|
|
||||||
set(CARTOGRAPHER_LIBRARY_DIRS "@PACKAGE_CARTOGRAPHER_LIBRARY_DIRS@")
|
|
||||||
set(CARTOGRAPHER_CMAKE_DIR "@PACKAGE_CARTOGRAPHER_CMAKE_DIR@")
|
|
||||||
|
|
||||||
set(CARTOGRAPHER_LIBRARIES
|
|
||||||
"@CARTOGRAPHER_LIBRARIES@"
|
|
||||||
)
|
|
||||||
|
|
||||||
set(CERES_DIR_HINTS @Ceres_DIR@)
|
set(CERES_DIR_HINTS @Ceres_DIR@)
|
||||||
|
|
||||||
if (cartographer_FIND_QUIETLY)
|
if (cartographer_FIND_QUIETLY)
|
||||||
|
@ -44,3 +29,6 @@ elseif (cartographer_FIND_REQUIRED)
|
||||||
else ()
|
else ()
|
||||||
find_package(Ceres HINTS ${CERES_DIR_HINTS})
|
find_package(Ceres HINTS ${CERES_DIR_HINTS})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
set_and_check(CARTOGRAPHER_CMAKE_DIR "@PACKAGE_CARTOGRAPHER_CMAKE_DIR@")
|
||||||
|
include("${CARTOGRAPHER_CMAKE_DIR}/CartographerTargets.cmake")
|
||||||
|
|
Loading…
Reference in New Issue