Skip to content

Commit

Permalink
Add lanelet2 module
Browse files Browse the repository at this point in the history
Closes #3487
  • Loading branch information
kgreenek committed Dec 26, 2024
1 parent 0d1e990 commit 7bc8e0a
Show file tree
Hide file tree
Showing 7 changed files with 367 additions and 0 deletions.
29 changes: 29 additions & 0 deletions modules/lanelet2/1.2.1/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
module(
name = "lanelet2",
version = "1.2.1",
)

BOOST_VERSION = "1.83.0"

bazel_dep(name = "boost.config", version = BOOST_VERSION + ".bcr.1")
bazel_dep(name = "boost.core", version = BOOST_VERSION + ".bcr.1")
bazel_dep(name = "boost.filesystem", version = BOOST_VERSION + ".bcr.1")
bazel_dep(name = "boost.format", version = BOOST_VERSION + ".bcr.1")
bazel_dep(name = "boost.geometry", version = BOOST_VERSION + ".bcr.1")
bazel_dep(name = "boost.graph", version = BOOST_VERSION + ".bcr.1")
bazel_dep(name = "boost.iterator", version = BOOST_VERSION + ".bcr.1")
bazel_dep(name = "boost.lexical_cast", version = BOOST_VERSION + ".bcr.1")
bazel_dep(name = "boost.optional", version = BOOST_VERSION + ".bcr.1")
bazel_dep(name = "boost.polygon", version = BOOST_VERSION + ".bcr.1")
bazel_dep(name = "boost.program_options", version = BOOST_VERSION + ".bcr.1")
bazel_dep(name = "boost.property_map", version = BOOST_VERSION + ".bcr.1")
bazel_dep(name = "boost.serialization", version = BOOST_VERSION + ".bcr.1")
bazel_dep(name = "boost.type_traits", version = BOOST_VERSION + ".bcr.1")
bazel_dep(name = "boost.units", version = BOOST_VERSION)
bazel_dep(name = "boost.variant", version = BOOST_VERSION + ".bcr.1")
bazel_dep(name = "eigen", version = "3.4.0.bcr.1")
bazel_dep(name = "geographiclib", version = "2.4.0")
bazel_dep(name = "googletest", version = "1.15.2", repo_name = "com_google_googletest")
bazel_dep(name = "pugixml", version = "1.14.bcr.1")
bazel_dep(name = "rules_cc", version = "0.0.9")
bazel_dep(name = "rules_license", version = "1.0.0")
232 changes: 232 additions & 0 deletions modules/lanelet2/1.2.1/overlay/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,232 @@
"""Bazel build file for lanelet2 libraries"""

load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test")
load("@rules_license//rules:license.bzl", "license")

package(default_applicable_licenses = [":license"])

license(
name = "license",
license_kinds = ["@rules_license//licenses/spdx:BSD-3-Clause"],
license_text = "LICENSE",
)

cc_library(
name = "lanelet2_core",
srcs = glob(["lanelet2_core/src/**/*.cpp"]),
hdrs = glob(["lanelet2_core/include/**/*.h"]),
copts = [
"-Wno-sign-compare",
"-Wno-unused-function",
"-Wno-unused-local-typedefs",
],
includes = ["lanelet2_core/include"],
visibility = ["//visibility:public"],
deps = [
"@boost.config",
"@boost.core",
"@boost.geometry",
"@boost.iterator",
"@boost.lexical_cast",
"@boost.optional",
"@boost.polygon",
"@boost.type_traits",
"@boost.units",
"@boost.variant",
"@eigen",
],
)

cc_library(
name = "lanelet2_io",
srcs = glob(["lanelet2_io/src/**/*.cpp"]),
hdrs = glob(["lanelet2_io/include/**/*.h"]),
includes = ["lanelet2_io/include"],
visibility = ["//visibility:public"],
deps = [
":lanelet2_core",
"@boost.filesystem",
"@boost.format",
"@boost.geometry",
"@boost.serialization",
"@pugixml",
],
)

filegroup(
name = "lanelet2_maps_osm_files",
srcs = glob(["lanelet2_maps/res/*.osm"]),
)

cc_library(
name = "lanelet2_matching",
srcs = glob(["lanelet2_matching/src/**/*.cpp"]),
hdrs = glob(["lanelet2_matching/include/**/*.h"]),
includes = [
"lanelet2_matching/include",
# This has to be exposed as a public include because the headers include other headers using
# the local path.
"lanelet2_matching/include/lanelet2_matching",
],
visibility = ["//visibility:public"],
deps = [
":lanelet2_core",
":lanelet2_traffic_rules",
"@eigen",
],
)

cc_library(
name = "lanelet2_projection",
srcs = glob(["lanelet2_projection/src/**/*.cpp"]),
hdrs = glob(["lanelet2_projection/include/**/*.h"]),
includes = ["lanelet2_projection/include"],
visibility = ["//visibility:public"],
deps = [
":lanelet2_core",
":lanelet2_io",
"@geographiclib",
],
)

