Skip to content

Commit

Permalink
modules/qt: use append rather than extend in preprocess
Browse files Browse the repository at this point in the history
Because that's what we need, of course
  • Loading branch information
dcbaker committed Jun 18, 2021
1 parent f7eda0e commit 79fec1c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
6 changes: 3 additions & 3 deletions mesonbuild/modules/qt.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,11 +428,11 @@ def preprocess(self, state: 'ModuleState', args: T.List[T.Union[str, File]], kwa
if not isinstance(args[0], str):
raise build.InvalidArguments('First argument to qt.preprocess must be a string')
rcc_kwargs['name'] = args[0]
sources.extend(self.compile_resources(state, tuple(), rcc_kwargs).return_value)
sources.append(self.compile_resources(state, tuple(), rcc_kwargs).return_value)

if kwargs['ui_files']:
ui_kwargs: 'UICompilerKwArgs' = {'sources': kwargs['ui_files'], 'extra_args': kwargs['uic_extra_arguments'], 'method': method}
sources.extend(self.compile_ui(state, tuple(), ui_kwargs).return_value)
sources.append(self.compile_ui(state, tuple(), ui_kwargs).return_value)

if kwargs['moc_headers'] or kwargs['moc_sources']:
moc_kwargs: 'MocCompilerKwArgs' = {
Expand All @@ -443,7 +443,7 @@ def preprocess(self, state: 'ModuleState', args: T.List[T.Union[str, File]], kwa
'dependencies': kwargs['dependencies'],
'method': method,
}
sources.extend(self.compile_moc(state, tuple(), moc_kwargs).return_value)
sources.append(self.compile_moc(state, tuple(), moc_kwargs).return_value)

return ModuleReturnValue(sources, [sources])

Expand Down
10 changes: 10 additions & 0 deletions test cases/frameworks/4 qt/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ foreach qt : ['qt4', 'qt5', 'qt6']
# XML files that need to be compiled with the uic tol.
prep += qtmodule.compile_ui(sources : 'mainWindow.ui', method: get_option('method'))

qtmodule.preprocess(
ui_files : 'mainWindow.ui',
method: get_option('method'))

# Resource file(s) for rcc compiler
extra_cpp_args = []
if meson.is_unity()
Expand Down Expand Up @@ -100,6 +104,12 @@ foreach qt : ['qt4', 'qt5', 'qt6']
# The build system needs to include the cpp files from
# headers but the user must manually include moc
# files from sources.
qtmodule.preprocess(
moc_extra_arguments : ['-DMOC_EXTRA_FLAG'], # This is just a random macro to test `extra_arguments`
moc_sources : 'manualinclude.cpp',
moc_headers : 'manualinclude.h',
method : get_option('method'))

manpreprocessed = qtmodule.compile_moc(
extra_args : ['-DMOC_EXTRA_FLAG'], # This is just a random macro to test `extra_arguments`
sources : 'manualinclude.cpp',
Expand Down

0 comments on commit 79fec1c

Please sign in to comment.