OLD | NEW |
---|---|
(Empty) | |
1 #!/usr/bin/env python | |
2 # Copyright (c) 2012 Google Inc. All rights reserved. | |
3 # Use of this source code is governed by a BSD-style license that can be | |
4 # found in the LICENSE file. | |
5 """ | |
6 Verifies that make_global_settings can be used to override the | |
7 compiler settings. | |
8 """ | |
9 | |
10 import TestGyp | |
11 import os | |
12 import copy | |
13 from string import Template | |
14 | |
15 test = TestGyp.TestGyp(formats=['ninja', 'make']) | |
16 | |
17 gypfile = 'compiler-global-settings.gyp' | |
18 | |
19 # TODO: test that the linker really is overridden corroectly. Currnetly the | |
Nico
2012/08/13 23:14:07
typos corroectly, Currnetly
Sam Clegg
2012/08/14 21:10:32
Done.
| |
20 # ninja generator will always use CXX for the linker | |
Nico
2012/08/13 23:14:07
For the host linker? (nit: trailing '.')
Sam Clegg
2012/08/14 21:10:32
Done.
| |
21 | |
22 replacements = { 'PYTHON': '/usr/bin/python', 'PWD': os.getcwd()} | |
23 | |
24 # process the .in gyp file to produce the final gyp file | |
25 # since we need to include absolute paths in the make_global_settings | |
26 # section | |
27 replacements['TOOLSET'] = 'target' | |
28 s = Template(open(gypfile + '.in').read()) | |
29 output = open(gypfile, 'w') | |
30 output.write(s.substitute(replacements)) | |
31 output.close() | |
32 | |
33 test.run_gyp(gypfile) | |
34 test.build(gypfile) | |
35 test.must_contain_all_lines(test.stdout(), ['my_cc.py', 'my_cxx.py', 'FOO']) | |
36 | |
37 # Same again but with the host toolset | |
Nico
2012/08/13 23:14:07
.
Sam Clegg
2012/08/14 21:10:32
Done.
| |
38 replacements['TOOLSET'] = 'host' | |
39 s = Template(open(gypfile + '.in').read()) | |
40 output = open(gypfile, 'w') | |
41 output.write(s.substitute(replacements)) | |
42 output.close() | |
43 | |
44 test.run_gyp(gypfile) | |
45 test.build(gypfile) | |
46 test.must_contain_all_lines(test.stdout(), ['my_cc.py', 'my_cxx.py', 'BAR']) | |
47 | |
48 test.pass_test() | |
OLD | NEW |