メンバー
- action_is_enabled
- CcToolchainInfo
- configure_features
- create_cc_toolchain_config_info
- create_compilation_context
- create_compilation_outputs
- create_compile_variables
- create_library_to_link
- create_link_variables
- create_linker_input
- create_linking_context
- create_linking_context_from_compilation_outputs
- do_not_use_tools_cpp_compiler_present
- get_environment_variables
- get_execution_requirements
- get_memory_inefficient_command_line
- get_tool_for_action
- is_enabled
- リンク
- merge_compilation_contexts
- merge_compilation_outputs
action_is_enabled
bool cc_common.action_is_enabled(feature_configuration, action_name)
パラメータ
パラメータ | 説明 |
---|---|
feature_configuration
|
必須 クエリする機能構成。 |
action_name
|
必須 action_config の名前。 |
CcToolchainInfo
Provider cc_common.CcToolchainInfo
configure_features
FeatureConfiguration cc_common.configure_features(ctx=None, cc_toolchain, language=None, requested_features=[], unsupported_features=[])
パラメータ
パラメータ | 説明 |
---|---|
ctx
|
ctx または None 。デフォルトは None です。ルールのコンテキスト。 |
cc_toolchain
|
機能を構成する cc_toolchain。必須。 |
language
|
string; または None ; デフォルトは None 構成する言語: c++ または objc(デフォルトは c++) |
requested_features
|
デフォルトは [] です。有効にする機能のリスト。 |
unsupported_features
|
デフォルトは [] です。現在のルールでサポートされていない機能のリスト。 |
create_cc_toolchain_config_info
CcToolchainConfigInfo 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)
CcToolchainConfigInfo
プロバイダを作成します。
パラメータ
パラメータ | 説明 |
---|---|
ctx
|
必須 ルールのコンテキスト。 |
features
|
デフォルトは [] 1 つの機能のすべてのフラグ仕様が含まれます。 引数:
- provides に、有効にしたい別の機能またはアクション設定の名前が含まれている。- provides に、有効にしたい別の機能またはアクション設定の「provides」と同じ値が含まれている。この設定を使用すると、互換性のない機能が同時に誤って有効になり、診断が難しいコンパイラ エラーが発生することを防ぐことができます。 |
action_configs
|
デフォルトは [] です。 アクション構成は Bazel アクションに対応し、有効な機能に基づいてツールを選択できます。アクション構成の有効化は、機能と同じセマンティクスで行われます。機能は、他の機能と同じようにアクション構成を「必要」または「暗示」できます。 引数:
|
artifact_name_patterns
|
デフォルトは [] です。アクションに対する特定のカテゴリの入力または出力アーティファクトのアーティファクトの名前。 引数:
|
cxx_builtin_include_directories
|
デフォルトは [] です。 C++ コンパイル用の組み込みインクルード ディレクトリ。これらはコンパイラで使用される正確なパスである必要があり、通常は実行ルートからの相対パスです。 コンパイラで使用されるパスは、「gcc -E -xc++ - -v」で確認できます。 現在、C++ パスは C コンパイルにも使用されています。これは、C++ ヘッダー ファイルと C ヘッダー ファイルの間で名前の衝突がない限り安全です。 相対パスは、構成ファイル ディレクトリを基準として解決されます。 コンパイラが --sysroot をサポートしている場合、これらのパスはインクルード パスではなく %sysroot% を使用し、正しい置換を行うために必要な情報を blaze に提供する sysroot 属性を指定する必要があります。 |
toolchain_identifier
|
required crosstool リリース内のツールチェーンの一意の識別子。パスのディレクトリ名として使用できる必要があります。 次の正規表現に一致する必要があります: [a-zA-Z_][\.\- \w]* |
host_system_name
|
string、または None 。デフォルトは None です。 無視されます。 |
target_system_name
|
必須 GNU システム名。 |
target_cpu
|
required ターゲット アーキテクチャ文字列。 |
target_libc
|
必須 libc バージョン文字列(「glibc-2.2.2」など)。 |
compiler
|
必須 コンパイラのバージョン文字列(「gcc-4.1.1」など)。 |
abi_version
|
文字列、または None 。デフォルトは None 使用中の ABI(gcc バージョン)。例: "gcc-3.4" |
abi_libc_version
|
string、または None 。デフォルトは None です。 使用している ABI で使用される glibc バージョン。 |
tool_paths
|
デフォルトは [] ツールの場所。 引数:
|
make_variables
|
デフォルトは [] です。 ルールからアクセスできるようにする make 変数。 |
builtin_sysroot
|
string、または None 。デフォルトは None です。 組み込みの sysroot。この属性がない場合、Bazel は別の sysroot(--grte_top オプションなど)の使用を許可しません。 |
cc_target_os
|
文字列、または None 。デフォルトは None です。 内部目的でのみ使用します。使用しないでください。 |
create_compilation_context
CompilationContext cc_common.create_compilation_context(headers=unbound, system_includes=unbound, includes=unbound, quote_includes=unbound, framework_includes=unbound, defines=unbound, local_defines=unbound)
CompilationContext
を作成します。
パラメータ
パラメータ | 説明 |
---|---|
headers
|
デフォルトは unbound このターゲットをコンパイルするために必要なヘッダーのセット |
system_includes
|
デフォルトは unbound 山かっこで参照されるヘッダー ファイルの検索パスのセット(#include <foo/bar/header.h> など)。実行ルートからの相対パスまたは絶対パスを指定できます。通常は -isystem で渡されます |
includes
|
デフォルトは unbound です。 山かっこ(< >)と引用符(" ")の両方で参照されるヘッダー ファイルの検索パスのセット。通常は -I で渡されます。 |
quote_includes
|
デフォルトは unbound 引用符で参照されるヘッダー ファイルの検索パスのセット(#include "foo/bar/header.h" など)。実行ルートを基準とする相対パスまたは絶対パスを指定できます。通常は -iquote で渡されます。 |
framework_includes
|
デフォルトは unbound です。 ヘッダー ファイルのフレームワーク検索パスのセット(Apple プラットフォームのみ) |
defines
|
デフォルトは unbound このターゲットをコンパイルするために必要な定義のセット。各定義は文字列です。依存関係に推移的に伝播されます。 |
local_defines
|
デフォルトは unbound このターゲットをコンパイルするために必要な定義のセット。各定義は文字列です。依存関係に推移的に伝播されません。 |
create_compilation_outputs
CcCompilationOutputs cc_common.create_compilation_outputs(objects=None, pic_objects=None)
パラメータ
パラメータ | 説明 |
---|---|
objects
|
depset、または None 。デフォルトは None です。 オブジェクト ファイルのリスト。 |
pic_objects
|
depset、または None 。デフォルトは None です。 pic オブジェクト ファイルのリスト。 |
create_compile_variables
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)
パラメータ
パラメータ | 説明 |
---|---|
cc_toolchain
|
必須 ビルド変数を作成する cc_toolchain。 |
feature_configuration
|
必須 クエリする機能構成。 |
source_file
|
デフォルトは None です。 コンパイル用の省略可能なソースファイル。cc_common.get_memory_inefficient_command_line から生成されたコマンドラインの末尾に追加するよりも、ここで source_file を渡すことをおすすめします。そうすることで、コンパイラ フラグを適切に指定して配置する権限がツールチェーン作成者に与えられます。 |
output_file
|
デフォルトは None です。 コンパイルの省略可能な出力ファイル。cc_common.get_memory_inefficient_command_line から生成されたコマンドラインの末尾に追加するよりも、ここで output_file を渡すことをおすすめします。そうすることで、コンパイラ フラグを適切に指定して配置する権限がツールチェーン作成者に与えられます。 |
user_compile_flags
|
文字列のシーケンス、または None 。デフォルトは None です。 追加のコンパイル フラグ(copts)のリスト。 |
include_directories
|
depset、または None 。デフォルトは None です。インクルード ディレクトリの Depset。 |
quote_include_directories
|
depset、または None 。デフォルトは None です。引用符で囲まれたインクルード ディレクトリの Depset。 |
system_include_directories
|
depset、または None 。デフォルトは None です。システム インクルード ディレクトリの depset。 |
framework_include_directories
|
depset、または None 。デフォルトは None です。 フレームワークのインクルード ディレクトリの Depset。 |
preprocessor_defines
|
depset、または None 。デフォルトは None です。 プリプロセッサ定義の depset。 |
thinlto_index
|
文字列、または None 。デフォルトは None です。 LTO インデックス ファイルパス。 |
thinlto_input_bitcode_file
|
string; または None ;
デフォルトは None LTO バックエンドに入力されるビットコード ファイル。 |
thinlto_output_object_file
|
string、または None 。デフォルトは None です。 LTO バックエンドによって出力されるオブジェクト ファイル。 |
use_pic
|
デフォルトは False です。true の場合、コンパイルで位置独立コードが生成されます。 |
add_legacy_cxx_options
|
デフォルトは False です。 未使用です。 |
variables_extension
|
dict;
デフォルトは unbound コンパイル アクションで使用される追加の変数のディクショナリ。 |
create_library_to_link
LibraryToLink 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='')
LibraryToLink
パラメータ
パラメータ | 説明 |
---|---|
actions
|
必須actions オブジェクト。 |
feature_configuration
|
デフォルトは None feature_configuration です。 |
cc_toolchain
|
デフォルトは None です。使用する CcToolchainInfo プロバイダ。 |
static_library
|
ファイル。または None 。デフォルトは None リンクされる静的ライブラリの File 。 |
pic_static_library
|
ファイル。または None 。デフォルトは None です。リンクされる pic 静的ライブラリの File 。 |
dynamic_library
|
ファイル、または None 。デフォルトは None 。リンクされるダイナミック ライブラリの File 。ランタイムで常に使用され、interface_library が渡されない場合はリンクに使用されます。 |
interface_library
|
ファイル。または None 。デフォルトは None です。リンクするインターフェース ライブラリの File 。 |
pic_objects
|
File のシーケンス。デフォルトは unbound です。 試験運用版。使用しないでください。 |
objects
|
File のシーケンス。デフォルトは unbound です。 試験運用版。使用しないでください。 |
alwayslink
|
デフォルトは False です。--whole_archive ブロック内の静的ライブラリ/オブジェクトをリンクするかどうか。 |
dynamic_library_symlink_path
|
文字列。デフォルトは '' です。 solib ディレクトリ内のダイナミック ライブラリ リンクのデフォルト パスをオーバーライドします。デフォルトを使用する場合は空の文字列。 |
interface_library_symlink_path
|
デフォルトは '' です。solib ディレクトリ内のインターフェース ライブラリ リンクのデフォルト パスをオーバーライドします。デフォルトを使用する場合は空の文字列。 |
create_link_variables
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)
パラメータ
パラメータ | 説明 |
---|---|
cc_toolchain
|
必須 ビルド変数を作成する cc_toolchain。 |
feature_configuration
|
必須 クエリする機能構成。 |
library_search_directories
|
None 、または depset。デフォルトは None です。 リンカーがリンク時にライブラリを検索するディレクトリの Depset。 |
runtime_library_search_directories
|
None 、または depset。デフォルトは None です。 ローダーが実行時にライブラリを検索するディレクトリの depset。 |
user_link_flags
|
None 、または sequence。デフォルトは None です。 追加のリンクフラグ(linkopts)のリスト。 |
output_file
|
デフォルトは None です。 省略可能な出力ファイルパス。 |
param_file
|
デフォルトは None です。オプションのパラメータ ファイルパス。 |
def_file
|
デフォルトは None です。省略可。 |
is_using_linker
|
デフォルトは True です。リンカーを使用する場合は True、アーカイバを使用する場合は False です。呼び出し元は、使用されるアクション名と同期を保つ責任があります(実行可能ファイルまたは動的ライブラリのリンクの場合は is_using_linker = True、静的ライブラリのアーカイブの場合は is_using_linker = False)。 |
is_linking_dynamic_library
|
デフォルトは False です。動的ライブラリを作成する場合は True、実行可能ファイルまたは静的ライブラリの場合は False です。呼び出し元は、使用されるアクション名と同期させる責任があります。このフィールドは、b/65151735 が修正されると削除されます。 |
must_keep_debug
|
デフォルトは True です。 False に設定すると、bazel は通常リンカーを使用して出力ファイルからデバッグ シンボルを削除するために使用される「strip_debug_symbols」変数を公開します。 |
use_test_only_flags
|
デフォルトは False true に設定すると、is_cc_test 変数が設定されます。 |
is_static_linking_mode
|
デフォルトは True です。 未使用です。 |
create_linker_input
LinkerInput cc_common.create_linker_input(owner, libraries=None, user_link_flags=None, additional_inputs=None)
LinkerInput
を作成します。
パラメータ
パラメータ | 説明 |
---|---|
owner
|
必須 この入力で使用されるすべてのファイルを生成したターゲットのラベル。 |
libraries
|
None 、または depset。デフォルトは None です。 LibraryToLink のリスト。 |
user_link_flags
|
None 、文字列の depset、文字列の シーケンス。デフォルトは None です。 文字列として渡されるユーザーリンク フラグ。[String]、[[String]]、depset(String) のいずれかを受け入れます。後者は互換性のためにのみ保持され、depset がフラット化されるため、推奨されません。user_link_flags をフラット化されていない depsets() を介して伝播する場合は、LinkerInput でラップして、最後までフラット化されないようにします。 |
additional_inputs
|
None 、または depset。デフォルトは None です。 リンク アクションへの追加の入力(リンク スクリプトなど)。 |
create_linking_context
LinkingContext cc_common.create_linking_context(linker_inputs=None, libraries_to_link=None, user_link_flags=None, additional_inputs=None)
LinkingContext
を作成します。
パラメータ
パラメータ | 説明 |
---|---|
linker_inputs
|
None 、または depset。デフォルトは None です。 LinkerInput の Depset。 |
libraries_to_link
|
None 、または sequence。デフォルトは None です。 非推奨。このパラメータは非推奨となり、まもなく削除されます。これに依存しないでください。 --+incompatible_require_linker_input_cc_api で無効になっています。このフラグを使用して、コードが削除予定の API と互換性があることを確認します。LibraryToLink のリスト。 |
user_link_flags
|
None 、または sequence。デフォルトは None です。 非推奨。このパラメータは非推奨となり、まもなく削除されます。これに依存しないでください。 --+incompatible_require_linker_input_cc_api で無効になっています。このフラグを使用して、コードが削除予定の API と互換性があることを確認します。文字列として渡されるユーザーリンク フラグのリスト。 |
additional_inputs
|
None 、または sequence。デフォルトは None です。 非推奨。このパラメータは非推奨となり、まもなく削除されます。これに依存しないでください。 --+incompatible_require_linker_input_cc_api で無効になっています。このフラグを使用して、コードが削除予定の API と互換性があることを確認します。リンク アクションへの追加の入力(リンク スクリプトなど)。 |
create_linking_context_from_compilation_outputs
tuple 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)
CcLinkingContext
、CcLinkingOutputs
)のタプルを返します。
パラメータ
パラメータ | 説明 |
---|---|
actions
|
必須actions オブジェクト。 |
feature_configuration
|
クエリ対象の feature_configuration 。 |
cc_toolchain
|
使用する CcToolchainInfo プロバイダが必要です。 |
compilation_outputs
|
必須 リンクするオブジェクト ファイルを含むコンパイル出力。 |
user_link_flags
|
デフォルトは [] です。リンキング オプションの追加リスト。 |
linking_contexts
|
デフォルトは [] 依存関係のライブラリです。これらのライブラリは、バイナリまたはライブラリのいずれであっても、link() 呼び出しの出力アーティファクトにリンクされます。 |
name
|
必須 このメソッドで作成されたアクションの出力アーティファクトの名前付けに使用されます。 |
language
|
デフォルトは 'c++' です。現時点では C++ のみがサポートされています。このパラメータは使用しないでください。 |
alwayslink
|
デフォルトは False このライブラリを常にリンクするかどうか。 |
additional_inputs
|
デフォルトは [] です。 リンク アクションへの追加の入力(リンク スクリプトなど)。 |
disallow_static_libraries
|
デフォルトは False 静的ライブラリを作成するかどうか。 |
disallow_dynamic_library
|
デフォルトは False です。動的ライブラリを作成するかどうか。 |
do_not_use_tools_cpp_compiler_present
None
cc_common.do_not_use_tools_cpp_compiler_present
get_environment_variables
dict cc_common.get_environment_variables(feature_configuration, action_name, variables)
パラメータ
パラメータ | 説明 |
---|---|
feature_configuration
|
必須 クエリする機能構成。 |
action_name
|
必須 アクションの名前。@bazel_tools//tools/build_defs/cc:action_names.bzl(https://github.com/bazelbuild/bazel/blob/master/tools/build_defs/cc/action_names.bzl)にある名前のいずれかにする必要があります。 |
variables
|
必須 テンプレートの展開に使用されるビルド変数。 |
get_execution_requirements
sequence cc_common.get_execution_requirements(feature_configuration, action_name)
パラメータ
パラメータ | 説明 |
---|---|
feature_configuration
|
必須 クエリする機能構成。 |
action_name
|
必須 アクションの名前。@bazel_tools//tools/build_defs/cc:action_names.bzl(https://github.com/bazelbuild/bazel/blob/master/tools/build_defs/cc/action_names.bzl)にある名前のいずれかにする必要があります。 |
get_memory_inefficient_command_line
sequence cc_common.get_memory_inefficient_command_line(feature_configuration, action_name, variables)
パラメータ
パラメータ | 説明 |
---|---|
feature_configuration
|
必須 クエリする機能構成。 |
action_name
|
必須 アクションの名前。@bazel_tools//tools/build_defs/cc:action_names.bzl(https://github.com/bazelbuild/bazel/blob/master/tools/build_defs/cc/action_names.bzl)にある名前のいずれかにする必要があります。 |
variables
|
必須 テンプレートの展開に使用されるビルド変数。 |
get_tool_for_action
string cc_common.get_tool_for_action(feature_configuration, action_name)
パラメータ
パラメータ | 説明 |
---|---|
feature_configuration
|
必須 クエリする機能構成。 |
action_name
|
必須 アクションの名前。@bazel_tools//tools/build_defs/cc:action_names.bzl(https://github.com/bazelbuild/bazel/blob/master/tools/build_defs/cc/action_names.bzl)にある名前のいずれかにする必要があります。 |
is_enabled
bool cc_common.is_enabled(feature_configuration, feature_name)
パラメータ
パラメータ | 説明 |
---|---|
feature_configuration
|
必須 クエリする機能構成。 |
feature_name
|
必須 機能の名前。 |
リンク
CcLinkingOutputs 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=[], additional_outputs=unbound)
パラメータ
パラメータ | 説明 |
---|---|
actions
|
必須actions オブジェクト。 |
feature_configuration
|
クエリ対象の feature_configuration 。 |
cc_toolchain
|
使用する CcToolchainInfo プロバイダが必要です。 |
compilation_outputs
|
CcCompilationOutputs。または None 。デフォルトは None です。 リンクするオブジェクト ファイルを含むコンパイル出力。 |
user_link_flags
|
デフォルトは [] です。リンカー オプションの追加リスト。 |
linking_contexts
|
デフォルトは [] です。依存関係から、このルールで生成されたリンキング コンテキストにリンクされるリンキング コンテキスト。 |
name
|
必須 このメソッドで作成されたアクションの出力アーティファクトの名前付けに使用されます。 |
language
|
デフォルトは 'c++' です。現時点では C++ のみがサポートされています。このパラメータは使用しないでください。 |
output_type
|
デフォルトは 'executable' です。'executable' または 'dynamic_library' のいずれかにできます。 |
link_deps_statically
|
デフォルトは True です。依存関係を静的にリンクする場合は True、動的にリンクする場合は False。 |
stamp
|
デフォルトは 0 です。output_type が「executable」の場合、リンクされた実行可能ファイルにビルド情報を含めるかどうか。1 の場合、ビルド情報は常に含まれます。0 の場合(デフォルトのビルド情報は常に除外されます)。-1 の場合、デフォルトの動作を使用します。これは --[no]stamp フラグでオーバーライドできます。テストルールの実行可能出力を生成するときは、この値を設定しない(または 0 に設定する)必要があります。 |
additional_inputs
|
sequence、または depset。デフォルトは [] です。 リンク アクションへの追加の入力(リンク スクリプトなど)。 |
additional_outputs
|
sequence;
デフォルトは unbound リンキング アクションの追加の出力(マップファイルなど)。 |
merge_compilation_contexts
CompilationContext cc_common.merge_compilation_contexts(compilation_contexts=[])
CompilationContexts
を 1 つに統合します。
パラメータ
パラメータ | 説明 |
---|---|
compilation_contexts
|
デフォルトは [] マージする CompilationContexts のリスト。各コンテキストのヘッダーは、返されたプロバイダの直接フィールドによってエクスポートされます。 |
merge_compilation_outputs
CcCompilationOutputs cc_common.merge_compilation_outputs(compilation_outputs=[])
パラメータ
パラメータ | 説明 |
---|---|
compilation_outputs
|
デフォルトは [] です。 |