Skip to content

Commit

Permalink
Add libccd dependency (#71)
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Carroll <[email protected]>
  • Loading branch information
mjcarroll authored Feb 15, 2024
1 parent 9a00965 commit 67304ef
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 0 deletions.
3 changes: 3 additions & 0 deletions workspace/ccd/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()
17 changes: 17 additions & 0 deletions workspace/ccd/package.BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# -*- python -*-

load(":vars.bzl", "LIBDIR")

cc_library(
name = "ccd",
hdrs = glob([
"include/fcl/*.h",
]),
includes = ["include"],
linkopts = [
"-L" + LIBDIR,
"-Wl,-rpath," + LIBDIR,
"-lccd",
],
visibility = ["//visibility:public"],
)
30 changes: 30 additions & 0 deletions workspace/ccd/repository.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
load("@gz//bazel/workspace:os.bzl", "determine_os")

def _impl(repository_ctx):
os_result = determine_os(repository_ctx)

if os_result.error != None:
fail(os_result.error)

if os_result.is_ubuntu or os_result.is_debian:
libdir = "/usr/lib"
repository_ctx.symlink("/usr/include/ccd", "include/ccd")

# Declare the libdir
repository_ctx.file(
"vars.bzl",
content = "LIBDIR = \"{}\"\n".format(libdir),
executable = False,
)

# Add the BUILD file.
repository_ctx.symlink(
Label("@gz//bazel/workspace/ccd:package.BUILD.bazel"),
"BUILD.bazel",
)

ccd_repository = repository_rule(
local = True,
configure = True,
implementation = _impl,
)
3 changes: 3 additions & 0 deletions workspace/default.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ load("@gz//bazel/workspace/assimp:repository.bzl", "assimp_repository") # noqa
load("@gz//bazel/workspace/backward:repository.bzl", "backward_repository") # noqa
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/ccd:repository.bzl", "ccd_repository") # noqa
load("@gz//bazel/workspace/cli11:repository.bzl", "cli11_repository") # noqa
load("@gz//bazel/workspace/curl:repository.bzl", "curl_repository") # noqa
load("@gz//bazel/workspace/eigen3:repository.bzl", "eigen3_repository") # noqa
Expand Down Expand Up @@ -60,6 +61,8 @@ 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 "ccd" not in excludes:
ccd_repository(name = "ccd")
if "cli11" not in excludes:
cli11_repository(name = "cli11", mirrors = mirrors)
if "curl" not in excludes:
Expand Down

0 comments on commit 67304ef

Please sign in to comment.