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 This tests the MinGW with MSVC tool.
34 test
= TestSCons
.TestSCons()
36 # MinGW is Windows only:
37 if sys
.platform
!= 'win32':
38 msg
= "Skipping mingw test on non-Windows platform '%s'\n" % sys
.platform
41 test
.skip_if_not_msvc()
43 # control test: check for nologo and cl in env
44 test
.write('SConstruct',"""
45 DefaultEnvironment(tools=[])
46 env = Environment(tools=['default'])
47 print('CCFLAGS=' + str(env['CCFLAGS']).strip())
48 print('CC=' + str(env['CC']).strip())
50 test
.run(arguments
='-Q -s')
51 if 'CCFLAGS=/nologo' not in test
.stdout() or 'CC=cl' not in test
.stdout():
54 # make sure windows msvc doesnt add bad mingw flags
55 # and that gcc is selected
56 test
.write('SConstruct',"""
57 DefaultEnvironment(tools=[])
58 env = Environment(tools=['default', 'mingw'])
59 print('CCFLAGS="' + str(env['CCFLAGS']).strip() + '"')
60 print('CC=' + str(env['CC']).strip())
62 test
.run(arguments
='-Q -s')
63 if('CCFLAGS=""' not in test
.stdout()
64 or 'CC=gcc' not in test
.stdout()):
67 # msvc should overwrite the flags and use cl
68 test
.write('SConstruct',"""
69 DefaultEnvironment(tools=[])
70 env = Environment(tools=['mingw', 'default'])
71 print('CCFLAGS=' + str(env['CCFLAGS']).strip())
72 print('CC=' + str(env['CC']).strip())
74 test
.run(arguments
='-Q -s')
75 if 'CCFLAGS=/nologo' not in test
.stdout() or 'CC=cl' not in test
.stdout():
78 # test that CCFLAGS are preserved
79 test
.write('SConstruct',"""
80 DefaultEnvironment(tools=[])
81 env = Environment(tools=['mingw'], CCFLAGS='-myflag')
84 test
.run(arguments
='-Q -s')
85 if '-myflag' not in test
.stdout():
88 # test that it handles a list
89 test
.write('SConstruct',"""
90 DefaultEnvironment(tools=[])
91 env = Environment(tools=['mingw'], CCFLAGS=['-myflag', '-myflag2'])
92 print(str(env['CCFLAGS']))
94 test
.run(arguments
='-Q -s')
95 if "['-myflag', '-myflag2']" not in test
.stdout():
102 # indent-tabs-mode:nil
104 # vim: set expandtab tabstop=4 shiftwidth=4: