Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Carroll <[email protected]>
  • Loading branch information
mjcarroll committed Sep 16, 2024
1 parent 9700a6e commit 6e54b20
Show file tree
Hide file tree
Showing 3 changed files with 114 additions and 1 deletion.
112 changes: 112 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
load("@rules_gz//gz:headers.bzl", "gz_configure_header", "gz_export_header")
load("@buildifier_prebuilt//:rules.bzl", "buildifier", "buildifier_test")
load("@rules_license//rules:license.bzl", "license")

Expand All @@ -17,6 +18,117 @@ exports_files([
"MODULE.bazel",
])

gz_configure_header(
name = "config",
src = "include/sdf/config.hh.in",
cmakelists = ["CMakeLists.txt"],
defines = {
"CMAKE_INSTALL_FULL_DATAROOTDIR": "unused",
"PROJECT_NAME": "sdformat",
"PROJECT_VERSION": "15.0.0",
"PROJECT_VERSION_FULL": "15.0.0",
"PROJECT_VERSION_MAJOR": "15",
"PROJECT_VERSION_MINOR": "0",
"PROJECT_VERSION_PATCH": "0",
"SDF_PROTOCOL_VERSION": "1.12",
},
package = "sdformat",
)

gz_export_header(
name = "include/sdf/Export.hh",
export_base = "GZ_SDFORMAT",
lib_name = "sdformat",
visibility = ["//visibility:private"],
)

public_headers_no_gen = glob([
"include/sdf/*.h",
"include/sdf/*.hh",
])

private_headers = glob(["src/*.hh"])

sources = glob(
["src/*.cc"],
exclude = [
"src/*_TEST.cc",
"src/InstallationDirectories.cc",
],
)

public_headers = public_headers_no_gen + [
"include/sdf/config.hh",
"include/sdf/Export.hh",
]

cc_library(
name = "installation_directories",
srcs = ["src/InstallationDirectories.cc"],
hdrs = [
"include/sdf/Export.hh",
"include/sdf/InstallationDirectories.hh",
"include/sdf/config.hh",
"include/sdf/sdf_config.h",
"include/sdf/system_util.hh",
],
defines = [
'CMAKE_INSTALL_RELATIVE_DATAROOTDIR=\\"unused\\"',
],
includes = ["include"],
visibility = ["//visibility:private"],
)

cc_library(
name = "urdf_parser",
srcs = [
"src/urdf/urdf_parser/joint.cpp",
"src/urdf/urdf_parser/link.cpp",
"src/urdf/urdf_parser/model.cpp",
"src/urdf/urdf_parser/pose.cpp",
"src/urdf/urdf_parser/twist.cpp",
"src/urdf/urdf_parser/urdf_model_state.cpp",
"src/urdf/urdf_parser/urdf_sensor.cpp",
"src/urdf/urdf_parser/world.cpp",
],
hdrs = glob(
["src/urdf/**/*.h"],
),
copts = ["-Wno-unknown-pragmas"],
includes = ["src/urdf"],
deps = [
"@tinyxml2",
],
)

cc_library(
name = "sdformat",
srcs = sources + private_headers,
hdrs = public_headers,
includes = ["include"],
visibility = ["//visibility:public"],
deps = [
":installation_directories",
":urdf_parser",
"@gz-math",
"@gz-utils",
],
)

[cc_test(
name = src.replace("/", "_").replace(".cc", "").replace("src_", ""),
srcs = [src],
env = {
"GZ_BAZEL": "1",
"GZ_BAZEL_PATH": "sdformat",
},
deps = [
":sdformat",
"@gtest",
"@gtest//:gtest_main",
],
) for src in test_sources]

# Bazel linting
buildifier(
name = "buildifier.fix",
Expand Down
1 change: 1 addition & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ module(
bazel_dep(name = "buildifier_prebuilt", version = "6.1.2")
bazel_dep(name = "googletest", version = "1.14.0")
bazel_dep(name = "rules_license", version = "0.0.8")
bazel_dep(name = "tinyxml2", version = "10.0.0")

# Gazebo Dependencies
bazel_dep(name = "rules_gz")
Expand Down
2 changes: 1 addition & 1 deletion src/parser_urdf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
#include <urdf_parser/urdf_parser.h>

#include "sdf/Error.hh"
#include "sdf/sdf.hh"
#include "sdf/Types.hh"
#include "sdf/Frame.hh"

#include "XmlUtils.hh"
#include "SDFExtension.hh"
Expand Down

0 comments on commit 6e54b20

Please sign in to comment.