Skip to content

Commit

Permalink
Add repo and dependencies for utils
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Carroll <[email protected]>
  • Loading branch information
mjcarroll committed Feb 15, 2023
1 parent 2a1c81d commit 3ae3595
Show file tree
Hide file tree
Showing 8 changed files with 110 additions and 0 deletions.
4 changes: 4 additions & 0 deletions example/bazel.repos
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
repositories:
utils:
type: git
url: https://github.com/gazebosim/gz-utils
version: gz-utils2
3 changes: 3 additions & 0 deletions workspace/cli11/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
load("@gz//bazel/lint:lint.bzl", "add_lint_tests")

add_lint_tests()
14 changes: 14 additions & 0 deletions workspace/cli11/package.BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# -*- python -*-

licenses(["notice"]) # BSD-3-Clause

cc_library(
name = "cli11",
hdrs = glob([
"include/CLI/*.hpp",
]),
includes = [
"include",
],
visibility = ["//visibility:public"],
)
13 changes: 13 additions & 0 deletions workspace/cli11/repository.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# -*- python -*-

load("@gz//bazel/workspace:github.bzl", "github_archive")

def cli11_repository(name, mirrors = None):
github_archive(
name = name,
repository = "CLIUtils/CLI11",
commit = "v2.2.0",
sha256 = "d60440dc4d43255f872d174e416705f56ba40589f6eb07727f76376fb8378fd6", # noqa
build_file = ":package.BUILD.bazel",
mirrors = mirrors,
)
6 changes: 6 additions & 0 deletions workspace/default.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ load("@gz//bazel/workspace:mirrors.bzl", "DEFAULT_MIRRORS")
load("@gz//bazel/workspace:os.bzl", "os_repository")
load("@gz//bazel/workspace/bazel_skylib:repository.bzl", "bazel_skylib_repository") # noqa
load("@gz//bazel/workspace/buildifier:repository.bzl", "buildifier_repository") # noqa
load("@gz//bazel/workspace/cli11:repository.bzl", "cli11_repository") # noqa
load("@gz//bazel/workspace/gtest:repository.bzl", "gtest_repository") # noqa
load("@gz//bazel/workspace/pycodestyle:repository.bzl", "pycodestyle_repository") # noqa
load("@gz//bazel/workspace/rules_python:repository.bzl", "rules_python_repository") # noqa

Expand All @@ -20,6 +22,10 @@ def add_default_repositories(excludes = [], mirrors = DEFAULT_MIRRORS):
bazel_skylib_repository(name = "bazel_skylib", mirrors = mirrors)
if "buildifier" not in excludes:
buildifier_repository(name = "buildifier", mirrors = mirrors)
if "cli11" not in excludes:
cli11_repository(name = "cli11", mirrors = mirrors)
if "gtest" not in excludes:
gtest_repository(name = "gtest", mirrors = mirrors)
if "pycodestyle" not in excludes:
pycodestyle_repository(name = "pycodestyle", mirrors = mirrors)
if "rules_python" not in excludes:
Expand Down
Empty file added workspace/gtest/BUILD.bazel
Empty file.
55 changes: 55 additions & 0 deletions workspace/gtest/package.BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# -*- python -*-

licenses(["notice"]) # BSD-3-Clause

config_setting(
name = "linux",
values = {"cpu": "k8"},
)

cc_library(
name = "gtest",
testonly = 1,
srcs = glob(
[
"googlemock/src/*.cc",
"googletest/src/*.cc",
"googletest/src/*.h",
],
exclude = [
"googlemock/src/gmock_main.cc",
"googletest/src/gtest_main.cc",
"googlemock/src/gmock-all.cc",
"googletest/src/gtest-all.cc",
],
),
hdrs = glob([
"googlemock/include/**/*.h",
"googletest/include/**/*.h",
]),
copts = ["-Wno-unused-const-variable"],
includes = [
"googlemock",
"googlemock/include",
"googletest",
"googletest/include",
],
linkopts = select({
":linux": ["-pthread"],
# This is a bazel-default rule, and does not need @drake//
"@//conditions:default": [],
}),
linkstatic = 1,
visibility = ["//visibility:public"],
)

cc_library(
name = "gtest_main",
testonly = 1,
srcs = ["googlemock/src/gmock_main.cc"],
linkstatic = 1,
visibility = ["//visibility:public"],
deps = [
":gtest",
],
)
15 changes: 15 additions & 0 deletions workspace/gtest/repository.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# -*- python -*-

load("@gz//bazel/workspace:github.bzl", "github_archive")

def gtest_repository(
name,
mirrors = None):
github_archive(
name = name,
repository = "google/googletest",
commit = "release-1.12.1",
sha256 = "81964fe578e9bd7c94dfdb09c8e4d6e6759e19967e397dbea48d1c10e45d0df2", # noqa
build_file = ":package.BUILD.bazel",
mirrors = mirrors,
)

0 comments on commit 3ae3595

Please sign in to comment.