package An official xmake package repository https://xrepo.xmake.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
2.6 KiB

package("cartographer")
set_homepage("https://github.com/cartographer-project/cartographer")
set_description("Cartographer is a system that provides real-time simultaneous localization and mapping (SLAM) in 2D and 3D across multiple platforms and sensor configurations.")
set_license("Apache-2.0")
add_urls("https://github.com/cartographer-project/cartographer/archive/refs/tags/$(version).tar.gz",
"https://github.com/cartographer-project/cartographer.git")
add_versions("1.0.0", "474a410bf6457eb8a0fd92ea412d7889fb013051e625d3ee25e8d65e4113fd6c")
add_patches("1.0.0", path.join(os.scriptdir(), "patches", "1.0.0", "fix-build-error.patch"), "a4bb53d6f098c77a397d72c244d4283af1f9eec8a4ca7a7fa28de77b06d1201e")
add_patches("1.0.0", path.join(os.scriptdir(), "patches", "1.0.0", "remove-boost.patch"), "bd0666bbf4eff2f4fda0c6bd55c960fd60af848f7d750a9c1efaffda2abc1e9b")
if is_plat("windows") then
add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
end
add_deps("cmake")
add_deps("zlib")
add_deps("ceres-solver 2.1.0", {configs = {suitesparse = true}})
add_deps("abseil", "cairo", "eigen", "lua", "protobuf-cpp")
on_install("windows|x64", "windows|x86", "macosx|x86_64", "linux", function (package)
for _, headerfile in ipairs(os.files("cartographer/**.h")) do
io.replace(headerfile, "cairo/cairo.h", "cairo.h", {plain = true})
end
for _, protofile in ipairs(os.files("cartographer/**.proto")) do
io.replace(protofile, [[import "cartographer/]], [[import "]], {plain = true})
end
os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua")
io.replace("cartographer/common/configuration_file_resolver.cc", [[#include "cartographer/common/config.h"]], "", {plain = true})
io.replace("cartographer/common/configuration_file_resolver.cc", [[configuration_files_directories_.push_back(kConfigurationFilesDirectory);]], "", {plain = true})
local configs = {}
if is_plat("windows") then
io.replace("cartographer/common/thread_pool.cc", "#include <unistd.h>", "", {plain = true})
end
import("package.tools.xmake").install(package, configs)
end)
on_test(function (package)
assert(package:check_cxxsnippets({test = [[
#include "cartographer/mapping/proto/map_builder_options.pb.h"
void test() {
cartographer::mapping::proto::MapBuilderOptions map_builder_options;
}
]]}, {configs = {languages = "c++17"}}))
end)