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 Create .cpp, .h, moc_....cpp from a .ui file.
34 test
= TestSCons
.TestSCons()
36 test
.Qt_dummy_installation()
38 ##############################################################################
40 aaa_dll
= TestSCons
.dll_
+ 'aaa' + TestSCons
._dll
43 obj
= TestSCons
.shobj_
+ os
.path
.splitext(cpp
)[0] + TestSCons
._shobj
46 test
.Qt_create_SConstruct('SConstruct')
48 test
.write('SConscript', """\
50 if dup == 0: env.Append(CPPPATH=['#', '.'])
51 env.SharedLibrary(target = 'aaa', source = ['aaa.ui', 'useit.cpp'])
54 test
.write('aaa.ui', r
"""
55 #if defined (_WIN32) || defined(__CYGWIN__)
56 #define DLLEXPORT __declspec(dllexport)
60 DLLEXPORT void aaa(void)
63 test
.write('useit.cpp', r
"""
70 test
.run(arguments
=aaa_dll
)
72 test
.up_to_date(options
='-n', arguments
=aaa_dll
)
74 test
.write('aaa.ui', r
"""
76 #if defined (_WIN32) || defined(__CYGWIN__)
77 #define DLLEXPORT __declspec(dllexport)
81 DLLEXPORT void aaa(void)
84 test
.not_up_to_date(options
='-n', arguments
=moc
)
85 test
.not_up_to_date(options
='-n', arguments
=cpp
)
86 test
.not_up_to_date(options
='-n', arguments
=h
)
88 test
.run(arguments
=" " + aaa_dll
)
90 test
.write('aaa.ui', r
"""
92 //<include>aaa.ui.h</include>
95 # test that non-existant ui.h files are ignored (as uic does)
96 test
.run(arguments
=" " + aaa_dll
)
98 test
.write('aaa.ui.h', r
"""
99 /* test dependency to .ui.h */
102 test
.run(arguments
=" " + aaa_dll
)
104 test
.write('aaa.ui.h', r
"""
108 test
.not_up_to_date(options
='-n', arguments
=obj
)
109 test
.not_up_to_date(options
='-n', arguments
=cpp
)
110 test
.not_up_to_date(options
='-n', arguments
=h
)
111 test
.not_up_to_date(options
='-n', arguments
=moc
)
114 test
.run(arguments
=" -c " + aaa_dll
)
117 arguments
="variant_dir=1 "
118 + test
.workpath('build', aaa_dll
)
121 test
.must_exist(test
.workpath('build', moc
))
122 test
.must_exist(test
.workpath('build', cpp
))
123 test
.must_exist(test
.workpath('build', h
))
124 test
.must_not_exist(test
.workpath(moc
))
125 test
.must_not_exist(test
.workpath(cpp
))
126 test
.must_not_exist(test
.workpath(h
))
128 cppContents
= test
.read(test
.workpath('build', cpp
), mode
='r')
129 test
.fail_test(cppContents
.find('#include "aaa.ui.h"') == -1)
132 arguments
="variant_dir=1 chdir=1 "
133 + test
.workpath('build', aaa_dll
)
136 test
.must_exist(test
.workpath('build', moc
))
137 test
.must_exist(test
.workpath('build', cpp
))
138 test
.must_exist(test
.workpath('build', h
))
139 test
.must_not_exist(test
.workpath(moc
))
140 test
.must_not_exist(test
.workpath(cpp
))
141 test
.must_not_exist(test
.workpath(h
))
144 arguments
=" variant_dir=1 chdir=1 dup=0 "
145 + test
.workpath('build_dup0', aaa_dll
)
148 test
.must_exist(test
.workpath('build_dup0', moc
))
149 test
.must_exist(test
.workpath('build_dup0', cpp
))
150 test
.must_exist(test
.workpath('build_dup0', h
))
151 test
.must_not_exist(test
.workpath(moc
))
152 test
.must_not_exist(test
.workpath(cpp
))
153 test
.must_not_exist(test
.workpath(h
))
159 # indent-tabs-mode:nil
161 # vim: set expandtab tabstop=4 shiftwidth=4: