Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use linkstatic=1 by default in binaries and libraries. #5155

Merged
merged 1 commit into from
Feb 13, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions tools/drake.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,21 @@ def drake_cc_library(
srcs=None,
deps=None,
copts=[],
linkstatic=1,
**kwargs):
"""Creates a rule to declare a C++ library."""
"""Creates a rule to declare a C++ library.

By default, we produce only static libraries, to reduce compilation time
on all platforms, and to avoid mysterious dyld errors on OS X. This default
could be revisited if binary size becomes a concern.
"""
native.cc_library(
name=name,
hdrs=hdrs,
srcs=srcs,
deps=deps,
copts=_platform_copts(copts),
linkstatic=linkstatic,
**kwargs)

def drake_cc_binary(
Expand All @@ -51,14 +58,20 @@ def drake_cc_binary(
srcs=None,
deps=None,
copts=[],
linkstatic=1,
**kwargs):
"""Creates a rule to declare a C++ binary."""
"""Creates a rule to declare a C++ binary.

By default, we prefer to link static libraries whenever they are available.
This default could be revisited if binary size becomes a concern.
"""
native.cc_binary(
name=name,
hdrs=hdrs,
srcs=srcs,
deps=deps,
copts=_platform_copts(copts),
linkstatic=linkstatic,
**kwargs)

def drake_cc_googletest(
Expand Down