cc_library(
name = "lanelet2_routing",
srcs = glob(["lanelet2_routing/src/**/*.cpp"]),
hdrs = glob(["lanelet2_routing/include/**/*.h"]),
includes = ["lanelet2_routing/include"],
visibility = ["//visibility:public"],
deps = [
":lanelet2_core",
":lanelet2_traffic_rules",
"@boost.geometry",
"@boost.graph",
"@boost.property_map",
],
)

cc_library(
name = "lanelet2_traffic_rules",
srcs = glob(["lanelet2_traffic_rules/src/**/*.cpp"]),
hdrs = glob(["lanelet2_traffic_rules/include/**/*.h"]),
includes = ["lanelet2_traffic_rules/include"],
visibility = ["//visibility:public"],
deps = [":lanelet2_core"],
)

cc_library(
name = "lanelet2_validation",
srcs = glob(["lanelet2_validation/src/**/*.cpp"]),
hdrs = glob(["lanelet2_validation/include/**/*.h"]),
includes = ["lanelet2_validation/include"],
visibility = ["//visibility:public"],
deps = [
":lanelet2_core",
":lanelet2_io",
":lanelet2_projection",
":lanelet2_routing",
":lanelet2_traffic_rules",
"@boost.program_options",
],
)

#################################################################################
# Tests
#################################################################################
cc_test(
name = "lanelet2_core_test",
size = "small",
srcs = glob([
"lanelet2_core/test/*.cpp",
"lanelet2_core/test/*.h",
]),
copts = ["-Wno-sign-compare"],
deps = [
":lanelet2_core",
"@boost.geometry",
"@boost.optional",
"@com_google_googletest//:gtest_main",
],
)

cc_test(
name = "lanelet2_io_test",
size = "small",
srcs = glob([
"lanelet2_io/test/*.cpp",
"lanelet2_io/test/*.h",
]),
data = [":lanelet2_maps_osm_files"],
deps = [
":lanelet2_core",
":lanelet2_io",
"@boost.filesystem",
"@boost.serialization",
"@com_google_googletest//:gtest_main",
],
)

cc_test(
name = "lanelet2_matching_test",
size = "small",
srcs = glob(["lanelet2_matching/test/*.cpp"]),
deps = [
":lanelet2_io",
":lanelet2_matching",
":lanelet2_projection",
":lanelet2_traffic_rules",
"@com_google_googletest//:gtest_main",
],
)

cc_test(
name = "lanelet2_projection_test",
size = "small",
srcs = glob(["lanelet2_projection/test/*.cpp"]),
deps = [
":lanelet2_projection",
"@com_google_googletest//:gtest_main",
],
)

cc_test(
name = "lanelet2_routing_test",
size = "small",
srcs = glob([
"lanelet2_routing/test/*.cpp",
"lanelet2_routing/test/*.h",
]),
deps = [
":lanelet2_core",
":lanelet2_routing",
":lanelet2_traffic_rules",
"@boost.filesystem",
"@boost.geometry",
"@boost.optional",
"@com_google_googletest//:gtest_main",
],
)

cc_test(
name = "lanelet2_traffic_rules_test",
size = "small",
srcs = glob(["lanelet2_traffic_rules/test/*.cpp"]),
deps = [
":lanelet2_core",
":lanelet2_traffic_rules",
"@com_google_googletest//:gtest_main",
],
)

