Skip to content

Commit

Permalink
Use yaml-cpp from system on Xenial and homebrew on MacOS. (#7602)
Browse files Browse the repository at this point in the history
* Use yaml_cpp from Ubuntu Xenial.

This removes the bazel external yaml_cpp and replaces it with system
yaml_cpp found via pkg-config.

Using the system version cuts down on the size of libdrake.so and
improves linking compatibility when using Drake within systems that
use the system yaml-cpp version.

This change was previously introduced in #7352 and later reverted
(#7403) due to issues with the MacOS build. Other portions of that
original pull request were reintroduced in #7453.
  • Loading branch information
nuclearsandwich authored and jwnimmer-tri committed Jan 9, 2018
1 parent f47ae21 commit 731865a
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 90 deletions.
9 changes: 4 additions & 5 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -315,12 +315,11 @@ github_archive(
build_file = "tools/workspace/tinyobjloader/tinyobjloader.BUILD.bazel",
)

github_archive(
pkg_config_package(
name = "yaml_cpp",
repository = "jbeder/yaml-cpp",
commit = "85af926ddc5f3c8fb438001743e65ec3a039ceec",
sha256 = "907fb42a502e1448a73959f9a648771b070d6d8513f16d74149f775fc56550ef", # noqa
build_file = "tools/workspace/yaml_cpp/yaml_cpp.BUILD.bazel",
atleast_version = "0.5.2",
build_file_template = "@drake//tools/workspace/yaml_cpp:yaml_cpp.BUILD.tpl", # noqa
modname = "yaml-cpp",
)

load("//tools/workspace/buildifier:buildifier.bzl", "buildifier_repository")
Expand Down
13 changes: 5 additions & 8 deletions tools/install/libdrake/drake.cps
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,6 @@
"Version": "1.0.4",
"Hints": ["@prefix@/lib/cmake/tinyobjloader"],
"X-CMake-Find-Args": ["CONFIG"]
},
"yaml-cpp": {
"Version": "0.5.5",
"Hints": ["@prefix@/lib/cmake/yaml-cpp"],
"X-CMake-Find-Args": ["CONFIG"]
}
},
"Default-Components": [":drake"],
Expand All @@ -94,12 +89,14 @@
"Location": "@prefix@/lib/libdrake.so",
"Includes": ["@prefix@/include"],
"Compile-Features": ["c++14"],
"Link-Flags": ["-ltinyxml2"],
"Link-Flags": [
"-ltinyxml2",
"-lyaml-cpp"
],
"Link-Requires": [
"fmt:fmt",
"SDFormat:sdformat",
"tinyobjloader:tinyobjloader",
"yaml-cpp:yaml-cpp"
"tinyobjloader:tinyobjloader"
],
"Requires": [
":drake-lcmtypes-cpp",
Expand Down
1 change: 0 additions & 1 deletion tools/workspace/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ _DRAKE_EXTERNAL_PACKAGE_INSTALLS = ["@%s//:install" % p for p in [
"tinydir",
"tinyobjloader",
"vtk",
"yaml_cpp",
]] + ["//tools/workspace/%s:install" % p for p in [
"jchart2d",
"optitrack_driver",
Expand Down
5 changes: 0 additions & 5 deletions tools/workspace/yaml_cpp/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,4 @@

load("//tools/lint:lint.bzl", "add_lint_tests")

exports_files(
["yaml_cpp-create-cps.py"],
visibility = ["@yaml_cpp//:__pkg__"],
)

add_lint_tests()
25 changes: 0 additions & 25 deletions tools/workspace/yaml_cpp/yaml_cpp-create-cps.py

This file was deleted.

46 changes: 0 additions & 46 deletions tools/workspace/yaml_cpp/yaml_cpp.BUILD.bazel

This file was deleted.

18 changes: 18 additions & 0 deletions tools/workspace/yaml_cpp/yaml_cpp.BUILD.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Altered copy of the pkg_config_package build template.
# Adds a hard-coded dependency on "@boost" to work around a yaml-cpp
# misconfiguration.
# https://github.com/RobotLocomotion/drake/pull/7602#issuecomment-353093726

package(
default_visibility = ["//visibility:public"],
)

cc_library(
name = "%{name}",
srcs = ["%{srcs}"],
hdrs = glob(["include/**"]),
defines = ["%{defines}"],
includes = ["%{includes}"],
linkopts = ["%{linkopts}"],
deps = ["@boost//:boost_headers"]
)

0 comments on commit 731865a

Please sign in to comment.