feat:build

master
邱棚 2024-07-12 12:26:02 +08:00
parent 877157a0d9
commit eb5d0b2218
3 changed files with 38 additions and 1 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
build
bazel-*
/scripts/abseil-cpp/

View File

@ -29,6 +29,8 @@ include("${PROJECT_SOURCE_DIR}/cmake/functions.cmake")
google_initialize_cartographer_project()
google_enable_testing()
list(APPEND CMAKE_PREFIX_PATH "/usr/local/stow/absl")
find_package(absl REQUIRED)
set(BOOST_COMPONENTS iostreams)
if(WIN32)
@ -268,6 +270,41 @@ target_include_directories(${PROJECT_NAME} SYSTEM PUBLIC
${PROTOBUF_INCLUDE_DIR})
# TODO(hrapp): This should not explicitly list pthread and use
# PROTOBUF_LIBRARIES, but that failed on first try.
#
function(get_library_paths target)
get_target_property(LINK_LIBS ${target} INTERFACE_LINK_LIBRARIES)
if(NOT LINK_LIBS)
message(WARNING "Target ${target} has no INTERFACE_LINK_LIBRARIES")
return()
endif()
foreach(lib IN LISTS LINK_LIBS)
if(TARGET ${lib})
get_target_property(TYPE ${lib} TYPE)
if(TYPE STREQUAL "INTERFACE_LIBRARY")
get_library_paths(${lib})
elseif(TYPE STREQUAL "STATIC_LIBRARY" OR TYPE STREQUAL "SHARED_LIBRARY" OR TYPE STREQUAL "MODULE_LIBRARY")
get_target_property(LIB_PATH ${lib} LOCATION)
if(LIB_PATH)
message(STATUS "Library ${lib} is located at ${LIB_PATH}")
else()
message(WARNING "Library ${lib} has no LOCATION property")
endif()
endif()
else()
if("${lib}" MATCHES "-NOTFOUND$")
message(WARNING "Library ${lib} is NOTFOUND")
else()
message(STATUS "Linked library: ${lib}")
endif()
endif()
endforeach()
endfunction()
# absl::base
get_library_paths(absl::base)
target_link_libraries(${PROJECT_NAME} PUBLIC ${PROTOBUF_LIBRARY}
absl::algorithm
absl::base

View File

@ -43,7 +43,6 @@
<depend>libboost-iostreams-dev</depend>
<depend>eigen</depend>
<depend>libabsl-dev</depend>
<depend>libcairo2-dev</depend>
<depend>libceres-dev</depend>
<depend>libgflags-dev</depend>