From 050a56ad47fef8f8fbc66a6b3465bd49697bef94 Mon Sep 17 00:00:00 2001 From: Leif Middelschulte Date: Tue, 24 Oct 2017 10:05:26 +0200 Subject: Qt5-Module: Add `moc_extra_arguments` keyword support. This commit adds support for an additional `moc_extra_arguments` keyword. It becomes especially handy, when `moc`-ed sources conditionally provide `slots`, depending on compile time macros (i.e. defines). --- docs/markdown/Qt5-module.md | 10 +++++----- docs/markdown/snippets/qt5-moc_extra_arguments.md | 8 ++++++++ 2 files changed, 13 insertions(+), 5 deletions(-) create mode 100644 docs/markdown/snippets/qt5-moc_extra_arguments.md (limited to 'docs/markdown') diff --git a/docs/markdown/Qt5-module.md b/docs/markdown/Qt5-module.md index a8ad73d..613e5c1 100644 --- a/docs/markdown/Qt5-module.md +++ b/docs/markdown/Qt5-module.md @@ -5,11 +5,11 @@ tools and steps required for Qt. The module has one method. ## preprocess -This method takes five keyword arguments, `moc_headers`, -`moc_sources`, `ui_files` and `qresources` which define the files that -require preprocessing with `moc`, `uic` and `rcc` and 'include_directories' which might be needed by moc. It returns an -opaque object that should be passed to a main build target. A simple -example would look like this: +This method takes six keyword arguments, `moc_headers`, `moc_sources`, `ui_files`, `qresources` +and `moc_extra_arguments` which define the files that require preprocessing with `moc`, `uic` +and `rcc` and 'include_directories' which might be needed by moc as well as (optional) +additional arguments. It returns an opaque object that should be passed to a main build target. +A simple example would look like this: ```meson qt5 = import('qt5') diff --git a/docs/markdown/snippets/qt5-moc_extra_arguments.md b/docs/markdown/snippets/qt5-moc_extra_arguments.md new file mode 100644 index 0000000..957c3c7 --- /dev/null +++ b/docs/markdown/snippets/qt5-moc_extra_arguments.md @@ -0,0 +1,8 @@ +# Adds support for additional Qt5-Module keyword `moc_extra_arguments` + +When `moc`-ing sources, the `moc` tool does not know about any +preprocessor macros. The generated code might not match the input +files when the linking with the moc input sources happens. + +This amendment allows to specify a a list of additional arguments +passed to the `moc` tool. They are called `moc_extra_arguments`. \ No newline at end of file -- cgit v1.1 From a46d05acf9dda6f2e5f06254a6da6652646a820e Mon Sep 17 00:00:00 2001 From: Leif Middelschulte Date: Fri, 27 Oct 2017 08:38:15 +0200 Subject: updates the documentation to follow the list-style to explain arguments. As per to @jon-turney's and @jpakanne's suggestion [0], this commit changes the "prosa" documentation to a list-style one. [0] https://github.com/mesonbuild/meson/pull/2529#pullrequestreview-72265697 --- docs/markdown/Qt5-module.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'docs/markdown') diff --git a/docs/markdown/Qt5-module.md b/docs/markdown/Qt5-module.md index 613e5c1..e84b5fd 100644 --- a/docs/markdown/Qt5-module.md +++ b/docs/markdown/Qt5-module.md @@ -5,10 +5,13 @@ tools and steps required for Qt. The module has one method. ## preprocess -This method takes six keyword arguments, `moc_headers`, `moc_sources`, `ui_files`, `qresources` -and `moc_extra_arguments` which define the files that require preprocessing with `moc`, `uic` -and `rcc` and 'include_directories' which might be needed by moc as well as (optional) -additional arguments. It returns an opaque object that should be passed to a main build target. +This method takes the following keyword arguments: + - `moc_headers`, `moc_sources`, `ui_files`, `qresources`, which define the files that require preprocessing with `moc`, `uic` and `rcc` + - `include_directories`, the directories to add to header search path for `moc` (optional) + - `moc_extra_arguments`, any additional arguments to `moc` (optional). + +It returns an opaque object that should be passed to a main build target. + A simple example would look like this: ```meson -- cgit v1.1 From f720e590b1a6798fced6b2345cbb066788e79d90 Mon Sep 17 00:00:00 2001 From: Leif Middelschulte Date: Fri, 27 Oct 2017 08:43:26 +0200 Subject: adds "since"-note for the new keyword to the documentation --- docs/markdown/Qt5-module.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/markdown') diff --git a/docs/markdown/Qt5-module.md b/docs/markdown/Qt5-module.md index e84b5fd..e5fc066 100644 --- a/docs/markdown/Qt5-module.md +++ b/docs/markdown/Qt5-module.md @@ -8,7 +8,7 @@ tools and steps required for Qt. The module has one method. This method takes the following keyword arguments: - `moc_headers`, `moc_sources`, `ui_files`, `qresources`, which define the files that require preprocessing with `moc`, `uic` and `rcc` - `include_directories`, the directories to add to header search path for `moc` (optional) - - `moc_extra_arguments`, any additional arguments to `moc` (optional). + - `moc_extra_arguments`, any additional arguments to `moc` (optional). Available since v0.44.0. It returns an opaque object that should be passed to a main build target. -- cgit v1.1 From a2478d4dab3df995a2d4e352e8467c39b3343f9c Mon Sep 17 00:00:00 2001 From: Leif Middelschulte Date: Fri, 27 Oct 2017 08:46:25 +0200 Subject: documentation: adds new keyword usage to the given example. --- docs/markdown/Qt5-module.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'docs/markdown') diff --git a/docs/markdown/Qt5-module.md b/docs/markdown/Qt5-module.md index e5fc066..aea2ae1 100644 --- a/docs/markdown/Qt5-module.md +++ b/docs/markdown/Qt5-module.md @@ -18,7 +18,9 @@ A simple example would look like this: qt5 = import('qt5') qt5_dep = dependency('qt5', modules: ['Core', 'Gui']) inc = include_directories('includes') -moc_files = qt5.preprocess(moc_headers : 'myclass.h', include_directories: inc) +moc_files = qt5.preprocess(moc_headers : 'myclass.h', + moc_extra_arguments: ['-DMAKES_MY_MOC_HEADER_COMPILE'], + include_directories: inc) executable('myprog', 'main.cpp', 'myclass.cpp', moc_files, include_directories: inc, dependencies : qt5_dep) -- cgit v1.1