| <html devsite> |
| <head> |
| <meta name="project_path" value="/_project.yaml"> |
| <meta name="book_path" value="/versions/6.2.0/_book.yaml"> |
| </head> |
| <body> |
| |
| <h1 class="page-title" id="modules.cc_common">cc_common</h1> |
| |
| <!-- {% raw %} --> |
| |
| Utilities for C++ compilation, linking, and command line generation. |
| |
| <h2>Members</h2> |
| <ul> |
| <li> |
| <a href="#action_is_enabled">action_is_enabled</a> |
| </li> |
| <li> |
| <a href="#CcToolchainInfo">CcToolchainInfo</a> |
| </li> |
| <li> |
| <a href="#compile">compile</a> |
| </li> |
| <li> |
| <a href="#configure_features">configure_features</a> |
| </li> |
| <li> |
| <a href="#create_cc_toolchain_config_info">create_cc_toolchain_config_info</a> |
| </li> |
| <li> |
| <a href="#create_compilation_context">create_compilation_context</a> |
| </li> |
| <li> |
| <a href="#create_compilation_outputs">create_compilation_outputs</a> |
| </li> |
| <li> |
| <a href="#create_compile_variables">create_compile_variables</a> |
| </li> |
| <li> |
| <a href="#create_library_to_link">create_library_to_link</a> |
| </li> |
| <li> |
| <a href="#create_link_variables">create_link_variables</a> |
| </li> |
| <li> |
| <a href="#create_linker_input">create_linker_input</a> |
| </li> |
| <li> |
| <a href="#create_linking_context">create_linking_context</a> |
| </li> |
| <li> |
| <a href="#create_linking_context_from_compilation_outputs">create_linking_context_from_compilation_outputs</a> |
| </li> |
| <li> |
| <a href="#do_not_use_tools_cpp_compiler_present">do_not_use_tools_cpp_compiler_present</a> |
| </li> |
| <li> |
| <a href="#get_environment_variables">get_environment_variables</a> |
| </li> |
| <li> |
| <a href="#get_execution_requirements">get_execution_requirements</a> |
| </li> |
| <li> |
| <a href="#get_memory_inefficient_command_line">get_memory_inefficient_command_line</a> |
| </li> |
| <li> |
| <a href="#get_tool_for_action">get_tool_for_action</a> |
| </li> |
| <li> |
| <a href="#is_enabled">is_enabled</a> |
| </li> |
| <li> |
| <a href="#link">link</a> |
| </li> |
| <li> |
| <a href="#merge_cc_infos">merge_cc_infos</a> |
| </li> |
| <li> |
| <a href="#merge_compilation_contexts">merge_compilation_contexts</a> |
| </li> |
| <li> |
| <a href="#merge_compilation_outputs">merge_compilation_outputs</a> |
| </li> |
| </ul> |
| |
| <h2 id="action_is_enabled">action_is_enabled</h2> |
| <p><pre class="rule-signature"><a class="anchor" href="bool.html">bool</a> cc_common.action_is_enabled(feature_configuration, action_name)</pre></p> |
| |
| Returns True if given action_config is enabled in the feature configuration. |
| |
| <!-- hide-from-toc is a class used by DevSite for the public Bazel site |
| (https://developers.google.com/devsite/reference/styles/headings#hide_headings_from_the_toc) --> |
| <h3 class="hide-from-toc">Parameters</h3> |
| <table class="table table-bordered table-condensed table-params"> |
| <colgroup> |
| <col class="col-param"> |
| <col class="param-description"> |
| </colgroup> |
| <thead> |
| <tr> |
| <th>Parameter</th> |
| <th>Description</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td id="action_is_enabled.feature_configuration"> |
| <code>feature_configuration</code> |
| </td> |
| <td> |
| required<br/> |
| Feature configuration to be queried. |
| </td> |
| </tr> |
| <tr> |
| <td id="action_is_enabled.action_name"> |
| <code>action_name</code> |
| </td> |
| <td> |
| required<br/> |
| Name of the action_config. |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| |
| <h2 id="CcToolchainInfo">CcToolchainInfo</h2> |
| <p><pre class="rule-signature"><a class="anchor" href="Provider.html">Provider</a> cc_common.CcToolchainInfo</pre></p> |
| |
| The key used to retrieve the provider that contains information about the C++ toolchain being used |
| |
| |
| <h2 id="compile">compile</h2> |
| <p><pre class="rule-signature"><a class="anchor" href="tuple.html">tuple</a> cc_common.compile(actions, feature_configuration, cc_toolchain, srcs=[], public_hdrs=[], private_hdrs=[], includes=[], quote_includes=[], system_includes=[], framework_includes=[], defines=[], local_defines=[], include_prefix='', strip_include_prefix='', user_compile_flags=[], compilation_contexts=[], name, disallow_pic_outputs=False, disallow_nopic_outputs=False, additional_inputs=[], grep_includes=None)</pre></p> |
| |
| Should be used for C++ compilation. Returns tuple of (<code>CompilationContext</code>, <code>CcCompilationOutputs</code>). |
| |
| <!-- hide-from-toc is a class used by DevSite for the public Bazel site |
| (https://developers.google.com/devsite/reference/styles/headings#hide_headings_from_the_toc) --> |
| <h3 class="hide-from-toc">Parameters</h3> |
| <table class="table table-bordered table-condensed table-params"> |
| <colgroup> |
| <col class="col-param"> |
| <col class="param-description"> |
| </colgroup> |
| <thead> |
| <tr> |
| <th>Parameter</th> |
| <th>Description</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td id="compile.actions"> |
| <code>actions</code> |
| </td> |
| <td> |
| required<br/> |
| <code>actions</code> object. |
| </td> |
| </tr> |
| <tr> |
| <td id="compile.feature_configuration"> |
| <code>feature_configuration</code> |
| </td> |
| <td> |
| required<br/> |
| <code>feature_configuration</code> to be queried. |
| </td> |
| </tr> |
| <tr> |
| <td id="compile.cc_toolchain"> |
| <code>cc_toolchain</code> |
| </td> |
| <td> |
| required<br/> |
| <code>CcToolchainInfo</code> provider to be used. |
| </td> |
| </tr> |
| <tr> |
| <td id="compile.srcs"> |
| <code>srcs</code> |
| </td> |
| <td> |
| default = []<br/> |
| The list of source files to be compiled. |
| </td> |
| </tr> |
| <tr> |
| <td id="compile.public_hdrs"> |
| <code>public_hdrs</code> |
| </td> |
| <td> |
| default = []<br/> |
| List of headers needed for compilation of srcs and may be included by dependent rules transitively. |
| </td> |
| </tr> |
| <tr> |
| <td id="compile.private_hdrs"> |
| <code>private_hdrs</code> |
| </td> |
| <td> |
| default = []<br/> |
| List of headers needed for compilation of srcs and NOT to be included by dependent rules. |
| </td> |
| </tr> |
| <tr> |
| <td id="compile.includes"> |
| <code>includes</code> |
| </td> |
| <td> |
| default = []<br/> |
| Search paths for header files referenced both by angle bracket and quotes. Usually passed with -I. Propagated to dependents transitively. |
| </td> |
| </tr> |
| <tr> |
| <td id="compile.quote_includes"> |
| <code>quote_includes</code> |
| </td> |
| <td> |
| default = []<br/> |
| Search paths for header files referenced by quotes, e.g. #include "foo/bar/header.h". They can be either relative to the exec root or absolute. Usually passed with -iquote. Propagated to dependents transitively. |
| </td> |
| </tr> |
| <tr> |
| <td id="compile.system_includes"> |
| <code>system_includes</code> |
| </td> |
| <td> |
| default = []<br/> |
| Search paths for header files referenced by angle brackets, e.g. #include <foo/bar/header.h>. They can be either relative to the exec root or absolute. Usually passed with -isystem. Propagated to dependents transitively. |
| </td> |
| </tr> |
| <tr> |
| <td id="compile.framework_includes"> |
| <code>framework_includes</code> |
| </td> |
| <td> |
| default = []<br/> |
| Search paths for header files from Apple frameworks. They can be either relative to the exec root or absolute. Usually passed with -F. Propagated to dependents transitively. |
| </td> |
| </tr> |
| <tr> |
| <td id="compile.defines"> |
| <code>defines</code> |
| </td> |
| <td> |
| default = []<br/> |
| Set of defines needed to compile this target. Each define is a string. Propagated to dependents transitively. |
| </td> |
| </tr> |
| <tr> |
| <td id="compile.local_defines"> |
| <code>local_defines</code> |
| </td> |
| <td> |
| default = []<br/> |
| Set of defines needed to compile this target. Each define is a string. Not propagated to dependents transitively. |
| </td> |
| </tr> |
| <tr> |
| <td id="compile.include_prefix"> |
| <code>include_prefix</code> |
| </td> |
| <td> |
| default = ''<br/> |
| The prefix to add to the paths of the headers of this rule. When set, the headers in the hdrs attribute of this rule are accessible at is the value of this attribute prepended to their repository-relative path. The prefix in the strip_include_prefix attribute is removed before this prefix is added. |
| </td> |
| </tr> |
| <tr> |
| <td id="compile.strip_include_prefix"> |
| <code>strip_include_prefix</code> |
| </td> |
| <td> |
| default = ''<br/> |
| The prefix to strip from the paths of the headers of this rule. When set, the headers in the hdrs attribute of this rule are accessible at their path with this prefix cut off. If it's a relative path, it's taken as a package-relative one. If it's an absolute one, it's understood as a repository-relative path. The prefix in the include_prefix attribute is added after this prefix is stripped. |
| </td> |
| </tr> |
| <tr> |
| <td id="compile.user_compile_flags"> |
| <code>user_compile_flags</code> |
| </td> |
| <td> |
| default = []<br/> |
| Additional list of compilation options. |
| </td> |
| </tr> |
| <tr> |
| <td id="compile.compilation_contexts"> |
| <code>compilation_contexts</code> |
| </td> |
| <td> |
| default = []<br/> |
| Headers from dependencies used for compilation. |
| </td> |
| </tr> |
| <tr> |
| <td id="compile.name"> |
| <code>name</code> |
| </td> |
| <td> |
| required<br/> |
| This is used for naming the output artifacts of actions created by this method. See also the `main_output` arg. |
| </td> |
| </tr> |
| <tr> |
| <td id="compile.disallow_pic_outputs"> |
| <code>disallow_pic_outputs</code> |
| </td> |
| <td> |
| default = False<br/> |
| Whether PIC outputs should be created. |
| </td> |
| </tr> |
| <tr> |
| <td id="compile.disallow_nopic_outputs"> |
| <code>disallow_nopic_outputs</code> |
| </td> |
| <td> |
| default = False<br/> |
| Whether NOPIC outputs should be created. |
| </td> |
| </tr> |
| <tr> |
| <td id="compile.additional_inputs"> |
| <code>additional_inputs</code> |
| </td> |
| <td> |
| default = []<br/> |
| List of additional files needed for compilation of srcs |
| </td> |
| </tr> |
| <tr> |
| <td id="compile.grep_includes"> |
| <code>grep_includes</code> |
| </td> |
| <td> |
| <code><a class="anchor" href="File.html">File</a>; or <a class="anchor" href="globals.html#None">None</a></code>; |
| default = None<br/> |
| |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| |
| <h2 id="configure_features">configure_features</h2> |
| <p><pre class="rule-signature"><a class="anchor" href="FeatureConfiguration.html">FeatureConfiguration</a> cc_common.configure_features(ctx=None, cc_toolchain, language=None, requested_features=[], unsupported_features=[])</pre></p> |
| |
| Creates a feature_configuration instance. Requires the cpp configuration fragment. |
| |
| <!-- hide-from-toc is a class used by DevSite for the public Bazel site |
| (https://developers.google.com/devsite/reference/styles/headings#hide_headings_from_the_toc) --> |
| <h3 class="hide-from-toc">Parameters</h3> |
| <table class="table table-bordered table-condensed table-params"> |
| <colgroup> |
| <col class="col-param"> |
| <col class="param-description"> |
| </colgroup> |
| <thead> |
| <tr> |
| <th>Parameter</th> |
| <th>Description</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td id="configure_features.ctx"> |
| <code>ctx</code> |
| </td> |
| <td> |
| <code><a class="anchor" href="ctx.html">ctx</a>; or <a class="anchor" href="globals.html#None">None</a></code>; |
| default = None<br/> |
| The rule context. |
| </td> |
| </tr> |
| <tr> |
| <td id="configure_features.cc_toolchain"> |
| <code>cc_toolchain</code> |
| </td> |
| <td> |
| required<br/> |
| cc_toolchain for which we configure features. |
| </td> |
| </tr> |
| <tr> |
| <td id="configure_features.language"> |
| <code>language</code> |
| </td> |
| <td> |
| <code><a class="anchor" href="string.html">string</a>; or <a class="anchor" href="globals.html#None">None</a></code>; |
| default = None<br/> |
| The language to configure for: either c++ or objc (default c++) |
| </td> |
| </tr> |
| <tr> |
| <td id="configure_features.requested_features"> |
| <code>requested_features</code> |
| </td> |
| <td> |
| default = []<br/> |
| List of features to be enabled. |
| </td> |
| </tr> |
| <tr> |
| <td id="configure_features.unsupported_features"> |
| <code>unsupported_features</code> |
| </td> |
| <td> |
| default = []<br/> |
| List of features that are unsupported by the current rule. |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| |
| <h2 id="create_cc_toolchain_config_info">create_cc_toolchain_config_info</h2> |
| <p><pre class="rule-signature"><a class="anchor" href="CcToolchainConfigInfo.html">CcToolchainConfigInfo</a> cc_common.create_cc_toolchain_config_info(ctx, features=[], action_configs=[], artifact_name_patterns=[], cxx_builtin_include_directories=[], toolchain_identifier, host_system_name=None, target_system_name, target_cpu, target_libc, compiler, abi_version=None, abi_libc_version=None, tool_paths=[], make_variables=[], builtin_sysroot=None, cc_target_os=None)</pre></p> |
| |
| Creates a <code>CcToolchainConfigInfo</code> provider |
| |
| <!-- hide-from-toc is a class used by DevSite for the public Bazel site |
| (https://developers.google.com/devsite/reference/styles/headings#hide_headings_from_the_toc) --> |
| <h3 class="hide-from-toc">Parameters</h3> |
| <table class="table table-bordered table-condensed table-params"> |
| <colgroup> |
| <col class="col-param"> |
| <col class="param-description"> |
| </colgroup> |
| <thead> |
| <tr> |
| <th>Parameter</th> |
| <th>Description</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td id="create_cc_toolchain_config_info.ctx"> |
| <code>ctx</code> |
| </td> |
| <td> |
| required<br/> |
| The rule context. |
| </td> |
| </tr> |
| <tr> |
| <td id="create_cc_toolchain_config_info.features"> |
| <code>features</code> |
| </td> |
| <td> |
| default = []<br/> |
| A list of <a href="https://github.com/bazelbuild/bazel/blob/master/tools/cpp/cc_toolchain_config_lib.bzl#L336">features</a>. |
| </td> |
| </tr> |
| <tr> |
| <td id="create_cc_toolchain_config_info.action_configs"> |
| <code>action_configs</code> |
| </td> |
| <td> |
| default = []<br/> |
| A list of <a href="https://github.com/bazelbuild/bazel/blob/master/tools/cpp/cc_toolchain_config_lib.bzl#L461">action_configs</a>. |
| </td> |
| </tr> |
| <tr> |
| <td id="create_cc_toolchain_config_info.artifact_name_patterns"> |
| <code>artifact_name_patterns</code> |
| </td> |
| <td> |
| default = []<br/> |
| A list of <a href="https://github.com/bazelbuild/bazel/blob/master/tools/cpp/cc_toolchain_config_lib.bzl#L516">artifact_name_patterns</a>. |
| </td> |
| </tr> |
| <tr> |
| <td id="create_cc_toolchain_config_info.cxx_builtin_include_directories"> |
| <code>cxx_builtin_include_directories</code> |
| </td> |
| <td> |
| default = []<br/> |
| <p>Built-in include directories for C++ compilation. These should be the exact paths used by the compiler, and are generally relative to the exec root.</p><p>The paths used by the compiler can be determined by 'gcc -E -xc++ - -v'.</p><p>We currently use the C++ paths also for C compilation, which is safe as long as there are no name clashes between C++ and C header files.</p><p>Relative paths are resolved relative to the configuration file directory.</p><p>If the compiler has --sysroot support, then these paths should use %sysroot% rather than the include path, and specify the sysroot attribute in order to give blaze the information necessary to make the correct replacements.</p> |
| </td> |
| </tr> |
| <tr> |
| <td id="create_cc_toolchain_config_info.toolchain_identifier"> |
| <code>toolchain_identifier</code> |
| </td> |
| <td> |
| required<br/> |
| <p>The unique identifier of the toolchain within the crosstool release. It must be possible to use this as a directory name in a path.</p><p>It has to match the following regex: [a-zA-Z_][\.\- \w]*</p> |
| </td> |
| </tr> |
| <tr> |
| <td id="create_cc_toolchain_config_info.host_system_name"> |
| <code>host_system_name</code> |
| </td> |
| <td> |
| <code><a class="anchor" href="string.html">string</a>; or <a class="anchor" href="globals.html#None">None</a></code>; |
| default = None<br/> |
| Ignored. |
| </td> |
| </tr> |
| <tr> |
| <td id="create_cc_toolchain_config_info.target_system_name"> |
| <code>target_system_name</code> |
| </td> |
| <td> |
| required<br/> |
| The GNU System Name. |
| </td> |
| </tr> |
| <tr> |
| <td id="create_cc_toolchain_config_info.target_cpu"> |
| <code>target_cpu</code> |
| </td> |
| <td> |
| required<br/> |
| The target architecture string. |
| </td> |
| </tr> |
| <tr> |
| <td id="create_cc_toolchain_config_info.target_libc"> |
| <code>target_libc</code> |
| </td> |
| <td> |
| required<br/> |
| The libc version string (e.g. "glibc-2.2.2"). |
| </td> |
| </tr> |
| <tr> |
| <td id="create_cc_toolchain_config_info.compiler"> |
| <code>compiler</code> |
| </td> |
| <td> |
| required<br/> |
| The compiler version string (e.g. "gcc-4.1.1"). |
| </td> |
| </tr> |
| <tr> |
| <td id="create_cc_toolchain_config_info.abi_version"> |
| <code>abi_version</code> |
| </td> |
| <td> |
| <code><a class="anchor" href="string.html">string</a>; or <a class="anchor" href="globals.html#None">None</a></code>; |
| default = None<br/> |
| The abi in use, which is a gcc version. E.g.: "gcc-3.4" |
| </td> |
| </tr> |
| <tr> |
| <td id="create_cc_toolchain_config_info.abi_libc_version"> |
| <code>abi_libc_version</code> |
| </td> |
| <td> |
| <code><a class="anchor" href="string.html">string</a>; or <a class="anchor" href="globals.html#None">None</a></code>; |
| default = None<br/> |
| The glibc version used by the abi we're using. |
| </td> |
| </tr> |
| <tr> |
| <td id="create_cc_toolchain_config_info.tool_paths"> |
| <code>tool_paths</code> |
| </td> |
| <td> |
| default = []<br/> |
| A list of <a href="https://github.com/bazelbuild/bazel/blob/master/tools/cpp/cc_toolchain_config_lib.bzl#L400">tool_paths</a>. |
| </td> |
| </tr> |
| <tr> |
| <td id="create_cc_toolchain_config_info.make_variables"> |
| <code>make_variables</code> |
| </td> |
| <td> |
| default = []<br/> |
| A list of <a href="https://github.com/bazelbuild/bazel/blob/master/tools/cpp/cc_toolchain_config_lib.bzl#L86">make_variables</a>. |
| </td> |
| </tr> |
| <tr> |
| <td id="create_cc_toolchain_config_info.builtin_sysroot"> |
| <code>builtin_sysroot</code> |
| </td> |
| <td> |
| <code><a class="anchor" href="string.html">string</a>; or <a class="anchor" href="globals.html#None">None</a></code>; |
| default = None<br/> |
| The built-in sysroot. If this attribute is not present, Bazel does not allow using a different sysroot, i.e. through the --grte_top option. |
| </td> |
| </tr> |
| <tr> |
| <td id="create_cc_toolchain_config_info.cc_target_os"> |
| <code>cc_target_os</code> |
| </td> |
| <td> |
| <code><a class="anchor" href="string.html">string</a>; or <a class="anchor" href="globals.html#None">None</a></code>; |
| default = None<br/> |
| Internal purpose only, do not use. |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| |
| <h2 id="create_compilation_context">create_compilation_context</h2> |
| <p><pre class="rule-signature"><a class="anchor" href="CompilationContext.html">CompilationContext</a> cc_common.create_compilation_context(headers=unbound, system_includes=unbound, includes=unbound, quote_includes=unbound, framework_includes=unbound, defines=unbound, local_defines=unbound)</pre></p> |
| |
| Creates a <code>CompilationContext</code>. |
| |
| <!-- hide-from-toc is a class used by DevSite for the public Bazel site |
| (https://developers.google.com/devsite/reference/styles/headings#hide_headings_from_the_toc) --> |
| <h3 class="hide-from-toc">Parameters</h3> |
| <table class="table table-bordered table-condensed table-params"> |
| <colgroup> |
| <col class="col-param"> |
| <col class="param-description"> |
| </colgroup> |
| <thead> |
| <tr> |
| <th>Parameter</th> |
| <th>Description</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td id="create_compilation_context.headers"> |
| <code>headers</code> |
| </td> |
| <td> |
| default = unbound<br/> |
| Set of headers needed to compile this target |
| </td> |
| </tr> |
| <tr> |
| <td id="create_compilation_context.system_includes"> |
| <code>system_includes</code> |
| </td> |
| <td> |
| default = unbound<br/> |
| Set of search paths for header files referenced by angle brackets, i.e. #include <foo/bar/header.h>. They can be either relative to the exec root or absolute. Usually passed with -isystem |
| </td> |
| </tr> |
| <tr> |
| <td id="create_compilation_context.includes"> |
| <code>includes</code> |
| </td> |
| <td> |
| default = unbound<br/> |
| Set of search paths for header files referenced both by angle bracket and quotes.Usually passed with -I |
| </td> |
| </tr> |
| <tr> |
| <td id="create_compilation_context.quote_includes"> |
| <code>quote_includes</code> |
| </td> |
| <td> |
| default = unbound<br/> |
| Set of search paths for header files referenced by quotes, i.e. #include "foo/bar/header.h". They can be either relative to the exec root or absolute. Usually passed with -iquote |
| </td> |
| </tr> |
| <tr> |
| <td id="create_compilation_context.framework_includes"> |
| <code>framework_includes</code> |
| </td> |
| <td> |
| default = unbound<br/> |
| Set of framework search paths for header files (Apple platform only) |
| </td> |
| </tr> |
| <tr> |
| <td id="create_compilation_context.defines"> |
| <code>defines</code> |
| </td> |
| <td> |
| default = unbound<br/> |
| Set of defines needed to compile this target. Each define is a string. Propagated transitively to dependents. |
| </td> |
| </tr> |
| <tr> |
| <td id="create_compilation_context.local_defines"> |
| <code>local_defines</code> |
| </td> |
| <td> |
| default = unbound<br/> |
| Set of defines needed to compile this target. Each define is a string. Not propagated transitively to dependents. |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| |
| <h2 id="create_compilation_outputs">create_compilation_outputs</h2> |
| <p><pre class="rule-signature"><a class="anchor" href="CcCompilationOutputs.html">CcCompilationOutputs</a> cc_common.create_compilation_outputs(objects=None, pic_objects=None)</pre></p> |
| |
| Create compilation outputs object. |
| |
| <!-- hide-from-toc is a class used by DevSite for the public Bazel site |
| (https://developers.google.com/devsite/reference/styles/headings#hide_headings_from_the_toc) --> |
| <h3 class="hide-from-toc">Parameters</h3> |
| <table class="table table-bordered table-condensed table-params"> |
| <colgroup> |
| <col class="col-param"> |
| <col class="param-description"> |
| </colgroup> |
| <thead> |
| <tr> |
| <th>Parameter</th> |
| <th>Description</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td id="create_compilation_outputs.objects"> |
| <code>objects</code> |
| </td> |
| <td> |
| <code><a class="anchor" href="depset.html">depset</a>; or <a class="anchor" href="globals.html#None">None</a></code>; |
| default = None<br/> |
| List of object files. |
| </td> |
| </tr> |
| <tr> |
| <td id="create_compilation_outputs.pic_objects"> |
| <code>pic_objects</code> |
| </td> |
| <td> |
| <code><a class="anchor" href="depset.html">depset</a>; or <a class="anchor" href="globals.html#None">None</a></code>; |
| default = None<br/> |
| List of pic object files. |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| |
| <h2 id="create_compile_variables">create_compile_variables</h2> |
| <p><pre class="rule-signature">Variables cc_common.create_compile_variables(cc_toolchain, feature_configuration, source_file=None, output_file=None, user_compile_flags=None, include_directories=None, quote_include_directories=None, system_include_directories=None, framework_include_directories=None, preprocessor_defines=None, thinlto_index=None, thinlto_input_bitcode_file=None, thinlto_output_object_file=None, use_pic=False, add_legacy_cxx_options=False, variables_extension=unbound)</pre></p> |
| |
| Returns variables used for compilation actions. |
| |
| <!-- hide-from-toc is a class used by DevSite for the public Bazel site |
| (https://developers.google.com/devsite/reference/styles/headings#hide_headings_from_the_toc) --> |
| <h3 class="hide-from-toc">Parameters</h3> |
| <table class="table table-bordered table-condensed table-params"> |
| <colgroup> |
| <col class="col-param"> |
| <col class="param-description"> |
| </colgroup> |
| <thead> |
| <tr> |
| <th>Parameter</th> |
| <th>Description</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td id="create_compile_variables.cc_toolchain"> |
| <code>cc_toolchain</code> |
| </td> |
| <td> |
| required<br/> |
| cc_toolchain for which we are creating build variables. |
| </td> |
| </tr> |
| <tr> |
| <td id="create_compile_variables.feature_configuration"> |
| <code>feature_configuration</code> |
| </td> |
| <td> |
| required<br/> |
| Feature configuration to be queried. |
| </td> |
| </tr> |
| <tr> |
| <td id="create_compile_variables.source_file"> |
| <code>source_file</code> |
| </td> |
| <td> |
| default = None<br/> |
| Optional source file for the compilation. Please prefer passing source_file here over appending it to the end of the command line generated from cc_common.get_memory_inefficient_command_line, as then it's in the power of the toolchain author to properly specify and position compiler flags. |
| </td> |
| </tr> |
| <tr> |
| <td id="create_compile_variables.output_file"> |
| <code>output_file</code> |
| </td> |
| <td> |
| default = None<br/> |
| Optional output file of the compilation. Please prefer passing output_file here over appending it to the end of the command line generated from cc_common.get_memory_inefficient_command_line, as then it's in the power of the toolchain author to properly specify and position compiler flags. |
| </td> |
| </tr> |
| <tr> |
| <td id="create_compile_variables.user_compile_flags"> |
| <code>user_compile_flags</code> |
| </td> |
| <td> |
| <code><a class="anchor" href="list.html">sequence</a> of <a class="anchor" href="string.html">string</a>s; or <a class="anchor" href="globals.html#None">None</a></code>; |
| default = None<br/> |
| List of additional compilation flags (copts). |
| </td> |
| </tr> |
| <tr> |
| <td id="create_compile_variables.include_directories"> |
| <code>include_directories</code> |
| </td> |
| <td> |
| <code><a class="anchor" href="depset.html">depset</a>; or <a class="anchor" href="globals.html#None">None</a></code>; |
| default = None<br/> |
| Depset of include directories. |
| </td> |
| </tr> |
| <tr> |
| <td id="create_compile_variables.quote_include_directories"> |
| <code>quote_include_directories</code> |
| </td> |
| <td> |
| <code><a class="anchor" href="depset.html">depset</a>; or <a class="anchor" href="globals.html#None">None</a></code>; |
| default = None<br/> |
| Depset of quote include directories. |
| </td> |
| </tr> |
| <tr> |
| <td id="create_compile_variables.system_include_directories"> |
| <code>system_include_directories</code> |
| </td> |
| <td> |
| <code><a class="anchor" href="depset.html">depset</a>; or <a class="anchor" href="globals.html#None">None</a></code>; |
| default = None<br/> |
| Depset of system include directories. |
| </td> |
| </tr> |
| <tr> |
| <td id="create_compile_variables.framework_include_directories"> |
| <code>framework_include_directories</code> |
| </td> |
| <td> |
| <code><a class="anchor" href="depset.html">depset</a>; or <a class="anchor" href="globals.html#None">None</a></code>; |
| default = None<br/> |
| Depset of framework include directories. |
| </td> |
| </tr> |
| <tr> |
| <td id="create_compile_variables.preprocessor_defines"> |
| <code>preprocessor_defines</code> |
| </td> |
| <td> |
| <code><a class="anchor" href="depset.html">depset</a>; or <a class="anchor" href="globals.html#None">None</a></code>; |
| default = None<br/> |
| Depset of preprocessor defines. |
| </td> |
| </tr> |
| <tr> |
| <td id="create_compile_variables.thinlto_index"> |
| <code>thinlto_index</code> |
| </td> |
| <td> |
| <code><a class="anchor" href="string.html">string</a>; or <a class="anchor" href="globals.html#None">None</a></code>; |
| default = None<br/> |
| LTO index file path. |
| </td> |
| </tr> |
| <tr> |
| <td id="create_compile_variables.thinlto_input_bitcode_file"> |
| <code>thinlto_input_bitcode_file</code> |
| </td> |
| <td> |
| <code><a class="anchor" href="string.html">string</a>; or <a class="anchor" href="globals.html#None">None</a></code>; |
| default = None<br/> |
| Bitcode file that is input to LTO backend. |
| </td> |
| </tr> |
| <tr> |
| <td id="create_compile_variables.thinlto_output_object_file"> |
| <code>thinlto_output_object_file</code> |
| </td> |
| <td> |
| <code><a class="anchor" href="string.html">string</a>; or <a class="anchor" href="globals.html#None">None</a></code>; |
| default = None<br/> |
| Object file that is output by LTO backend. |
| </td> |
| </tr> |
| <tr> |
| <td id="create_compile_variables.use_pic"> |
| <code>use_pic</code> |
| </td> |
| <td> |
| default = False<br/> |
| When true the compilation will generate position independent code. |
| </td> |
| </tr> |
| <tr> |
| <td id="create_compile_variables.add_legacy_cxx_options"> |
| <code>add_legacy_cxx_options</code> |
| </td> |
| <td> |
| default = False<br/> |
| Unused. |
| </td> |
| </tr> |
| <tr> |
| <td id="create_compile_variables.variables_extension"> |
| <code>variables_extension</code> |
| </td> |
| <td> |
| <code><a class="anchor" href="dict.html">dict</a></code>; |
| default = unbound<br/> |
| A dictionary of additional variables used by compile actions. |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| |
| <h2 id="create_library_to_link">create_library_to_link</h2> |
| <p><pre class="rule-signature"><a class="anchor" href="LibraryToLink.html">LibraryToLink</a> cc_common.create_library_to_link(actions, feature_configuration=None, cc_toolchain=None, static_library=None, pic_static_library=None, dynamic_library=None, interface_library=None, pic_objects=unbound, objects=unbound, alwayslink=False, dynamic_library_symlink_path='', interface_library_symlink_path='')</pre></p> |
| |
| Creates <code>LibraryToLink</code> |
| |
| <!-- hide-from-toc is a class used by DevSite for the public Bazel site |
| (https://developers.google.com/devsite/reference/styles/headings#hide_headings_from_the_toc) --> |
| <h3 class="hide-from-toc">Parameters</h3> |
| <table class="table table-bordered table-condensed table-params"> |
| <colgroup> |
| <col class="col-param"> |
| <col class="param-description"> |
| </colgroup> |
| <thead> |
| <tr> |
| <th>Parameter</th> |
| <th>Description</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td id="create_library_to_link.actions"> |
| <code>actions</code> |
| </td> |
| <td> |
| required<br/> |
| <code>actions</code> object. |
| </td> |
| </tr> |
| <tr> |
| <td id="create_library_to_link.feature_configuration"> |
| <code>feature_configuration</code> |
| </td> |
| <td> |
| default = None<br/> |
| <code>feature_configuration</code> to be queried. |
| </td> |
| </tr> |
| <tr> |
| <td id="create_library_to_link.cc_toolchain"> |
| <code>cc_toolchain</code> |
| </td> |
| <td> |
| default = None<br/> |
| <code>CcToolchainInfo</code> provider to be used. |
| </td> |
| </tr> |
| <tr> |
| <td id="create_library_to_link.static_library"> |
| <code>static_library</code> |
| </td> |
| <td> |
| <code><a class="anchor" href="File.html">File</a>; or <a class="anchor" href="globals.html#None">None</a></code>; |
| default = None<br/> |
| <code>File</code> of static library to be linked. |
| </td> |
| </tr> |
| <tr> |
| <td id="create_library_to_link.pic_static_library"> |
| <code>pic_static_library</code> |
| </td> |
| <td> |
| <code><a class="anchor" href="File.html">File</a>; or <a class="anchor" href="globals.html#None">None</a></code>; |
| default = None<br/> |
| <code>File</code> of pic static library to be linked. |
| </td> |
| </tr> |
| <tr> |
| <td id="create_library_to_link.dynamic_library"> |
| <code>dynamic_library</code> |
| </td> |
| <td> |
| <code><a class="anchor" href="File.html">File</a>; or <a class="anchor" href="globals.html#None">None</a></code>; |
| default = None<br/> |
| <code>File</code> of dynamic library to be linked. Always used for runtime and used for linking if <code>interface_library</code> is not passed. |
| </td> |
| </tr> |
| <tr> |
| <td id="create_library_to_link.interface_library"> |
| <code>interface_library</code> |
| </td> |
| <td> |
| <code><a class="anchor" href="File.html">File</a>; or <a class="anchor" href="globals.html#None">None</a></code>; |
| default = None<br/> |
| <code>File</code> of interface library to be linked. |
| </td> |
| </tr> |
| <tr> |
| <td id="create_library_to_link.pic_objects"> |
| <code>pic_objects</code> |
| </td> |
| <td> |
| <code><a class="anchor" href="list.html">sequence</a> of <a class="anchor" href="File.html">File</a>s</code>; |
| default = unbound<br/> |
| Experimental, do not use |
| </td> |
| </tr> |
| <tr> |
| <td id="create_library_to_link.objects"> |
| <code>objects</code> |
| </td> |
| <td> |
| <code><a class="anchor" href="list.html">sequence</a> of <a class="anchor" href="File.html">File</a>s</code>; |
| default = unbound<br/> |
| Experimental, do not use |
| </td> |
| </tr> |
| <tr> |
| <td id="create_library_to_link.alwayslink"> |
| <code>alwayslink</code> |
| </td> |
| <td> |
| default = False<br/> |
| Whether to link the static library/objects in the --whole_archive block. |
| </td> |
| </tr> |
| <tr> |
| <td id="create_library_to_link.dynamic_library_symlink_path"> |
| <code>dynamic_library_symlink_path</code> |
| </td> |
| <td> |
| <code><a class="anchor" href="string.html">string</a></code>; |
| default = ''<br/> |
| Override the default path of the dynamic library link in the solib directory. Empty string to use the default. |
| </td> |
| </tr> |
| <tr> |
| <td id="create_library_to_link.interface_library_symlink_path"> |
| <code>interface_library_symlink_path</code> |
| </td> |
| <td> |
| default = ''<br/> |
| Override the default path of the interface library link in the solib directory. Empty string to use the default. |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| |
| <h2 id="create_link_variables">create_link_variables</h2> |
| <p><pre class="rule-signature">Variables cc_common.create_link_variables(cc_toolchain, feature_configuration, library_search_directories=None, runtime_library_search_directories=None, user_link_flags=None, output_file=None, param_file=None, def_file=None, is_using_linker=True, is_linking_dynamic_library=False, must_keep_debug=True, use_test_only_flags=False, is_static_linking_mode=True)</pre></p> |
| |
| Returns link variables used for linking actions. |
| |
| <!-- hide-from-toc is a class used by DevSite for the public Bazel site |
| (https://developers.google.com/devsite/reference/styles/headings#hide_headings_from_the_toc) --> |
| <h3 class="hide-from-toc">Parameters</h3> |
| <table class="table table-bordered table-condensed table-params"> |
| <colgroup> |
| <col class="col-param"> |
| <col class="param-description"> |
| </colgroup> |
| <thead> |
| <tr> |
| <th>Parameter</th> |
| <th>Description</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td id="create_link_variables.cc_toolchain"> |
| <code>cc_toolchain</code> |
| </td> |
| <td> |
| required<br/> |
| cc_toolchain for which we are creating build variables. |
| </td> |
| </tr> |
| <tr> |
| <td id="create_link_variables.feature_configuration"> |
| <code>feature_configuration</code> |
| </td> |
| <td> |
| required<br/> |
| Feature configuration to be queried. |
| </td> |
| </tr> |
| <tr> |
| <td id="create_link_variables.library_search_directories"> |
| <code>library_search_directories</code> |
| </td> |
| <td> |
| <code><a class="anchor" href="globals.html#None">None</a>; or <a class="anchor" href="depset.html">depset</a></code>; |
| default = None<br/> |
| Depset of directories where linker will look for libraries at link time. |
| </td> |
| </tr> |
| <tr> |
| <td id="create_link_variables.runtime_library_search_directories"> |
| <code>runtime_library_search_directories</code> |
| </td> |
| <td> |
| <code><a class="anchor" href="globals.html#None">None</a>; or <a class="anchor" href="depset.html">depset</a></code>; |
| default = None<br/> |
| Depset of directories where loader will look for libraries at runtime. |
| </td> |
| </tr> |
| <tr> |
| <td id="create_link_variables.user_link_flags"> |
| <code>user_link_flags</code> |
| </td> |
| <td> |
| <code><a class="anchor" href="globals.html#None">None</a>; or <a class="anchor" href="list.html">sequence</a></code>; |
| default = None<br/> |
| List of additional link flags (linkopts). |
| </td> |
| </tr> |
| <tr> |
| <td id="create_link_variables.output_file"> |
| <code>output_file</code> |
| </td> |
| <td> |
| default = None<br/> |
| Optional output file path. |
| </td> |
| </tr> |
| <tr> |
| <td id="create_link_variables.param_file"> |
| <code>param_file</code> |
| </td> |
| <td> |
| default = None<br/> |
| Optional param file path. |
| </td> |
| </tr> |
| <tr> |
| <td id="create_link_variables.def_file"> |
| <code>def_file</code> |
| </td> |
| <td> |
| default = None<br/> |
| Optional .def file path. |
| </td> |
| </tr> |
| <tr> |
| <td id="create_link_variables.is_using_linker"> |
| <code>is_using_linker</code> |
| </td> |
| <td> |
| default = True<br/> |
| True when using linker, False when archiver. Caller is responsible for keeping this in sync with action name used (is_using_linker = True for linking executable or dynamic library, is_using_linker = False for archiving static library). |
| </td> |
| </tr> |
| <tr> |
| <td id="create_link_variables.is_linking_dynamic_library"> |
| <code>is_linking_dynamic_library</code> |
| </td> |
| <td> |
| default = False<br/> |
| True when creating dynamic library, False when executable or static library. Caller is responsible for keeping this in sync with action name used. This field will be removed once b/65151735 is fixed. |
| </td> |
| </tr> |
| <tr> |
| <td id="create_link_variables.must_keep_debug"> |
| <code>must_keep_debug</code> |
| </td> |
| <td> |
| default = True<br/> |
| When set to True, bazel will expose 'strip_debug_symbols' variable, which is usually used to use the linker to strip debug symbols from the output file. |
| </td> |
| </tr> |
| <tr> |
| <td id="create_link_variables.use_test_only_flags"> |
| <code>use_test_only_flags</code> |
| </td> |
| <td> |
| default = False<br/> |
| When set to true, 'is_cc_test' variable will be set. |
| </td> |
| </tr> |
| <tr> |
| <td id="create_link_variables.is_static_linking_mode"> |
| <code>is_static_linking_mode</code> |
| </td> |
| <td> |
| default = True<br/> |
| Unused. |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| |
| <h2 id="create_linker_input">create_linker_input</h2> |
| <p><pre class="rule-signature"><a class="anchor" href="LinkerInput.html">LinkerInput</a> cc_common.create_linker_input(owner, libraries=None, user_link_flags=None, additional_inputs=None)</pre></p> |
| |
| Creates a <code>LinkerInput</code>. |
| |
| <!-- hide-from-toc is a class used by DevSite for the public Bazel site |
| (https://developers.google.com/devsite/reference/styles/headings#hide_headings_from_the_toc) --> |
| <h3 class="hide-from-toc">Parameters</h3> |
| <table class="table table-bordered table-condensed table-params"> |
| <colgroup> |
| <col class="col-param"> |
| <col class="param-description"> |
| </colgroup> |
| <thead> |
| <tr> |
| <th>Parameter</th> |
| <th>Description</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td id="create_linker_input.owner"> |
| <code>owner</code> |
| </td> |
| <td> |
| required<br/> |
| The label of the target that produced all files used in this input. |
| </td> |
| </tr> |
| <tr> |
| <td id="create_linker_input.libraries"> |
| <code>libraries</code> |
| </td> |
| <td> |
| <code><a class="anchor" href="globals.html#None">None</a>; or <a class="anchor" href="depset.html">depset</a></code>; |
| default = None<br/> |
| List of <code>LibraryToLink</code>. |
| </td> |
| </tr> |
| <tr> |
| <td id="create_linker_input.user_link_flags"> |
| <code>user_link_flags</code> |
| </td> |
| <td> |
| <code><a class="anchor" href="globals.html#None">None</a>; or <a class="anchor" href="depset.html">depset</a> of <a class="anchor" href="string.html">string</a>s; or <a class="anchor" href="list.html">sequence</a> of <a class="anchor" href="string.html">string</a>s</code>; |
| default = None<br/> |
| User link flags passed as strings. Accepts either [String], [[String]] or depset(String). The latter is discouraged as it's only kept for compatibility purposes, the depset is flattened. If you want to propagate user_link_flags via unflattened depsets() wrap them in a LinkerInput so that they are not flattened till the end. |
| </td> |
| </tr> |
| <tr> |
| <td id="create_linker_input.additional_inputs"> |
| <code>additional_inputs</code> |
| </td> |
| <td> |
| <code><a class="anchor" href="globals.html#None">None</a>; or <a class="anchor" href="depset.html">depset</a></code>; |
| default = None<br/> |
| For additional inputs to the linking action, e.g.: linking scripts. |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| |
| <h2 id="create_linking_context">create_linking_context</h2> |
| <p><pre class="rule-signature"><a class="anchor" href="LinkingContext.html">LinkingContext</a> cc_common.create_linking_context(linker_inputs=None, libraries_to_link=None, user_link_flags=None, additional_inputs=None)</pre></p> |
| |
| Creates a <code>LinkingContext</code>. |
| |
| <!-- hide-from-toc is a class used by DevSite for the public Bazel site |
| (https://developers.google.com/devsite/reference/styles/headings#hide_headings_from_the_toc) --> |
| <h3 class="hide-from-toc">Parameters</h3> |
| <table class="table table-bordered table-condensed table-params"> |
| <colgroup> |
| <col class="col-param"> |
| <col class="param-description"> |
| </colgroup> |
| <thead> |
| <tr> |
| <th>Parameter</th> |
| <th>Description</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td id="create_linking_context.linker_inputs"> |
| <code>linker_inputs</code> |
| </td> |
| <td> |
| <code><a class="anchor" href="globals.html#None">None</a>; or <a class="anchor" href="depset.html">depset</a></code>; |
| default = None<br/> |
| Depset of <code>LinkerInput</code>. |
| </td> |
| </tr> |
| <tr> |
| <td id="create_linking_context.libraries_to_link"> |
| <code>libraries_to_link</code> |
| </td> |
| <td> |
| <code><a class="anchor" href="globals.html#None">None</a>; or <a class="anchor" href="list.html">sequence</a></code>; |
| default = None<br/> |
| <b>Deprecated</b>. This parameter is deprecated and will be removed soon. Please do not depend on it. It is <i>disabled</i> with <code>--+incompatible_require_linker_input_cc_api</code>. Use this flag to verify your code is compatible with its imminent removal. <br>List of <code>LibraryToLink</code>. |
| </td> |
| </tr> |
| <tr> |
| <td id="create_linking_context.user_link_flags"> |
| <code>user_link_flags</code> |
| </td> |
| <td> |
| <code><a class="anchor" href="globals.html#None">None</a>; or <a class="anchor" href="list.html">sequence</a></code>; |
| default = None<br/> |
| <b>Deprecated</b>. This parameter is deprecated and will be removed soon. Please do not depend on it. It is <i>disabled</i> with <code>--+incompatible_require_linker_input_cc_api</code>. Use this flag to verify your code is compatible with its imminent removal. <br>List of user link flags passed as strings. |
| </td> |
| </tr> |
| <tr> |
| <td id="create_linking_context.additional_inputs"> |
| <code>additional_inputs</code> |
| </td> |
| <td> |
| <code><a class="anchor" href="globals.html#None">None</a>; or <a class="anchor" href="list.html">sequence</a></code>; |
| default = None<br/> |
| <b>Deprecated</b>. This parameter is deprecated and will be removed soon. Please do not depend on it. It is <i>disabled</i> with <code>--+incompatible_require_linker_input_cc_api</code>. Use this flag to verify your code is compatible with its imminent removal. <br>For additional inputs to the linking action, e.g.: linking scripts. |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| |
| <h2 id="create_linking_context_from_compilation_outputs">create_linking_context_from_compilation_outputs</h2> |
| <p><pre class="rule-signature"><a class="anchor" href="tuple.html">tuple</a> cc_common.create_linking_context_from_compilation_outputs(actions, feature_configuration, cc_toolchain, compilation_outputs, user_link_flags=[], linking_contexts=[], name, language='c++', alwayslink=False, additional_inputs=[], disallow_static_libraries=False, disallow_dynamic_library=False, grep_includes=None)</pre></p> |
| |
| Should be used for creating library rules that can propagate information downstream in order to be linked later by a top level rule that does transitive linking to create an executable or dynamic library. Returns tuple of (<code>CcLinkingContext</code>, <code>CcLinkingOutputs</code>). |
| |
| <!-- hide-from-toc is a class used by DevSite for the public Bazel site |
| (https://developers.google.com/devsite/reference/styles/headings#hide_headings_from_the_toc) --> |
| <h3 class="hide-from-toc">Parameters</h3> |
| <table class="table table-bordered table-condensed table-params"> |
| <colgroup> |
| <col class="col-param"> |
| <col class="param-description"> |
| </colgroup> |
| <thead> |
| <tr> |
| <th>Parameter</th> |
| <th>Description</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td id="create_linking_context_from_compilation_outputs.actions"> |
| <code>actions</code> |
| </td> |
| <td> |
| required<br/> |
| <code>actions</code> object. |
| </td> |
| </tr> |
| <tr> |
| <td id="create_linking_context_from_compilation_outputs.feature_configuration"> |
| <code>feature_configuration</code> |
| </td> |
| <td> |
| required<br/> |
| <code>feature_configuration</code> to be queried. |
| </td> |
| </tr> |
| <tr> |
| <td id="create_linking_context_from_compilation_outputs.cc_toolchain"> |
| <code>cc_toolchain</code> |
| </td> |
| <td> |
| required<br/> |
| <code>CcToolchainInfo</code> provider to be used. |
| </td> |
| </tr> |
| <tr> |
| <td id="create_linking_context_from_compilation_outputs.compilation_outputs"> |
| <code>compilation_outputs</code> |
| </td> |
| <td> |
| required<br/> |
| Compilation outputs containing object files to link. |
| </td> |
| </tr> |
| <tr> |
| <td id="create_linking_context_from_compilation_outputs.user_link_flags"> |
| <code>user_link_flags</code> |
| </td> |
| <td> |
| default = []<br/> |
| Additional list of linking options. |
| </td> |
| </tr> |
| <tr> |
| <td id="create_linking_context_from_compilation_outputs.linking_contexts"> |
| <code>linking_contexts</code> |
| </td> |
| <td> |
| default = []<br/> |
| Libraries from dependencies. These libraries will be linked into the output artifact of the link() call, be it a binary or a library. |
| </td> |
| </tr> |
| <tr> |
| <td id="create_linking_context_from_compilation_outputs.name"> |
| <code>name</code> |
| </td> |
| <td> |
| required<br/> |
| This is used for naming the output artifacts of actions created by this method. |
| </td> |
| </tr> |
| <tr> |
| <td id="create_linking_context_from_compilation_outputs.language"> |
| <code>language</code> |
| </td> |
| <td> |
| default = 'c++'<br/> |
| Only C++ supported for now. Do not use this parameter. |
| </td> |
| </tr> |
| <tr> |
| <td id="create_linking_context_from_compilation_outputs.alwayslink"> |
| <code>alwayslink</code> |
| </td> |
| <td> |
| default = False<br/> |
| Whether this library should always be linked. |
| </td> |
| </tr> |
| <tr> |
| <td id="create_linking_context_from_compilation_outputs.additional_inputs"> |
| <code>additional_inputs</code> |
| </td> |
| <td> |
| default = []<br/> |
| For additional inputs to the linking action, e.g.: linking scripts. |
| </td> |
| </tr> |
| <tr> |
| <td id="create_linking_context_from_compilation_outputs.disallow_static_libraries"> |
| <code>disallow_static_libraries</code> |
| </td> |
| <td> |
| default = False<br/> |
| Whether static libraries should be created. |
| </td> |
| </tr> |
| <tr> |
| <td id="create_linking_context_from_compilation_outputs.disallow_dynamic_library"> |
| <code>disallow_dynamic_library</code> |
| </td> |
| <td> |
| default = False<br/> |
| Whether a dynamic library should be created. |
| </td> |
| </tr> |
| <tr> |
| <td id="create_linking_context_from_compilation_outputs.grep_includes"> |
| <code>grep_includes</code> |
| </td> |
| <td> |
| <code><a class="anchor" href="File.html">File</a>; or <a class="anchor" href="globals.html#None">None</a></code>; |
| default = None<br/> |
| |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| |
| <h2 id="do_not_use_tools_cpp_compiler_present">do_not_use_tools_cpp_compiler_present</h2> |
| <p><pre class="rule-signature"><a class="anchor" href="globals.html#None">None</a> cc_common.do_not_use_tools_cpp_compiler_present</pre></p> |
| |
| Do not use this field, its only purpose is to help with migration from config_setting.values{'compiler') to config_settings.flag_values{'@bazel_tools//tools/cpp:compiler'} |
| |
| |
| <h2 id="get_environment_variables">get_environment_variables</h2> |
| <p><pre class="rule-signature"><a class="anchor" href="dict.html">dict</a> cc_common.get_environment_variables(feature_configuration, action_name, variables)</pre></p> |
| |
| Returns environment variables to be set for given action. |
| |
| <!-- hide-from-toc is a class used by DevSite for the public Bazel site |
| (https://developers.google.com/devsite/reference/styles/headings#hide_headings_from_the_toc) --> |
| <h3 class="hide-from-toc">Parameters</h3> |
| <table class="table table-bordered table-condensed table-params"> |
| <colgroup> |
| <col class="col-param"> |
| <col class="param-description"> |
| </colgroup> |
| <thead> |
| <tr> |
| <th>Parameter</th> |
| <th>Description</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td id="get_environment_variables.feature_configuration"> |
| <code>feature_configuration</code> |
| </td> |
| <td> |
| required<br/> |
| Feature configuration to be queried. |
| </td> |
| </tr> |
| <tr> |
| <td id="get_environment_variables.action_name"> |
| <code>action_name</code> |
| </td> |
| <td> |
| required<br/> |
| Name of the action. Has to be one of the names in @bazel_tools//tools/build_defs/cc:action_names.bzl (https://github.com/bazelbuild/bazel/blob/master/tools/build_defs/cc/action_names.bzl) |
| </td> |
| </tr> |
| <tr> |
| <td id="get_environment_variables.variables"> |
| <code>variables</code> |
| </td> |
| <td> |
| required<br/> |
| Build variables to be used for template expansion. |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| |
| <h2 id="get_execution_requirements">get_execution_requirements</h2> |
| <p><pre class="rule-signature"><a class="anchor" href="list.html">sequence</a> cc_common.get_execution_requirements(feature_configuration, action_name)</pre></p> |
| |
| Returns execution requirements for given action. |
| |
| <!-- hide-from-toc is a class used by DevSite for the public Bazel site |
| (https://developers.google.com/devsite/reference/styles/headings#hide_headings_from_the_toc) --> |
| <h3 class="hide-from-toc">Parameters</h3> |
| <table class="table table-bordered table-condensed table-params"> |
| <colgroup> |
| <col class="col-param"> |
| <col class="param-description"> |
| </colgroup> |
| <thead> |
| <tr> |
| <th>Parameter</th> |
| <th>Description</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td id="get_execution_requirements.feature_configuration"> |
| <code>feature_configuration</code> |
| </td> |
| <td> |
| required<br/> |
| Feature configuration to be queried. |
| </td> |
| </tr> |
| <tr> |
| <td id="get_execution_requirements.action_name"> |
| <code>action_name</code> |
| </td> |
| <td> |
| required<br/> |
| Name of the action. Has to be one of the names in @bazel_tools//tools/build_defs/cc:action_names.bzl (https://github.com/bazelbuild/bazel/blob/master/tools/build_defs/cc/action_names.bzl) |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| |
| <h2 id="get_memory_inefficient_command_line">get_memory_inefficient_command_line</h2> |
| <p><pre class="rule-signature"><a class="anchor" href="list.html">sequence</a> cc_common.get_memory_inefficient_command_line(feature_configuration, action_name, variables)</pre></p> |
| |
| Returns flattened command line flags for given action, using given variables for expansion. Flattens nested sets and ideally should not be used, or at least should not outlive analysis. Work on memory efficient function returning Args is ongoing. |
| |
| <!-- hide-from-toc is a class used by DevSite for the public Bazel site |
| (https://developers.google.com/devsite/reference/styles/headings#hide_headings_from_the_toc) --> |
| <h3 class="hide-from-toc">Parameters</h3> |
| <table class="table table-bordered table-condensed table-params"> |
| <colgroup> |
| <col class="col-param"> |
| <col class="param-description"> |
| </colgroup> |
| <thead> |
| <tr> |
| <th>Parameter</th> |
| <th>Description</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td id="get_memory_inefficient_command_line.feature_configuration"> |
| <code>feature_configuration</code> |
| </td> |
| <td> |
| required<br/> |
| Feature configuration to be queried. |
| </td> |
| </tr> |
| <tr> |
| <td id="get_memory_inefficient_command_line.action_name"> |
| <code>action_name</code> |
| </td> |
| <td> |
| required<br/> |
| Name of the action. Has to be one of the names in @bazel_tools//tools/build_defs/cc:action_names.bzl (https://github.com/bazelbuild/bazel/blob/master/tools/build_defs/cc/action_names.bzl) |
| </td> |
| </tr> |
| <tr> |
| <td id="get_memory_inefficient_command_line.variables"> |
| <code>variables</code> |
| </td> |
| <td> |
| required<br/> |
| Build variables to be used for template expansions. |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| |
| <h2 id="get_tool_for_action">get_tool_for_action</h2> |
| <p><pre class="rule-signature"><a class="anchor" href="string.html">string</a> cc_common.get_tool_for_action(feature_configuration, action_name)</pre></p> |
| |
| Returns tool path for given action. |
| |
| <!-- hide-from-toc is a class used by DevSite for the public Bazel site |
| (https://developers.google.com/devsite/reference/styles/headings#hide_headings_from_the_toc) --> |
| <h3 class="hide-from-toc">Parameters</h3> |
| <table class="table table-bordered table-condensed table-params"> |
| <colgroup> |
| <col class="col-param"> |
| <col class="param-description"> |
| </colgroup> |
| <thead> |
| <tr> |
| <th>Parameter</th> |
| <th>Description</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td id="get_tool_for_action.feature_configuration"> |
| <code>feature_configuration</code> |
| </td> |
| <td> |
| required<br/> |
| Feature configuration to be queried. |
| </td> |
| </tr> |
| <tr> |
| <td id="get_tool_for_action.action_name"> |
| <code>action_name</code> |
| </td> |
| <td> |
| required<br/> |
| Name of the action. Has to be one of the names in @bazel_tools//tools/build_defs/cc:action_names.bzl (https://github.com/bazelbuild/bazel/blob/master/tools/build_defs/cc/action_names.bzl) |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| |
| <h2 id="is_enabled">is_enabled</h2> |
| <p><pre class="rule-signature"><a class="anchor" href="bool.html">bool</a> cc_common.is_enabled(feature_configuration, feature_name)</pre></p> |
| |
| Returns True if given feature is enabled in the feature configuration. |
| |
| <!-- hide-from-toc is a class used by DevSite for the public Bazel site |
| (https://developers.google.com/devsite/reference/styles/headings#hide_headings_from_the_toc) --> |
| <h3 class="hide-from-toc">Parameters</h3> |
| <table class="table table-bordered table-condensed table-params"> |
| <colgroup> |
| <col class="col-param"> |
| <col class="param-description"> |
| </colgroup> |
| <thead> |
| <tr> |
| <th>Parameter</th> |
| <th>Description</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td id="is_enabled.feature_configuration"> |
| <code>feature_configuration</code> |
| </td> |
| <td> |
| required<br/> |
| Feature configuration to be queried. |
| </td> |
| </tr> |
| <tr> |
| <td id="is_enabled.feature_name"> |
| <code>feature_name</code> |
| </td> |
| <td> |
| required<br/> |
| Name of the feature. |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| |
| <h2 id="link">link</h2> |
| <p><pre class="rule-signature"><a class="anchor" href="CcLinkingOutputs.html">CcLinkingOutputs</a> cc_common.link(actions, feature_configuration, cc_toolchain, compilation_outputs=None, user_link_flags=[], linking_contexts=[], name, language='c++', output_type='executable', link_deps_statically=True, stamp=0, additional_inputs=[], grep_includes=None, additional_outputs=unbound)</pre></p> |
| |
| Should be used for C++ transitive linking. |
| |
| <!-- hide-from-toc is a class used by DevSite for the public Bazel site |
| (https://developers.google.com/devsite/reference/styles/headings#hide_headings_from_the_toc) --> |
| <h3 class="hide-from-toc">Parameters</h3> |
| <table class="table table-bordered table-condensed table-params"> |
| <colgroup> |
| <col class="col-param"> |
| <col class="param-description"> |
| </colgroup> |
| <thead> |
| <tr> |
| <th>Parameter</th> |
| <th>Description</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td id="link.actions"> |
| <code>actions</code> |
| </td> |
| <td> |
| required<br/> |
| <code>actions</code> object. |
| </td> |
| </tr> |
| <tr> |
| <td id="link.feature_configuration"> |
| <code>feature_configuration</code> |
| </td> |
| <td> |
| required<br/> |
| <code>feature_configuration</code> to be queried. |
| </td> |
| </tr> |
| <tr> |
| <td id="link.cc_toolchain"> |
| <code>cc_toolchain</code> |
| </td> |
| <td> |
| required<br/> |
| <code>CcToolchainInfo</code> provider to be used. |
| </td> |
| </tr> |
| <tr> |
| <td id="link.compilation_outputs"> |
| <code>compilation_outputs</code> |
| </td> |
| <td> |
| <code><a class="anchor" href="CcCompilationOutputs.html">CcCompilationOutputs</a>; or <a class="anchor" href="globals.html#None">None</a></code>; |
| default = None<br/> |
| Compilation outputs containing object files to link. |
| </td> |
| </tr> |
| <tr> |
| <td id="link.user_link_flags"> |
| <code>user_link_flags</code> |
| </td> |
| <td> |
| default = []<br/> |
| Additional list of linker options. |
| </td> |
| </tr> |
| <tr> |
| <td id="link.linking_contexts"> |
| <code>linking_contexts</code> |
| </td> |
| <td> |
| default = []<br/> |
| Linking contexts from dependencies to be linked into the linking context generated by this rule. |
| </td> |
| </tr> |
| <tr> |
| <td id="link.name"> |
| <code>name</code> |
| </td> |
| <td> |
| required<br/> |
| This is used for naming the output artifacts of actions created by this method. |
| </td> |
| </tr> |
| <tr> |
| <td id="link.language"> |
| <code>language</code> |
| </td> |
| <td> |
| default = 'c++'<br/> |
| Only C++ supported for now. Do not use this parameter. |
| </td> |
| </tr> |
| <tr> |
| <td id="link.output_type"> |
| <code>output_type</code> |
| </td> |
| <td> |
| default = 'executable'<br/> |
| Can be either 'executable' or 'dynamic_library'. |
| </td> |
| </tr> |
| <tr> |
| <td id="link.link_deps_statically"> |
| <code>link_deps_statically</code> |
| </td> |
| <td> |
| default = True<br/> |
| True to link dependencies statically, False dynamically. |
| </td> |
| </tr> |
| <tr> |
| <td id="link.stamp"> |
| <code>stamp</code> |
| </td> |
| <td> |
| default = 0<br/> |
| Whether to include build information in the linked executable, if output_type is 'executable'. If 1, build information is always included. If 0 (the default build information is always excluded. If -1, uses the default behavior, which may be overridden by the --[no]stamp flag. This should be unset (or set to 0) when generating the executable output for test rules. |
| </td> |
| </tr> |
| <tr> |
| <td id="link.additional_inputs"> |
| <code>additional_inputs</code> |
| </td> |
| <td> |
| <code><a class="anchor" href="list.html">sequence</a>; or <a class="anchor" href="depset.html">depset</a></code>; |
| default = []<br/> |
| For additional inputs to the linking action, e.g.: linking scripts. |
| </td> |
| </tr> |
| <tr> |
| <td id="link.grep_includes"> |
| <code>grep_includes</code> |
| </td> |
| <td> |
| <code><a class="anchor" href="File.html">File</a>; or <a class="anchor" href="globals.html#None">None</a></code>; |
| default = None<br/> |
| |
| </td> |
| </tr> |
| <tr> |
| <td id="link.additional_outputs"> |
| <code>additional_outputs</code> |
| </td> |
| <td> |
| <code><a class="anchor" href="list.html">sequence</a></code>; |
| default = unbound<br/> |
| For additional outputs to the linking action, e.g.: map files. |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| |
| <h2 id="merge_cc_infos">merge_cc_infos</h2> |
| <p><pre class="rule-signature"><a class="anchor" href="CcInfo.html">CcInfo</a> cc_common.merge_cc_infos(direct_cc_infos=[], cc_infos=[])</pre></p> |
| |
| Merges multiple <code>CcInfo</code>s into one. |
| |
| <!-- hide-from-toc is a class used by DevSite for the public Bazel site |
| (https://developers.google.com/devsite/reference/styles/headings#hide_headings_from_the_toc) --> |
| <h3 class="hide-from-toc">Parameters</h3> |
| <table class="table table-bordered table-condensed table-params"> |
| <colgroup> |
| <col class="col-param"> |
| <col class="param-description"> |
| </colgroup> |
| <thead> |
| <tr> |
| <th>Parameter</th> |
| <th>Description</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td id="merge_cc_infos.direct_cc_infos"> |
| <code>direct_cc_infos</code> |
| </td> |
| <td> |
| default = []<br/> |
| List of <code>CcInfo</code>s to be merged, whose headers will be exported by the direct fields in the returned provider. |
| </td> |
| </tr> |
| <tr> |
| <td id="merge_cc_infos.cc_infos"> |
| <code>cc_infos</code> |
| </td> |
| <td> |
| default = []<br/> |
| List of <code>CcInfo</code>s to be merged, whose headers will not be exported by the direct fields in the returned provider. |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| |
| <h2 id="merge_compilation_contexts">merge_compilation_contexts</h2> |
| <p><pre class="rule-signature"><a class="anchor" href="CompilationContext.html">CompilationContext</a> cc_common.merge_compilation_contexts(compilation_contexts=[])</pre></p> |
| |
| Merges multiple <code>CompilationContexts</code>s into one. |
| |
| <!-- hide-from-toc is a class used by DevSite for the public Bazel site |
| (https://developers.google.com/devsite/reference/styles/headings#hide_headings_from_the_toc) --> |
| <h3 class="hide-from-toc">Parameters</h3> |
| <table class="table table-bordered table-condensed table-params"> |
| <colgroup> |
| <col class="col-param"> |
| <col class="param-description"> |
| </colgroup> |
| <thead> |
| <tr> |
| <th>Parameter</th> |
| <th>Description</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td id="merge_compilation_contexts.compilation_contexts"> |
| <code>compilation_contexts</code> |
| </td> |
| <td> |
| default = []<br/> |
| List of <code>CompilationContexts</code>s to be merged. The headers of each context will be exported by the direct fields in the returned provider. |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| |
| <h2 id="merge_compilation_outputs">merge_compilation_outputs</h2> |
| <p><pre class="rule-signature"><a class="anchor" href="CcCompilationOutputs.html">CcCompilationOutputs</a> cc_common.merge_compilation_outputs(compilation_outputs=[])</pre></p> |
| |
| Merge compilation outputs. |
| |
| <!-- hide-from-toc is a class used by DevSite for the public Bazel site |
| (https://developers.google.com/devsite/reference/styles/headings#hide_headings_from_the_toc) --> |
| <h3 class="hide-from-toc">Parameters</h3> |
| <table class="table table-bordered table-condensed table-params"> |
| <colgroup> |
| <col class="col-param"> |
| <col class="param-description"> |
| </colgroup> |
| <thead> |
| <tr> |
| <th>Parameter</th> |
| <th>Description</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td id="merge_compilation_outputs.compilation_outputs"> |
| <code>compilation_outputs</code> |
| </td> |
| <td> |
| default = []<br/> |
| |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| |
| |
| </body> |
| </html> |
| |
| <!-- {% endraw %} --> |