Skip to content

Commit

Permalink
Support for bazel in Garden (#95)
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Carroll <michael@openrobotics.org>
  • Loading branch information
mjcarroll authored Feb 15, 2023
1 parent 9bd7327 commit 135a6f6
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 42 deletions.
51 changes: 31 additions & 20 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,35 +1,26 @@
load(
"//gz_bazel:build_defs.bzl",
"@gz//bazel/skylark:build_defs.bzl",
"GZ_FEATURES",
"GZ_VISIBILITY",
"generate_include_header",
"gz_config_header",
"gz_configure_header",
"gz_export_header",
"gz_include_header",
)

package(
default_visibility = GZ_VISIBILITY,
features = GZ_FEATURES,
)

licenses(["notice"])
licenses(["notice"]) # Apache-2.0

exports_files(["LICENSE"])

PROJECT_NAME = "gz-utils"

PROJECT_MAJOR = 2

PROJECT_MINOR = 0

PROJECT_PATCH = 0

gz_config_header(
gz_configure_header(
name = "config",
src = "include/gz/utils/config.hh.in",
cmakelists = ["CMakeLists.txt"],
project_name = PROJECT_NAME,
project_version = (PROJECT_MAJOR, PROJECT_MINOR, PROJECT_PATCH),
package = "utils",
)

gz_export_header(
Expand All @@ -41,10 +32,10 @@ gz_export_header(

public_headers_no_gen = glob([
"include/gz/utils/*.hh",
"include/gz/utils/detail/*.hh"
"include/gz/utils/detail/*.hh",
])

generate_include_header(
gz_include_header(
name = "utilshh_genrule",
out = "include/gz/utils.hh",
hdrs = public_headers_no_gen + [
Expand All @@ -60,7 +51,8 @@ public_headers = public_headers_no_gen + [
]

cc_library(
name = "gz_utils",
name = "utils",
srcs = ["src/Environment.cc"],
hdrs = public_headers,
includes = ["include"],
)
Expand All @@ -75,7 +67,7 @@ cc_library(
"test/integration/implptr/implptr_test_classes.hh",
],
includes = ["test/integration/implptr"],
deps = ["gz_utils"],
deps = [":utils"],
)

cc_test(
Expand All @@ -85,6 +77,25 @@ cc_test(
":implptr_test_classes",
"@gtest",
"@gtest//:gtest_main",
]
],
)

cc_test(
name = "Environment_TEST",
srcs = ["src/Environment_TEST.cc"],
deps = [
":utils",
"@gtest",
"@gtest//:gtest_main",
],
)

cc_test(
name = "NeverDestroyed_TEST",
srcs = ["src/NeverDestroyed_TEST.cc"],
deps = [
":utils",
"@gtest",
"@gtest//:gtest_main",
],
)
33 changes: 11 additions & 22 deletions cli/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,32 +1,21 @@
load(
"//gz_bazel:build_defs.bzl",
"@gz//bazel/skylark:build_defs.bzl",
"GZ_VISIBILITY",
)

package(
default_visibility = GZ_VISIBILITY,
)

public_headers = [
"include/gz/utils/cli/App.hpp",
"include/gz/utils/cli/CLI.hpp",
"include/gz/utils/cli/ConfigFwd.hpp",
"include/gz/utils/cli/Config.hpp",
"include/gz/utils/cli/Error.hpp",
"include/gz/utils/cli/FormatterFwd.hpp",
"include/gz/utils/cli/Formatter.hpp",
"include/gz/utils/cli/Macros.hpp",
"include/gz/utils/cli/Option.hpp",
"include/gz/utils/cli/Split.hpp",
"include/gz/utils/cli/StringTools.hpp",
"include/gz/utils/cli/Timer.hpp",
"include/gz/utils/cli/TypeTools.hpp",
"include/gz/utils/cli/Validators.hpp",
"include/gz/utils/cli/Version.hpp",
]
"include/gz/utils/cli/GzFormatter.hpp",
] + glob([
"include/external-cli/gz/utils/cli/*.hpp",
])

cc_library(
name = "cli",
hdrs = public_headers,
includes = ["include"],
includes = [
"include",
"include/external-cli",
],
visibility = GZ_VISIBILITY,
deps = ["@cli11"],
)

0 comments on commit 135a6f6

Please sign in to comment.