Skip to content

Commit

Permalink
Merge pull request RobotLocomotion#12279 from jamiesnape/gcc-wno-unus…
Browse files Browse the repository at this point in the history
…ed-lambda-capture

Do not use -Wno-unused-lambda-capture with GCC
  • Loading branch information
soonho-tri authored Oct 30, 2019
2 parents 1b70691 + 5372bd6 commit e0a69ae
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions tools/skylark/pybind.bzl
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# -*- python -*-

load("@cc//:compiler.bzl", "COMPILER_ID")

# @see bazelbuild/bazel#3493 for needing `@drake//` when loading `install`.
load("@drake//tools/install:install.bzl", "install")
load(
Expand Down Expand Up @@ -53,18 +55,21 @@ def pybind_py_library(
# output a *.so, so that the target name is similar to what is provided.
cc_so_target = cc_so_name + ".so"

# GCC and Clang don't always agree / succeed when inferring storage
# duration (#9600). Workaround it for now.
if COMPILER_ID.endswith("Clang"):
copts = ["-Wno-unused-lambda-capture"] + cc_copts
else:
copts = cc_copts

# Add C++ shared library.
cc_binary_rule(
name = cc_so_target,
srcs = cc_srcs,
# This is how you tell Bazel to create a shared library.
linkshared = 1,
linkstatic = 1,
copts = [
# GCC and Clang don't always agree / succeed when inferring storage
# duration (#9600). Workaround it for now.
"-Wno-unused-lambda-capture",
] + cc_copts,
copts = copts,
# Always link to pybind11.
deps = [
"@pybind11",
Expand Down

0 comments on commit e0a69ae

Please sign in to comment.