-
-
Notifications
You must be signed in to change notification settings - Fork 398
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* cartographer: add package * clean unneeded code * cartographer: replace cairo with correct header * cartographer: update port `xmake.lua` * cartographer: patch to remove include config.h * cartographer: fixed only on linux * cartographer: use cxx17 * cartographer: set test C++ to 17 * cartographer: Remove all test files and remove unistd for windows * cartographer: remove config via io.replace * cartographer: fix for windows * cartographer: add zlib * cartographer: move zlib above boost * cartographer: specify boost version * cartographer: use boost 1.83.0 * cartographer: remove specify boost version * Update xmake.lua * cartographer: disable shared for windows --------- Co-authored-by: ruki <[email protected]>
- Loading branch information
Showing
3 changed files
with
139 additions
and
0 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
packages/c/cartographer/patches/1.0.0/fix-build-error.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
diff --git a/cartographer/common/math.h b/cartographer/common/math.h | ||
index c4a77ef..0248f66 100644 | ||
--- a/cartographer/common/math.h | ||
+++ b/cartographer/common/math.h | ||
@@ -17,6 +17,10 @@ | ||
#ifndef CARTOGRAPHER_COMMON_MATH_H_ | ||
#define CARTOGRAPHER_COMMON_MATH_H_ | ||
|
||
+#ifndef M_PI | ||
+#define M_PI 3.14159265358979323846 | ||
+#endif | ||
+ | ||
#include <cmath> | ||
#include <vector> | ||
|
||
diff --git a/cartographer/common/thread_pool.cc b/cartographer/common/thread_pool.cc | ||
index bc3c743..c61704d 100644 | ||
--- a/cartographer/common/thread_pool.cc | ||
+++ b/cartographer/common/thread_pool.cc | ||
@@ -16,7 +16,6 @@ | ||
|
||
#include "cartographer/common/thread_pool.h" | ||
|
||
-#include <unistd.h> | ||
#include <algorithm> | ||
#include <chrono> | ||
#include <numeric> | ||
diff --git a/cartographer/mapping/pose_graph_interface.h b/cartographer/mapping/pose_graph_interface.h | ||
index 6483ef4..6456720 100644 | ||
--- a/cartographer/mapping/pose_graph_interface.h | ||
+++ b/cartographer/mapping/pose_graph_interface.h | ||
@@ -18,6 +18,7 @@ | ||
#define CARTOGRAPHER_MAPPING_POSE_GRAPH_INTERFACE_H_ | ||
|
||
#include <vector> | ||
+#include <array> | ||
|
||
#include "cartographer/common/optional.h" | ||
#include "cartographer/mapping/id.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
add_rules("mode.debug", "mode.release") | ||
|
||
add_requires("boost", {configs = {iostreams = true}}) | ||
add_requires("ceres-solver", {configs = {suitesparse = true}}) | ||
add_requires("abseil", "cairo", "eigen", "glog", "lua", "protobuf-cpp", "zlib") | ||
|
||
target("cartographer") | ||
set_kind("$(kind)") | ||
set_languages("cxx17") | ||
|
||
add_packages( | ||
"abseil", | ||
"boost", | ||
"ceres-solver", | ||
"cairo", | ||
"eigen", | ||
"glog", | ||
"lua", | ||
"zlib" | ||
) | ||
|
||
add_packages("protobuf-cpp", {public = true}) | ||
add_rules("protobuf.cpp") | ||
|
||
add_files("cartographer/**.proto", {proto_rootdir = "cartographer", proto_autogendir = path.join("$(buildir)", "proto") , proto_public = true}) | ||
|
||
add_includedirs("$(buildir)/proto/cartographer") | ||
add_includedirs("$(buildir)/proto", { public = true }) | ||
|
||
add_headerfiles("$(buildir)/proto/(cartographer/**.h)") | ||
add_headerfiles("$(buildir)/proto/cartographer/(**.h)") | ||
|
||
remove_files("cartographer/**_service.proto") | ||
|
||
add_headerfiles("(cartographer/**.h)") | ||
add_files("cartographer/**.cc") | ||
|
||
remove_files("cartographer/io/serialization_format_migration.cc") | ||
remove_headerfiles("cartographer/io/serialization_format_migration.h") | ||
|
||
remove_headerfiles("**/fake_*.h", "**/*test*.h", "**/mock*.h") | ||
remove_files("**/fake_*.cc", "**/mock*.cc", "**/*_main.cc", "**/*test*.cc") | ||
|
||
-- BUILD_GRPC is not enabled | ||
remove_headerfiles("cartographer/cloud/**.h") | ||
remove_files("cartographer/cloud/**.cc") | ||
remove_files("cartographer/cloud/proto/**.proto") | ||
|
||
add_includedirs(".", { public = true }) | ||
|
||
if is_plat("windows") then | ||
add_defines("NOMINMAX") | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
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") | ||
|
||
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("boost", {configs = {iostreams = true}}) | ||
add_deps("ceres-solver", {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) |