5 # Copyright The SCons Foundation
7 # Permission is hereby granted, free of charge, to any person obtaining
8 # a copy of this software and associated documentation files (the
9 # "Software"), to deal in the Software without restriction, including
10 # without limitation the rights to use, copy, modify, merge, publish,
11 # distribute, sublicense, and/or sell copies of the Software, and to
12 # permit persons to whom the Software is furnished to do so, subject to
13 # the following conditions:
15 # The above copyright notice and this permission notice shall be included
16 # in all copies or substantial portions of the Software.
18 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
19 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
20 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
22 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 Test the manual QT builder calls.
32 test
= TestSCons
.TestSCons()
34 test
.subdir('include', 'ui')
36 test
.Qt_dummy_installation()
38 aaa_exe
= 'aaa' + TestSCons
._exe
40 test
.Qt_create_SConstruct('SConstruct')
42 test
.write('SConscript', r
"""
44 sources = ['aaa.cpp', 'bbb.cpp', 'ddd.cpp', 'eee.cpp', 'main.cpp']
47 sources.append(env.Moc('include/aaa.h'))
48 moc = env.Moc('bbb.cpp')
49 env.Ignore( moc, moc )
50 sources.extend(env.Uic('ui/ccc.ui')[1:])
52 # manual target specification
53 sources.append(env.Moc('moc-ddd.cpp', 'include/ddd.h',
54 QT_MOCHPREFIX='')) # Watch out !
55 moc = env.Moc('moc_eee.cpp', 'eee.cpp')
56 env.Ignore( moc, moc )
57 sources.extend(env.Uic(['include/uic_fff.hpp', 'fff.cpp', 'fff.moc.cpp'],
60 print(list(map(str,sources)))
61 env.Program(target='aaa',
63 CPPPATH=['$CPPPATH', './include'],
67 test
.write('aaa.cpp', r
"""
71 test
.write(['include', 'aaa.h'], r
"""
72 #include "my_qobject.h"
73 void aaa(void) Q_OBJECT;
76 test
.write('bbb.h', r
"""
80 test
.write('bbb.cpp', r
"""
81 #include "my_qobject.h"
82 void bbb(void) Q_OBJECT
86 test
.write(['ui', 'ccc.ui'], r
"""
90 test
.write('ddd.cpp', r
"""
94 test
.write(['include', 'ddd.h'], r
"""
95 #include "my_qobject.h"
96 void ddd(void) Q_OBJECT;
99 test
.write('eee.h', r
"""
103 test
.write('eee.cpp', r
"""
104 #include "my_qobject.h"
105 void eee(void) Q_OBJECT
106 #include "moc_eee.cpp"
109 test
.write(['ui', 'fff.ui'], r
"""
113 test
.write('main.cpp', r
"""
119 #include "uic_fff.hpp"
122 aaa(); bbb(); ccc(); ddd(); eee(); fff(); return 0;
126 test
.run(arguments
="--warn=no-tool-qt-deprecated " + aaa_exe
)
129 test
.must_exist(test
.workpath('include', 'moc_aaa.cc'))
130 test
.must_exist(test
.workpath('bbb.moc'))
131 test
.must_exist(test
.workpath('ui', 'ccc.h'))
132 test
.must_exist(test
.workpath('ui', 'uic_ccc.cc'))
133 test
.must_exist(test
.workpath('ui', 'moc_ccc.cc'))
135 # manual target spec.
136 test
.must_exist(test
.workpath('moc-ddd.cpp'))
137 test
.must_exist(test
.workpath('moc_eee.cpp'))
138 test
.must_exist(test
.workpath('include', 'uic_fff.hpp'))
139 test
.must_exist(test
.workpath('fff.cpp'))
140 test
.must_exist(test
.workpath('fff.moc.cpp'))
146 # indent-tabs-mode:nil
148 # vim: set expandtab tabstop=4 shiftwidth=4: