diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2022-10-23 17:24:46 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-23 17:24:46 +0300 |
commit | 4c2b64188d574af79f4e949078a352e39710ed68 (patch) | |
tree | 0f5f30bd067e829b696f72df4be731bf1896817c /docs | |
parent | 064165485ce00aac64afd98120fd725032e559fd (diff) | |
parent | ebbaeec51b5c5c8177fe6583a2a5bd6b7f929684 (diff) | |
download | meson-4c2b64188d574af79f4e949078a352e39710ed68.zip meson-4c2b64188d574af79f4e949078a352e39710ed68.tar.gz meson-4c2b64188d574af79f4e949078a352e39710ed68.tar.bz2 |
Merge pull request #10916 from xclaesse/preprocess
Add cc.preprocess() method
Diffstat (limited to 'docs')
-rw-r--r-- | docs/markdown/snippets/preprocess.md | 14 | ||||
-rw-r--r-- | docs/yaml/objects/compiler.yaml | 22 |
2 files changed, 36 insertions, 0 deletions
diff --git a/docs/markdown/snippets/preprocess.md b/docs/markdown/snippets/preprocess.md new file mode 100644 index 0000000..7e6dd0a --- /dev/null +++ b/docs/markdown/snippets/preprocess.md @@ -0,0 +1,14 @@ +## New method to preprocess source files + +Compiler object has a new `preprocess()` method. It is supported by all C/C++ +compilers. It preprocess sources without compiling them. + +The preprocessor will receive the same arguments (include directories, defines, +etc) as with normal compilation. That includes for example args added with +`add_project_arguments()`, or on the command line with `-Dc_args=-DFOO`. + +```meson +cc = meson.get_compiler('c') +pp_files = cc.preprocess('foo.c', 'bar.c', output: '@PLAINNAME@') +exe = executable('app', pp_files) +``` diff --git a/docs/yaml/objects/compiler.yaml b/docs/yaml/objects/compiler.yaml index cf34111..e10e8fe 100644 --- a/docs/yaml/objects/compiler.yaml +++ b/docs/yaml/objects/compiler.yaml @@ -586,3 +586,25 @@ methods: gcc or msvc, but use the same argument syntax as one of those two compilers such as clang or icc, especially when they use different syntax on different operating systems. + +- name: preprocess + returns: list[custom_idx] + since: 0.64.0 + description: | + Preprocess a list of source files but do not compile them. The preprocessor + will receive the same arguments (include directories, defines, etc) as with + normal compilation. That includes for example args added with + `add_project_arguments()`, or on the command line with `-Dc_args=-DFOO`. + varargs_inherit: _build_target_base + kwargs: + output: + type: str + description: | + Template for name of preprocessed files: `@PLAINNAME@` is replaced by + the source filename and `@BASENAME@` is replaced by the source filename + without its extension. + compile_args: + type: list[str] + description: | + Extra flags to pass to the preprocessor + |