From 1ca0ce336ca928a88ee229952aecea317db7da4a Mon Sep 17 00:00:00 2001 From: storypku Date: Wed, 22 Jul 2020 03:45:15 -0700 Subject: [PATCH] Build: explicit console_bridge dependency --- modules/tools/visualizer/BUILD | 2 +- third_party/BUILD | 7 ------- third_party/console_bridge/BUILD | 3 +++ third_party/console_bridge/console_bridge.BUILD | 16 ++++++++++++++++ third_party/console_bridge/workspace.bzl | 15 +++++++++++++++ tools/workspace.bzl | 2 ++ 6 files changed, 37 insertions(+), 8 deletions(-) create mode 100644 third_party/console_bridge/BUILD create mode 100644 third_party/console_bridge/console_bridge.BUILD create mode 100644 third_party/console_bridge/workspace.bzl diff --git a/modules/tools/visualizer/BUILD b/modules/tools/visualizer/BUILD index e3458efe9a..74ceeaa88a 100644 --- a/modules/tools/visualizer/BUILD +++ b/modules/tools/visualizer/BUILD @@ -16,8 +16,8 @@ cc_binary( ], deps = [ ":visualizer_lib", - "//third_party:console_bridge", "//third_party:glvnd", + "@console_bridge", "@fastrtps", "@qt//:qt_core", "@qt//:qt_gui", diff --git a/third_party/BUILD b/third_party/BUILD index 18ab0d03e3..2381c48289 100644 --- a/third_party/BUILD +++ b/third_party/BUILD @@ -44,13 +44,6 @@ cc_library( ], ) -cc_library( - name = "console_bridge", - linkopts = [ - "-lconsole_bridge", - ], -) - cc_library( name = "glvnd", linkopts = [ diff --git a/third_party/console_bridge/BUILD b/third_party/console_bridge/BUILD new file mode 100644 index 0000000000..67cb1e21da --- /dev/null +++ b/third_party/console_bridge/BUILD @@ -0,0 +1,3 @@ +package( + default_visibility = ["//visibility:public"], +) diff --git a/third_party/console_bridge/console_bridge.BUILD b/third_party/console_bridge/console_bridge.BUILD new file mode 100644 index 0000000000..71793d39d2 --- /dev/null +++ b/third_party/console_bridge/console_bridge.BUILD @@ -0,0 +1,16 @@ +load("@rules_cc//cc:defs.bzl", "cc_library") + +package(default_visibility = ["//visibility:public"]) + +licenses(["notice"]) + +cc_library( + name = "console_bridge", + includes = [ + ".", + ], + linkopts = [ + "-lconsole_bridge", + ], + linkstatic = False, +) diff --git a/third_party/console_bridge/workspace.bzl b/third_party/console_bridge/workspace.bzl new file mode 100644 index 0000000000..0f6fbb3794 --- /dev/null +++ b/third_party/console_bridge/workspace.bzl @@ -0,0 +1,15 @@ +"""Loads the console_bridge library""" + +# Sanitize a dependency so that it works correctly from code that includes +# Apollo as a submodule. +def clean_dep(dep): + return str(Label(dep)) + +# Installed via apt-get -y libconsole-bridge-dev +def repo(): + # console_bridge + native.new_local_repository( + name = "console_bridge", + build_file = clean_dep("//third_party/console_bridge:console_bridge.BUILD"), + path = "/usr/include", + ) diff --git a/tools/workspace.bzl b/tools/workspace.bzl index cea62fc9de..bf8fb21284 100644 --- a/tools/workspace.bzl +++ b/tools/workspace.bzl @@ -5,6 +5,7 @@ load("//third_party/absl:workspace.bzl", absl = "repo") load("//third_party/ad_rss_lib:workspace.bzl", ad_rss_lib = "repo") load("//third_party/boost:workspace.bzl", boost = "repo") load("//third_party/civetweb:workspace.bzl", civetweb = "repo") +load("//third_party/console_bridge:workspace.bzl", console_bridge = "repo") load("//third_party/cpplint:workspace.bzl", cpplint = "repo") load("//third_party/eigen3:workspace.bzl", eigen = "repo") load("//third_party/ffmpeg:workspace.bzl", ffmpeg = "repo") @@ -45,6 +46,7 @@ def initialize_third_party(): adv_plat() ad_rss_lib() boost() + console_bridge() cpplint() civetweb() eigen() -- GitLab