cc_test(
name = "lanelet2_validation_test",
size = "small",
srcs = glob(["lanelet2_validation/test/*.cpp"]),
data = [":lanelet2_maps_osm_files"],
deps = [
":lanelet2_core",
":lanelet2_io",
":lanelet2_projection",
":lanelet2_validation",
"@com_google_googletest//:gtest_main",
],
)
1 change: 1 addition & 0 deletions modules/lanelet2/1.2.1/overlay/MODULE.bazel
48 changes: 48 additions & 0 deletions modules/lanelet2/1.2.1/patches/bazel_test_paths.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
diff --git a/lanelet2_io/test/TestBinHandler.cpp b/lanelet2_io/test/TestBinHandler.cpp
index c9868ab..a2c1b75 100644
--- a/lanelet2_io/test/TestBinHandler.cpp
+++ b/lanelet2_io/test/TestBinHandler.cpp
@@ -115,7 +115,7 @@ TEST(BinHandler, explicitIO) { // NOLINT

TEST(BinHandler, fullMap) {
Origin origin({49, 8.4, 0});
- std::string filenameIn = "../../lanelet2_maps/res/mapping_example.osm";
+ std::string filenameIn = "../lanelet2~/lanelet2_maps/res/mapping_example.osm";
auto map = lanelet::load(filenameIn, origin);
auto llt = map->laneletLayer.find(44968);
writeAndLoad(*llt);
diff --git a/lanelet2_io/test/TestSimpleUsage.cpp b/lanelet2_io/test/TestSimpleUsage.cpp
index 792f69d..a21fa86 100644
--- a/lanelet2_io/test/TestSimpleUsage.cpp
+++ b/lanelet2_io/test/TestSimpleUsage.cpp
@@ -5,7 +5,7 @@
TEST(lanelet2_io, exampleUsage) { // NOLINT
using namespace lanelet;
Origin origin({49, 8.4, 0});
- std::string filenameIn = "../../lanelet2_maps/res/mapping_example.osm";
+ std::string filenameIn = "../lanelet2~/lanelet2_maps/res/mapping_example.osm";
LaneletMapPtr laneletMap = lanelet::load(filenameIn, origin);

lanelet::test_setup::Tempfile file("file.osm");
diff --git a/lanelet2_validation/test/lanelet2_validation.cpp b/lanelet2_validation/test/lanelet2_validation.cpp
index 3e30df4..47d4c83 100644
--- a/lanelet2_validation/test/lanelet2_validation.cpp
+++ b/lanelet2_validation/test/lanelet2_validation.cpp
@@ -9,7 +9,7 @@
#include "lanelet2_validation/Validation.h"

TEST(TestAllValidators, onExampleMap) { // NOLINT
- const char* args[] = {"validator", "../../lanelet2_maps/res/mapping_example.osm",
+ const char* args[] = {"validator", "../lanelet2~/lanelet2_maps/res/mapping_example.osm",
"--participants", "vehicle",
"--participants", "pedestrian",
"--lat", "49",
@@ -32,7 +32,7 @@ TEST(Validator, pointsTooClose) { // NOLINT
}

TEST(Validator, curvatureTooBig) { // NOLINT
- std::string exampleMapPath = "../../lanelet2_maps/res/mapping_example.osm";
+ std::string exampleMapPath = "../lanelet2~/lanelet2_maps/res/mapping_example.osm";
using namespace lanelet;
projection::UtmProjector projector(Origin({49, 8.4}));
LaneletMapPtr map = load(exampleMapPath, projector);
26 changes: 26 additions & 0 deletions modules/lanelet2/1.2.1/patches/fix_test_include_paths.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
diff --git a/lanelet2_core/test/test_linestring.cpp b/lanelet2_core/test/test_linestring.cpp
index b8242ee..e002787 100644
--- a/lanelet2_core/test/test_linestring.cpp
+++ b/lanelet2_core/test/test_linestring.cpp
@@ -5,7 +5,7 @@

#include "lanelet2_core/geometry/LineString.h"
#include "lanelet2_core/primitives/LineString.h"
-#include "primitives/Traits.h"
+#include "lanelet2_core/primitives/Traits.h"
using namespace lanelet;

class LineStringPoints : public ::testing::Test {
diff --git a/lanelet2_matching/test/lanelet2_matching.cpp b/lanelet2_matching/test/lanelet2_matching.cpp
index c47194e..5b84b54 100644
--- a/lanelet2_matching/test/lanelet2_matching.cpp
+++ b/lanelet2_matching/test/lanelet2_matching.cpp
@@ -33,7 +33,7 @@
#include <lanelet2_traffic_rules/TrafficRules.h>
#include <lanelet2_traffic_rules/TrafficRulesFactory.h>

-#include "LaneletMatching.h"
+#include "lanelet2_matching/LaneletMatching.h"
#include "gtest/gtest.h"

using namespace lanelet;
14 changes: 14 additions & 0 deletions modules/lanelet2/1.2.1/source.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"url": "https://github.com/fzi-forschungszentrum-informatik/Lanelet2/archive/refs/tags/1.2.1.tar.gz",
"integrity": "sha256-7fjbxyE5hUBZ8jddMj5bBwSLeGdlj/9fMSlGnVDYJes=",
"strip_prefix": "Lanelet2-1.2.1",
"patches": {
"bazel_test_paths.patch": "sha256-8snNURNG2CCMOzecFPYHtdEAq5cGRwslAAYe9lShJCo=",
"fix_test_include_paths.patch": "sha256-iaAuQFKvVknHYUzSmFpsnXx5auhE1RqpXIKS9qK+C2E="
},
"overlay": {
"BUILD.bazel": "sha256-ILVS6eeAAv/vUWj6So2Iy85YUi/80d3eBpgSqA1SPU0=",
"MODULE.bazel": "sha256-lj6BzIv7yZmtEd+TQBI82tSzxaoIT/JzvfOjZYAn6Yo="
},
"patch_strip": 1
}
17 changes: 17 additions & 0 deletions modules/lanelet2/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"homepage": "https://github.com/fzi-forschungszentrum-informatik/Lanelet2",
"maintainers": [
{
"email": "[email protected]",
"github": "kgreenek",
"name": "Kevin Greene"
}
],
"repository": [
"github:fzi-forschungszentrum-informatik/Lanelet2"
],
"versions": [
"1.2.1",
],
"yanked_versions": {}
}

0 comments on commit 7bc8e0a

Please sign in to comment.