コンパイラオブジェクト (compiler
)
このオブジェクトは、meson.get_compiler()
によって返されます。これは、特定の言語のコンパイラを表し、そのプロパティを照会することができます。
返される場所
コンパイラオブジェクトは、以下の関数とメソッドによって返されます
これらのコンパイラチェックでは、add_*_arguments()
で追加されたコンパイラ引数、コマンドラインの-Dlang_args
、または環境変数のCFLAGS
/LDFLAGS
などを使いません。したがって、テストは完全に自己完結しており、ビルドファイルの他の部分やユーザーによって追加されたカスタムフラグが原因で失敗することはないと信頼できます。
すべての依存関係が単一のプレフィックスにある場合、GCC/Clangでは環境変数C_INCLUDE_PATH
に、MSVCではINCLUDE
に追加してデフォルトのインクルードパスを拡張し、GCC/ClangではLIBRARY_PATH
に、MSVCではLIB
に追加してデフォルトのライブラリ検索パスを拡張する方が簡単かもしれません。
ただし、GCCの場合、これらの変数はクロスコンパイル時には無視されます。その場合は、specsファイルを使用する必要があります。以下を参照してください: http://www.mingw.org/wiki/SpecsFileHOWTO
コンパイラオブジェクトのメソッド
compiler.alignment()
指定された型の配置を返します。C系言語の場合、ネイティブコンパイルではヘッダーstddef.h
とstdio.h
が暗黙的にインクルードされ、クロスコンパイルではstddef.h
のみがインクルードされます。
シグネチャ
# Returns the alignment of the specified type
int alignment(
str typename, # The name of the type to check
# Keyword arguments:
args : list[str] # Used to pass a list of compiler arguments
dependencies : dep | list[dep] # Additionally dependencies required for compiling and / or linking
prefix : str | list[str] # Used to add `#include`s and other things that are required
)
引数
メソッドcompiler.alignment()
は、以下の位置引数を受け取ります
名前 | 型 | 説明 | タグ |
---|---|---|---|
typename |
str |
チェックする型の名前。 |
|
最後に、compiler.alignment()
は、以下のキーワード引数を受け取ります
名前 | 型 | 説明 | タグ |
---|---|---|---|
args |
list [str ] |
コンパイラ引数のリストを渡すために使用します。デフォルトのインクルードパスにないヘッダーのインクルードパスを これは、インクルードディレクトリも |
|
dependencies |
dep | list [dep ] |
コンパイルおよび/またはリンクに必要な追加の依存関係。 |
|
prefix |
str | list [str ] |
|
|
compiler.check_header()
指定されたヘッダーが、指定されたプレフィックス、依存関係、および引数で使用可能な場合にtrueを返します。
シグネチャ
(0.47.0以降)
# Returns true if the specified header is *usable*
bool check_header(
str header_name, # The header to check
# Keyword arguments:
args : list[str] # Used to pass a list of compiler arguments
dependencies : dep | list[dep] # Additionally dependencies required for compiling and / or linking
include_directories : inc | list[inc] # Extra directories for header searches
no_builtin_args : bool # When set to `true`, the compiler arguments controlled by built-in configuration options are not added
prefix : str | list[str] # Used to add `#include`s and other things that are required
required : bool | feature # When set to `true`, Meson will halt if the header check fails
)
引数
メソッドcompiler.check_header()
は、以下の位置引数を受け取ります
名前 | 型 | 説明 | タグ |
---|---|---|---|
header_name |
str |
チェックするヘッダー。 |
|
最後に、compiler.check_header()
は、以下のキーワード引数を受け取ります
名前 | 型 | 説明 | タグ |
---|---|---|---|
args |
list [str ] |
コンパイラ引数のリストを渡すために使用します。デフォルトのインクルードパスにないヘッダーのインクルードパスを これは、インクルードディレクトリも |
|
dependencies |
dep | list [dep ] |
コンパイルおよび/またはリンクに必要な追加の依存関係。 |
|
include_directories |
inc | list [inc ] |
ヘッダー検索用の追加ディレクトリ。 |
(0.38.0以降) |
no_builtin_args |
bool |
|
|
prefix |
str | list [str ] |
|
|
required |
bool | feature |
|
(0.50.0以降)
|
compiler.cmd_array()
コンパイラのコマンドを含む配列を返します。
シグネチャ
list[str] cmd_array()
compiler.compiles()
コードがコンパイルされる場合にtrueを返します。
シグネチャ
# Returns true if the code compiles
bool compiles(
str | file code, # The source code to check
# Keyword arguments:
args : list[str] # Used to pass a list of compiler arguments
dependencies : dep | list[dep] # Additionally dependencies required for compiling and / or linking
include_directories : inc | list[inc] # Extra directories for header searches
name : str # The name to use for printing a message about the compiler check
no_builtin_args : bool # When set to `true`, the compiler arguments controlled by built-in configuration options are not added
required : bool | feature # When set to `true`, Meson will halt if the check fails
werror : bool # When set to `true`, compiler warnings are treated as error
)
引数
メソッドcompiler.compiles()
は、以下の位置引数を受け取ります
名前 | 型 | 説明 | タグ |
---|---|---|---|
code |
str | file |
チェックするソースコード。 文字列が渡された場合、コードは直接使用されます。 |
|
最後に、compiler.compiles()
は、以下のキーワード引数を受け取ります
名前 | 型 | 説明 | タグ |
---|---|---|---|
args |
list [str ] |
コンパイラ引数のリストを渡すために使用します。デフォルトのインクルードパスにないヘッダーのインクルードパスを これは、インクルードディレクトリも |
|
dependencies |
dep | list [dep ] |
コンパイルおよび/またはリンクに必要な追加の依存関係。 |
|
include_directories |
inc | list [inc ] |
ヘッダー検索用の追加ディレクトリ。 |
(0.38.0以降) |
name |
str |
コンパイラチェックに関するメッセージを印刷するために使用する名前。このキーワード引数が渡されない場合、チェックに関するメッセージは印刷されません。 |
|
no_builtin_args |
bool |
|
|
required |
bool | feature |
|
(1.5.0以降)
|
werror |
bool |
|
(1.3.0以降)
|
compiler.compute_int()
与えられた式の値(例:1 + 2
)を計算します。クロスコンパイルの場合、これは反復アルゴリズムで評価されます。キーワード引数low
(デフォルトは-1024)、high
(デフォルトは1024)、およびguess
を指定して、検索の最大値と最小値、および最初に試す値を指定できます。C系言語の場合、ネイティブコンパイルではヘッダーstddef.h
とstdio.h
が暗黙的にインクルードされ、クロスコンパイルではstddef.h
のみがインクルードされます。
シグネチャ
(0.40.0以降)
# Computes the value of the given expression
int compute_int(
str expr, # The expression to compute
# Keyword arguments:
args : list[str] # Used to pass a list of compiler arguments
dependencies : dep | list[dep] # Additionally dependencies required for compiling and / or linking
guess : int # The value to try first
high : int # The max value
include_directories : inc | list[inc] # Extra directories for header searches
low : int # The min value
no_builtin_args : bool # When set to `true`, the compiler arguments controlled by built-in configuration options are not added
prefix : str | list[str] # Used to add `#include`s and other things that are required
)
引数
メソッドcompiler.compute_int()
は、以下の位置引数を受け取ります
名前 | 型 | 説明 | タグ |
---|---|---|---|
expr |
str |
計算する式。 |
|
最後に、compiler.compute_int()
は、以下のキーワード引数を受け取ります
名前 | 型 | 説明 | タグ |
---|---|---|---|
args |
list [str ] |
コンパイラ引数のリストを渡すために使用します。デフォルトのインクルードパスにないヘッダーのインクルードパスを これは、インクルードディレクトリも |
|
dependencies |
dep | list [dep ] |
コンパイルおよび/またはリンクに必要な追加の依存関係。 |
|
guess |
int |
最初に試す値。 |
|
high |
int |
最大値。 |
|
include_directories |
inc | list [inc ] |
ヘッダー検索用の追加ディレクトリ。 |
(0.38.0以降) |
low |
int |
最小値。 |
|
no_builtin_args |
bool |
|
|
prefix |
str | list [str ] |
|
|
compiler.find_library()
位置引数で指定されたライブラリを検索しようとします。
シグネチャ
# Tries to find the library specified in the positional argument
dep find_library(
str libname, # The library to find
# Keyword arguments:
dirs : list[str] # Additional directories to search in
disabler : bool # If `true`, this method will return a disabler
on a failed check.
has_headers : list[str] # List of headers that must be found as well
header_args : list[str] # When the `has_headers` kwarg is also used, this argument is passed to
header_dependencies : dep | list[dep] # When the `has_headers` kwarg is also used, this argument is passed to
header_include_directories : inc | list[inc] # When the `has_headers` kwarg is also used, this argument is passed to
header_no_builtin_args : bool # When the `has_headers` kwarg is also used, this argument is passed to
header_prefix : str # When the `has_headers` kwarg is also used, this argument is passed to
required : bool | feature # If set `true`, Meson will abort with an error if the library could not
static : bool # If `true`, the search is limited to static libraries only
)
引数
メソッドcompiler.find_library()
は、以下の位置引数を受け取ります
名前 | 型 | 説明 | タグ |
---|---|---|---|
libname |
str |
検索するライブラリ。 |
|
最後に、compiler.find_library()
は、以下のキーワード引数を受け取ります
名前 | 型 | 説明 | タグ |
---|---|---|---|
dirs |
list [str ] |
検索する追加のディレクトリ。 デフォルトでは、ライブラリはシステムライブラリディレクトリ(例:/usr/lib)で検索されます。ここにさらに多くのディレクトリを指定すると、Mesonはシステムディレクトリだけでなく、これらのディレクトリも検索します。 |
|
disabler |
bool |
|
(0.49.0以降)
|
has_headers |
list [str ] |
同様に見つかる必要があるヘッダーのリスト。このチェックは、 使用すると、 |
(0.50.0以降) |
header_args |
list [str ] |
|
(0.51.0以降) |
header_dependencies |
dep | list [dep ] |
|
(0.51.0以降) |
header_include_directories |
inc | list [inc ] |
|
(0.51.0以降) |
header_no_builtin_args |
bool |
|
(0.51.0以降)
|
header_prefix |
str |
|
(0.51.0以降) |
required |
bool | feature |
(0.47.0以降) |
|
static |
bool |
|
(0.51.0以降)
|
compiler.first_supported_argument()
文字列のリストが与えられた場合、compiler.has_argument()
テストに合格する最初の引数を含む単一要素リストを返すか、合格するものがない場合は空の配列を返します。
シグネチャ
(0.43.0以降)
# Given a list of strings, returns a single-element list containing the first
list[str] first_supported_argument(
str arg..., # The arguments to check
)
引数
このメソッドは、0
からinfinity
の可変引数(arg...
)を受け入れ、型は
です。str
チェックする引数。
compiler.first_supported_link_argument()
文字列のリストが与えられた場合、compiler.has_link_argument()
テストに合格する最初の引数を返すか、合格するものがない場合は空の配列を返します。
シグネチャ
(0.46.0以降)
# Given a list of strings, returns the first argument that passes the
list[str] first_supported_link_argument(
str arg..., # The link arguments to check
)
引数
このメソッドは、0
からinfinity
の可変引数(arg...
)を受け入れ、型は
です。str
チェックするリンク引数。
compiler.get_argument_syntax()
コンパイラが受け取る引数の種類を識別する文字列を返します。gcc
、msvc
、または未定義の文字列値のいずれかになります。このメソッドは、gccやmsvcではないが、clangやiccなど、それらの2つのコンパイラのいずれかと同じ引数構文を使用するコンパイラを識別するのに役立ちます。特に、オペレーティングシステムによって異なる構文を使用する場合に役立ちます。
シグネチャ
(0.49.0以降)
str get_argument_syntax()
compiler.get_define()
指定されたプリプロセッサシンボルの値を文字列として返すか、定義されていない場合は空の文字列を返します。
(0.47.0以降) このメソッドは、コンパイラが実行するのと同じように、文字列リテラルを連結します。例:"a" "b"
は"ab"
になります。
シグネチャ
(0.40.0以降)
# Returns the given preprocessor symbol's value
str get_define(
str definename, # The define to check
# Keyword arguments:
args : list[str] # Used to pass a list of compiler arguments
dependencies : dep | list[dep] # Additionally dependencies required for compiling and / or linking
include_directories : inc | list[inc] # Extra directories for header searches
no_builtin_args : bool # When set to `true`, the compiler arguments controlled by built-in configuration options are not added
prefix : str | list[str] # Used to add `#include`s and other things that are required
)
引数
メソッドcompiler.get_define()
は、以下の位置引数を受け取ります
名前 | 型 | 説明 | タグ |
---|---|---|---|
definename |
str |
チェックする定義。 |
|
最後に、compiler.get_define()
は、以下のキーワード引数を受け取ります
名前 | 型 | 説明 | タグ |
---|---|---|---|
args |
list [str ] |
コンパイラ引数のリストを渡すために使用します。デフォルトのインクルードパスにないヘッダーのインクルードパスを これは、インクルードディレクトリも |
|
dependencies |
dep | list [dep ] |
コンパイルおよび/またはリンクに必要な追加の依存関係。 |
|
include_directories |
inc | list [inc ] |
ヘッダー検索用の追加ディレクトリ。 |
(0.38.0以降) |
no_builtin_args |
bool |
|
|
prefix |
str | list [str ] |
|
|
compiler.get_id()
コンパイラを識別する文字列を返します。例:gcc
、msvc
、その他。
シグネチャ
str get_id()
compiler.get_linker_id()
リンカーを識別する文字列を返します。例:ld.bfd
、link
、その他。
シグネチャ
(0.53.0以降)
str get_linker_id()
compiler.get_supported_arguments()
compiler.has_argument()
が個別に呼び出されたかのように、コンパイラでサポートされている引数のみを含む配列を返します。
シグネチャ
(0.43.0以降)
# Returns an array containing only the arguments supported by the compiler,
list[str] get_supported_arguments(
str arg..., # The arguments to check
# Keyword arguments:
checked : str # Supported values:
)
引数
このメソッドは、0
からinfinity
の可変引数(arg...
)を受け入れ、型は
です。str
チェックする引数。
メソッドcompiler.get_supported_arguments()
は、以下のキーワード引数を受け取ります
名前 | 型 | 説明 | タグ |
---|---|---|---|
checked |
str |
サポートされている値
|
(0.59.0以降)
|
compiler.get_supported_function_attributes()
サポートされているGCCスタイルの属性名を格納した配列を返します。compiler.has_function_attribute()
をそれぞれの属性名に対して個別に呼び出した場合と同じです。
シグネチャ
(since 0.48.0)
list[str] get_supported_function_attributes()
compiler.get_supported_link_arguments()
compiler.has_link_argument()
を個別に呼び出した場合と同様に、コンパイラがサポートする引数のみを格納した配列を返します。
シグネチャ
(0.46.0以降)
# Returns an array containing only the arguments supported by the compiler,
list[str] get_supported_link_arguments(
str arg..., # The link arguments to check
)
引数
このメソッドは、0
からinfinity
の可変引数(arg...
)を受け入れ、型は
です。str
チェックするリンク引数。
compiler.has_argument()
指定されたコマンドライン引数をコンパイラが受け入れる場合、つまり、エラーを発生させたり、不明なフラグに関する警告を出力したりせずにコードをコンパイルできる場合は、true
を返します。
シグネチャ
# Returns `true` if the compiler accepts the specified command line argument,
bool has_argument(
str argument, # The argument to check
# Keyword arguments:
required : bool | feature # When set to `true`, Meson will halt if the check fails
)
引数
compiler.has_argument()
メソッドは、以下の位置引数を受け入れます。
名前 | 型 | 説明 | タグ |
---|---|---|---|
argument |
str |
チェックする引数。 |
|
最後に、compiler.has_argument()
は以下のキーワード引数を受け入れます。
名前 | 型 | 説明 | タグ |
---|---|---|---|
required |
bool | feature |
|
(1.3.0以降)
|
compiler.has_define()
指定されたプリプロセッサシンボルが定義されている場合は true を返します。
シグネチャ
(1.3.0以降)
# Returns true if the given preprocessor symbol is *defined*
bool has_define(
str definename, # The define to check
# Keyword arguments:
args : list[str] # Used to pass a list of compiler arguments
dependencies : dep | list[dep] # Additionally dependencies required for compiling and / or linking
include_directories : inc | list[inc] # Extra directories for header searches
no_builtin_args : bool # When set to `true`, the compiler arguments controlled by built-in configuration options are not added
prefix : str | list[str] # Used to add `#include`s and other things that are required
)
引数
compiler.has_define()
メソッドは、以下の位置引数を受け入れます。
名前 | 型 | 説明 | タグ |
---|---|---|---|
definename |
str |
チェックする定義。 |
|
最後に、compiler.has_define()
は以下のキーワード引数を受け入れます。
名前 | 型 | 説明 | タグ |
---|---|---|---|
args |
list [str ] |
コンパイラ引数のリストを渡すために使用します。デフォルトのインクルードパスにないヘッダーのインクルードパスを これは、インクルードディレクトリも |
|
dependencies |
dep | list [dep ] |
コンパイルおよび/またはリンクに必要な追加の依存関係。 |
|
include_directories |
inc | list [inc ] |
ヘッダー検索用の追加ディレクトリ。 |
(0.38.0以降) |
no_builtin_args |
bool |
|
|
prefix |
str | list [str ] |
|
|
compiler.has_function()
標準ライブラリまたは args
キーワードで渡されたライブラリによって指定された関数が提供されている場合は true を返します。
シグネチャ
# Returns true if the given function is provided
bool has_function(
str funcname, # The function to check
# Keyword arguments:
args : list[str] # Used to pass a list of compiler arguments
dependencies : dep | list[dep] # Additionally dependencies required for compiling and / or linking
include_directories : inc | list[inc] # Extra directories for header searches
no_builtin_args : bool # When set to `true`, the compiler arguments controlled by built-in configuration options are not added
prefix : str | list[str] # Used to add `#include`s and other things that are required
required : bool | feature # When set to `true`, Meson will halt if the check fails
)
引数
compiler.has_function()
メソッドは、以下の位置引数を受け入れます。
名前 | 型 | 説明 | タグ |
---|---|---|---|
funcname |
str |
チェックする関数。 |
|
最後に、compiler.has_function()
は以下のキーワード引数を受け入れます。
名前 | 型 | 説明 | タグ |
---|---|---|---|
args |
list [str ] |
コンパイラ引数のリストを渡すために使用します。デフォルトのインクルードパスにないヘッダーのインクルードパスを これは、インクルードディレクトリも |
|
dependencies |
dep | list [dep ] |
コンパイルおよび/またはリンクに必要な追加の依存関係。 |
|
include_directories |
inc | list [inc ] |
ヘッダー検索用の追加ディレクトリ。 |
(0.38.0以降) |
no_builtin_args |
bool |
|
|
prefix |
str | list [str ] |
|
|
required |
bool | feature |
|
(1.3.0以降)
|
compiler.has_function_attribute()
コンパイラがGNUスタイルの(__attribute__(...)
) name
をサポートしている場合は true
を返します。このような属性をサポートしないコンパイラ向けに最適化できる可能性があるため、手動のコンパイルチェックよりも望ましい方法です。この表に、サポートされているすべての属性が記載されています。
シグネチャ
(since 0.48.0)
# Returns `true` if the compiler supports the GNU style (`__attribute__(
bool has_function_attribute(
str name, # The attribute name to check
# Keyword arguments:
required : bool | feature # When set to `true`, Meson will halt if the check fails
)
引数
compiler.has_function_attribute()
メソッドは、以下の位置引数を受け入れます。
名前 | 型 | 説明 | タグ |
---|---|---|---|
name |
str |
チェックする属性名。 |
|
最後に、compiler.has_function_attribute()
は以下のキーワード引数を受け入れます。
名前 | 型 | 説明 | タグ |
---|---|---|---|
required |
bool | feature |
|
(1.3.0以降)
|
compiler.has_header()
指定されたヘッダーが指定されたプレフィックス、依存関係、および引数で存在する場合に true を返します。
このメソッドはプリプロセッサチェックのみを実行するため、compiler.check_header()
よりも高速です。
シグネチャ
# Returns true if the specified header is *exists*
bool has_header(
str header_name, # The header to check
# Keyword arguments:
args : list[str] # Used to pass a list of compiler arguments
dependencies : dep | list[dep] # Additionally dependencies required for compiling and / or linking
include_directories : inc | list[inc] # Extra directories for header searches
no_builtin_args : bool # When set to `true`, the compiler arguments controlled by built-in configuration options are not added
prefix : str | list[str] # Used to add `#include`s and other things that are required
required : bool | feature # When set to `true`, Meson will halt if the header check fails
)
引数
compiler.has_header()
メソッドは、以下の位置引数を受け入れます。
名前 | 型 | 説明 | タグ |
---|---|---|---|
header_name |
str |
チェックするヘッダー。 |
|
最後に、compiler.has_header()
は以下のキーワード引数を受け入れます。
名前 | 型 | 説明 | タグ |
---|---|---|---|
args |
list [str ] |
コンパイラ引数のリストを渡すために使用します。デフォルトのインクルードパスにないヘッダーのインクルードパスを これは、インクルードディレクトリも |
|
dependencies |
dep | list [dep ] |
コンパイルおよび/またはリンクに必要な追加の依存関係。 |
|
include_directories |
inc | list [inc ] |
ヘッダー検索用の追加ディレクトリ。 |
(0.38.0以降) |
no_builtin_args |
bool |
|
|
prefix |
str | list [str ] |
|
|
required |
bool | feature |
|
(0.50.0以降)
|
compiler.has_header_symbol()
指定されたヘッダーに特定のシンボルが宣言されているかどうかを検出します。
ここでいうシンボルには、関数、変数、#define
、型定義などが含まれます。
シグネチャ
# Detects whether a particular symbol is declared in the specified header
bool has_header_symbol(
str header, # The header to check
str symbol, # The symbol to check
# Keyword arguments:
args : list[str] # Used to pass a list of compiler arguments
dependencies : dep | list[dep] # Additionally dependencies required for compiling and / or linking
include_directories : inc | list[inc] # Extra directories for header searches
no_builtin_args : bool # When set to `true`, the compiler arguments controlled by built-in configuration options are not added
prefix : str | list[str] # Used to add `#include`s and other things that are required
required : bool | feature # When set to `true`, Meson will halt if the header check fails
)
引数
compiler.has_header_symbol()
メソッドは、以下の位置引数を受け入れます。
名前 | 型 | 説明 | タグ |
---|---|---|---|
header |
str |
チェックするヘッダー。 |
|
symbol |
str |
チェックするシンボル。 |
|
最後に、compiler.has_header_symbol()
は以下のキーワード引数を受け入れます。
名前 | 型 | 説明 | タグ |
---|---|---|---|
args |
list [str ] |
コンパイラ引数のリストを渡すために使用します。デフォルトのインクルードパスにないヘッダーのインクルードパスを これは、インクルードディレクトリも |
|
dependencies |
dep | list [dep ] |
コンパイルおよび/またはリンクに必要な追加の依存関係。 |
|
include_directories |
inc | list [inc ] |
ヘッダー検索用の追加ディレクトリ。 |
(0.38.0以降) |
no_builtin_args |
bool |
|
|
prefix |
str | list [str ] |
|
|
required |
bool | feature |
|
(0.50.0以降)
|
compiler.has_link_argument()
リンカが指定されたコマンドライン引数を受け入れる場合、つまり、エラーを発生させたり、不明なフラグに関する警告を出力したりせずにコードをコンパイルおよびリンクできる場合は true
を返します。リンク引数はコンパイラに渡されるため、通常は -Wl,
プレフィックスが付いている必要があります。VisualStudioでは、/link
引数が先頭に追加されます。
シグネチャ
(0.46.0以降)
# Returns `true` if the linker accepts the specified command line argument,
bool has_link_argument(
str argument, # The argument to check
# Keyword arguments:
required : bool | feature # When set to `true`, Meson will halt if the check fails
)
引数
compiler.has_link_argument()
メソッドは、以下の位置引数を受け入れます。
名前 | 型 | 説明 | タグ |
---|---|---|---|
argument |
str |
チェックする引数。 |
|
最後に、compiler.has_link_argument()
は以下のキーワード引数を受け入れます。
名前 | 型 | 説明 | タグ |
---|---|---|---|
required |
bool | feature |
|
(1.3.0以降)
|
compiler.has_member()
型に指定されたメンバーがある場合は true を返します。
シグネチャ
# Returns true if the type has the specified member
bool has_member(
str typename, # The type to check
str membername, # The member to check
# Keyword arguments:
args : list[str] # Used to pass a list of compiler arguments
dependencies : dep | list[dep] # Additionally dependencies required for compiling and / or linking
include_directories : inc | list[inc] # Extra directories for header searches
no_builtin_args : bool # When set to `true`, the compiler arguments controlled by built-in configuration options are not added
prefix : str | list[str] # Used to add `#include`s and other things that are required
required : bool | feature # When set to `true`, Meson will halt if the check fails
)
引数
compiler.has_member()
メソッドは、以下の位置引数を受け入れます。
名前 | 型 | 説明 | タグ |
---|---|---|---|
typename |
str |
チェックする型。 |
|
membername |
str |
チェックするメンバー。 |
|
最後に、compiler.has_member()
は以下のキーワード引数を受け入れます。
名前 | 型 | 説明 | タグ |
---|---|---|---|
args |
list [str ] |
コンパイラ引数のリストを渡すために使用します。デフォルトのインクルードパスにないヘッダーのインクルードパスを これは、インクルードディレクトリも |
|
dependencies |
dep | list [dep ] |
コンパイルおよび/またはリンクに必要な追加の依存関係。 |
|
include_directories |
inc | list [inc ] |
ヘッダー検索用の追加ディレクトリ。 |
(0.38.0以降) |
no_builtin_args |
bool |
|
|
prefix |
str | list [str ] |
|
|
required |
bool | feature |
|
(1.3.0以降)
|
compiler.has_members()
型が指定されたすべてのメンバーを持っている場合は、true
を返します。
シグネチャ
# Returns `true` if the type has *all* the specified members
bool has_members(
str typename, # The type to check
str member..., # The members to check
# Keyword arguments:
args : list[str] # Used to pass a list of compiler arguments
dependencies : dep | list[dep] # Additionally dependencies required for compiling and / or linking
include_directories : inc | list[inc] # Extra directories for header searches
no_builtin_args : bool # When set to `true`, the compiler arguments controlled by built-in configuration options are not added
prefix : str | list[str] # Used to add `#include`s and other things that are required
required : bool | feature # When set to `true`, Meson will halt if the check fails
)
引数
compiler.has_members()
メソッドは、以下の位置引数を受け入れます。
名前 | 型 | 説明 | タグ |
---|---|---|---|
typename |
str |
チェックする型。 |
|
さらに、このメソッドは 1
個から無限個の可変引数 (member...
) (型
) を受け入れます。str
チェックするメンバー
最後に、compiler.has_members()
は以下のキーワード引数を受け入れます。
名前 | 型 | 説明 | タグ |
---|---|---|---|
args |
list [str ] |
コンパイラ引数のリストを渡すために使用します。デフォルトのインクルードパスにないヘッダーのインクルードパスを これは、インクルードディレクトリも |
|
dependencies |
dep | list [dep ] |
コンパイルおよび/またはリンクに必要な追加の依存関係。 |
|
include_directories |
inc | list [inc ] |
ヘッダー検索用の追加ディレクトリ。 |
(0.38.0以降) |
no_builtin_args |
bool |
|
|
prefix |
str | list [str ] |
|
|
required |
bool | feature |
|
(1.3.0以降)
|
compiler.has_multi_arguments()
compiler.has_argument()
と同じですが、複数の引数を受け取り、それらをすべて 1 回のコンパイラ呼び出しで使用します。
シグネチャ
(since 0.37.0)
# the same as compiler.has_argument()
but takes multiple arguments
bool has_multi_arguments(
str arg..., # The arguments to check
# Keyword arguments:
required : bool | feature # When set to `true`, Meson will halt if the check fails
)
引数
このメソッドは、0
からinfinity
の可変引数(arg...
)を受け入れ、型は
です。str
チェックする引数。
compiler.has_multi_arguments()
メソッドは、以下のキーワード引数を受け入れます。
名前 | 型 | 説明 | タグ |
---|---|---|---|
required |
bool | feature |
|
(1.3.0以降)
|
compiler.has_multi_link_arguments()
compiler.has_link_argument()
と同じですが、複数の引数を受け取り、それらをすべて 1 回のコンパイラ呼び出しで使用します。
シグネチャ
(0.46.0以降)
# the same as compiler.has_link_argument()
but takes multiple arguments
bool has_multi_link_arguments(
str arg..., # The link arguments to check
# Keyword arguments:
required : bool | feature # When set to `true`, Meson will halt if the check fails
)
引数
このメソッドは、0
からinfinity
の可変引数(arg...
)を受け入れ、型は
です。str
チェックするリンク引数。
compiler.has_multi_link_arguments()
メソッドは、以下のキーワード引数を受け入れます。
名前 | 型 | 説明 | タグ |
---|---|---|---|
required |
bool | feature |
|
(1.3.0以降)
|
compiler.has_type()
指定されたトークンが型の場合は、true
を返します。
シグネチャ
# Returns `true` if the specified token is a type
bool has_type(
str typename, # The type to check
# Keyword arguments:
args : list[str] # Used to pass a list of compiler arguments
dependencies : dep | list[dep] # Additionally dependencies required for compiling and / or linking
include_directories : inc | list[inc] # Extra directories for header searches
no_builtin_args : bool # When set to `true`, the compiler arguments controlled by built-in configuration options are not added
prefix : str | list[str] # Used to add `#include`s and other things that are required
required : bool | feature # When set to `true`, Meson will halt if the check fails
)
引数
compiler.has_type()
メソッドは、以下の位置引数を受け入れます。
名前 | 型 | 説明 | タグ |
---|---|---|---|
typename |
str |
チェックする型。 |
|
最後に、compiler.has_type()
は以下のキーワード引数を受け入れます。
名前 | 型 | 説明 | タグ |
---|---|---|---|
args |
list [str ] |
コンパイラ引数のリストを渡すために使用します。デフォルトのインクルードパスにないヘッダーのインクルードパスを これは、インクルードディレクトリも |
|
dependencies |
dep | list [dep ] |
コンパイルおよび/またはリンクに必要な追加の依存関係。 |
|
include_directories |
inc | list [inc ] |
ヘッダー検索用の追加ディレクトリ。 |
(0.38.0以降) |
no_builtin_args |
bool |
|
|
prefix |
str | list [str ] |
|
|
required |
bool | feature |
|
(1.3.0以降)
|
compiler.links()
コードがコンパイルされてリンクする場合は true を返します。
0.60.0以降、file
オブジェクトのサフィックスがコンパイラオブジェクトの言語と一致しない場合、サフィックスに対応するコンパイラがソースのコンパイルに使用され、links
メソッドのターゲットが結果のオブジェクトファイルのリンクに使用されます。
シグネチャ
# Returns true if the code compiles and links
bool links(
str | file code, # The source code to check
# Keyword arguments:
args : list[str] # Used to pass a list of compiler arguments
dependencies : dep | list[dep] # Additionally dependencies required for compiling and / or linking
include_directories : inc | list[inc] # Extra directories for header searches
name : str # The name to use for printing a message about the compiler check
no_builtin_args : bool # When set to `true`, the compiler arguments controlled by built-in configuration options are not added
required : bool | feature # When set to `true`, Meson will halt if the check fails
werror : bool # When set to `true`, compiler warnings are treated as error
)
引数
compiler.links()
メソッドは、以下の位置引数を受け入れます。
名前 | 型 | 説明 | タグ |
---|---|---|---|
code |
str | file |
チェックするソースコード。 文字列が渡された場合、コードは直接使用されます。 |
|
最後に、compiler.links()
は以下のキーワード引数を受け入れます。
名前 | 型 | 説明 | タグ |
---|---|---|---|
args |
list [str ] |
コンパイラ引数のリストを渡すために使用します。デフォルトのインクルードパスにないヘッダーのインクルードパスを これは、インクルードディレクトリも |
|
dependencies |
dep | list [dep ] |
コンパイルおよび/またはリンクに必要な追加の依存関係。 |
|
include_directories |
inc | list [inc ] |
ヘッダー検索用の追加ディレクトリ。 |
(0.38.0以降) |
name |
str |
コンパイラチェックに関するメッセージを印刷するために使用する名前。このキーワード引数が渡されない場合、チェックに関するメッセージは印刷されません。 |
|
no_builtin_args |
bool |
|
|
required |
bool | feature |
|
(1.5.0以降)
|
werror |
bool |
|
(1.3.0以降)
|
compiler.preprocess()
ソースファイルのリストをプリプロセスしますが、コンパイルはしません。プリプロセッサは、通常のコンパイルと同じ引数(インクルードディレクトリ、定義など)を受け取ります。これには、たとえば、add_project_arguments()
で追加された引数や、コマンドラインで -Dc_args=-DFOO
を使用して追加された引数が含まれます。
シグネチャ
(since 0.64.0)
# Preprocess a list of source files but do not compile them
list[custom_idx] preprocess(
str | file | custom_tgt | custom_idx | generated_list source..., # Input source to preprocess
# Keyword arguments:
compile_args : list[str] # Extra flags to pass to the preprocessor
dependencies : dep | list[dep] # Additionally dependencies required
depends : list[build_tgt | custom_tgt] # Specifies that this target depends on the specified
include_directories : inc | list[inc] # Extra directories for header searches
output : str # Template for name of preprocessed files: `@PLAINNAME@` is replaced by
)
引数
このメソッドは、0
個から無限個の可変引数 (source...
) (型
) を受け入れます。str
| file
| custom_tgt
| custom_idx
| generated_list
プリプロセスする入力ソース。次の型がサポートされています。
-
現在のソースディレクトリに対する相対パス文字列
-
先行するビルドファイルで定義された
file
オブジェクト -
configure_file()
などの設定時ジェネレーターの戻り値 -
custom_target()
やgenerator.process()
などのビルド時ジェネレーターの戻り値compiler.preprocess()
メソッドは、以下のキーワード引数を受け入れます。名前 型 説明 タグ compile_args
list
[str
]プリプロセッサに渡す追加のフラグ
dependencies
dep
|list
[dep
]追加の必要な依存関係。
(since 1.1.0)
depends
list
[build_tgt
|custom_tgt
]このターゲットが指定されたターゲットに依存することを指定します。これらのターゲットは、入力をプリプロセスする前にビルドする必要があります。
(since 1.4.0)
include_directories
inc
|list
[inc
]ヘッダー検索用の追加ディレクトリ。
(0.38.0以降)
output
str
プリプロセスされたファイルの名前のテンプレート:
@PLAINNAME@
はソースファイル名に置き換えられ、@BASENAME@
は拡張子なしのソースファイル名に置き換えられます。
compiler.run()
指定されたコードフラグメントのコンパイルと実行を試みます。
シグネチャ
# Attempts to compile and execute the given code fragment
runresult run(
str | file code, # The source code to check
# Keyword arguments:
args : list[str] # Used to pass a list of compiler arguments
dependencies : dep | list[dep] # Additionally dependencies required for compiling and / or linking
include_directories : inc | list[inc] # Extra directories for header searches
name : str # The name to use for printing a message about the compiler check
no_builtin_args : bool # When set to `true`, the compiler arguments controlled by built-in configuration options are not added
required : bool | feature # When set to `true`, Meson will halt if the check fails
werror : bool # When set to `true`, compiler warnings are treated as error
)
引数
compiler.run()
メソッドは、以下の位置引数を受け入れます。
名前 | 型 | 説明 | タグ |
---|---|---|---|
code |
str | file |
チェックするソースコード。 文字列が渡された場合、コードは直接使用されます。 |
|
最後に、compiler.run()
は以下のキーワード引数を受け入れます。
名前 | 型 | 説明 | タグ |
---|---|---|---|
args |
list [str ] |
コンパイラ引数のリストを渡すために使用します。デフォルトのインクルードパスにないヘッダーのインクルードパスを これは、インクルードディレクトリも |
|
dependencies |
dep | list [dep ] |
コンパイルおよび/またはリンクに必要な追加の依存関係。 |
|
include_directories |
inc | list [inc ] |
ヘッダー検索用の追加ディレクトリ。 |
(0.38.0以降) |
name |
str |
コンパイラチェックに関するメッセージを印刷するために使用する名前。このキーワード引数が渡されない場合、チェックに関するメッセージは印刷されません。 |
|
no_builtin_args |
bool |
|
|
required |
bool | feature |
|
(1.5.0以降)
|
werror |
bool |
|
(1.3.0以降)
|
compiler.sizeof()
指定された型(例:'int'
)のサイズを返します。型が不明な場合は-1を返します。Cライクな言語の場合、ネイティブコンパイルではヘッダーstddef.h
とstdio.h
が暗黙的にインクルードされ、クロスコンパイルの場合のみstddef.h
がインクルードされます。
シグネチャ
# returns the size of the given type (e
int sizeof(
str typename, # The type to compute
# Keyword arguments:
args : list[str] # Used to pass a list of compiler arguments
dependencies : dep | list[dep] # Additionally dependencies required for compiling and / or linking
include_directories : inc | list[inc] # Extra directories for header searches
no_builtin_args : bool # When set to `true`, the compiler arguments controlled by built-in configuration options are not added
prefix : str | list[str] # Used to add `#include`s and other things that are required
)
引数
compiler.sizeof()
メソッドは、以下の位置引数を受け入れます。
名前 | 型 | 説明 | タグ |
---|---|---|---|
typename |
str |
計算する型。 |
|
最後に、compiler.sizeof()
は以下のキーワード引数を受け入れます。
名前 | 型 | 説明 | タグ |
---|---|---|---|
args |
list [str ] |
コンパイラ引数のリストを渡すために使用します。デフォルトのインクルードパスにないヘッダーのインクルードパスを これは、インクルードディレクトリも |
|
dependencies |
dep | list [dep ] |
コンパイルおよび/またはリンクに必要な追加の依存関係。 |
|
include_directories |
inc | list [inc ] |
ヘッダー検索用の追加ディレクトリ。 |
(0.38.0以降) |
no_builtin_args |
bool |
|
|
prefix |
str | list [str ] |
|
|
compiler.symbols_have_underscore_prefix()
Cシンボルのマングリングがシンボルに1つのアンダースコア(_
)をプレフィックスとして付加する場合、true
を返します。
シグネチャ
(since 0.37.0)
bool symbols_have_underscore_prefix()
compiler.version()
コンパイラのバージョン番号を文字列として返します。
シグネチャ
str version()
検索結果は次のとおりです