diff options
-rw-r--r-- | interpreter.py | 12 | ||||
-rw-r--r-- | modules/qt5.py | 15 | ||||
-rw-r--r-- | test cases/frameworks/4 qt5/meson.build | 21 |
3 files changed, 24 insertions, 24 deletions
diff --git a/interpreter.py b/interpreter.py index 7b717cd..37b37bb 100644 --- a/interpreter.py +++ b/interpreter.py @@ -246,9 +246,12 @@ class GeneratorHolder(InterpreterObject): return gl class GeneratedListHolder(InterpreterObject): - def __init__(self, generator): + def __init__(self, arg1): super().__init__() - self.held_object = build.GeneratedList(generator) + if isinstance(arg1, build.Generator): + self.held_object = build.GeneratedList(arg1) + else: + self.held_object = arg1 def add_file(self, a): self.held_object.add_file(a) @@ -790,7 +793,12 @@ class Interpreter(): raise InterpreterException('Tried to create target %s which already exists.' % v.name) self.build.targets[v.name] = v outvalues.append(ExecutableHolder(v)) + elif isinstance(v, list): + outvalues.append(self.module_method_callback(v)) + elif isinstance(v, build.GeneratedList): + outvalues.append(GeneratedListHolder(v)) else: + print(v) raise InterpreterException('Module returned a value of unknown type.') if len(outvalues) == 1 and unwrap_single: return outvalues[0] diff --git a/modules/qt5.py b/modules/qt5.py index 4a6bb04..2b9e7d8 100644 --- a/modules/qt5.py +++ b/modules/qt5.py @@ -87,7 +87,7 @@ class Qt5Module(): else: mlog.log(' rcc:', mlog.red('NO')) - def executable(self, state, args, kwargs): + def preprocess(self, state, args, kwargs): rcc_files = kwargs.pop('qresources', []) if not isinstance(rcc_files, list): rcc_files = [rcc_files] @@ -100,12 +100,10 @@ class Qt5Module(): moc_sources = kwargs.pop('moc_sources', []) if not isinstance(moc_sources, list): moc_sources = [moc_sources] - name = args[0] srctmp = kwargs.pop('sources', []) if not isinstance(srctmp, list): srctmp = [srctmp] sources = args[1:] + srctmp - objects = [] if len(rcc_files) > 0: rcc_kwargs = {'output' : '@BASENAME@.cpp', 'arguments' : ['@INPUT@', '-o', '@OUTPUT@']} @@ -134,16 +132,7 @@ class Qt5Module(): moc_output = build.GeneratedList(moc_gen) [moc_output.add_file(os.path.join(state.subdir, a)) for a in moc_sources] sources.append(moc_output) - if state.environment.is_cross_build(): - if kwargs.get('native', False): - is_cross = False - else: - is_cross = True - else: - is_cross = False - - return build.Executable(name, state.subdir, is_cross, sources, objects, - state.environment, kwargs) + return sources def initialize(): return Qt5Module() diff --git a/test cases/frameworks/4 qt5/meson.build b/test cases/frameworks/4 qt5/meson.build index f515c0e..dd57ef5 100644 --- a/test cases/frameworks/4 qt5/meson.build +++ b/test cases/frameworks/4 qt5/meson.build @@ -7,11 +7,12 @@ if meson.get_compiler('cpp').get_id() != 'msvc' add_global_arguments('-std=c++11', language : 'cpp') endif -q5exe = qt5.executable('qt5app', -sources : ['main.cpp', 'mainWindow.cpp'], # Sources that don't need preprocessing. -moc_headers : ['mainWindow.h'], # These need to be fed through the moc tool before use. -ui_files : 'mainWindow.ui', # XML files that need to be compiled with the uic tol. -qresources : 'stuff.qrc', # Resource file for rcc compiler. +q5exe = executable('qt5app', +sources : ['main.cpp', 'mainWindow.cpp', # Sources that don't need preprocessing. +qt5.preprocess(moc_headers : ['mainWindow.h'], # These need to be fed through the moc tool before use. + ui_files : 'mainWindow.ui', # XML files that need to be compiled with the uic tol. + qresources : 'stuff.qrc', # Resource file for rcc compiler. +)], dependencies : qt5dep) # We need a console test application because some test environments @@ -19,7 +20,7 @@ dependencies : qt5dep) qt5core = dependency('qt5', modules : 'Core') -qt5coreapp = qt5.executable('q5core', 'q5core.cpp', +qt5coreapp = executable('q5core', 'q5core.cpp', dependencies : qt5core) test('qt5test', qt5coreapp) @@ -27,10 +28,12 @@ test('qt5test', qt5coreapp) # The build system needs to include the cpp files from # headers but the user must manually include moc # files from sources. -q5maninclude = qt5.executable('q5maninclude', -sources : 'manualinclude.cpp', +manpreprocessed = qt5.preprocess( moc_sources : 'manualinclude.cpp', -moc_headers : 'manualinclude.h', +moc_headers : 'manualinclude.h') + +q5maninclude = executable('q5maninclude', +sources : ['manualinclude.cpp', manpreprocessed], dependencies : qt5core) test('q5maninclude', q5maninclude) |