OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 | 2 |
3 # Copyright 2011 The Android Open Source Project | 3 # Copyright 2011 The Android Open Source Project |
4 # | 4 # |
5 # Use of this source code is governed by a BSD-style license that can be | 5 # Use of this source code is governed by a BSD-style license that can be |
6 # found in the LICENSE file. | 6 # found in the LICENSE file. |
7 | 7 |
8 # This script is a wrapper which invokes gyp with the correct --depth argument, | 8 # This script is a wrapper which invokes gyp with the correct --depth argument, |
9 # and supports the automatic regeneration of build files if all.gyp is | 9 # and supports the automatic regeneration of build files if all.gyp is |
10 # changed (Linux-only). | 10 # changed (Linux-only). |
(...skipping 11 matching lines...) Expand all Loading... |
22 | 22 |
23 # Directory within which we can find most of Skia's gyp configuration files. | 23 # Directory within which we can find most of Skia's gyp configuration files. |
24 gyp_config_dir = os.path.join(script_dir, 'gyp') | 24 gyp_config_dir = os.path.join(script_dir, 'gyp') |
25 | 25 |
26 # Ensure we import our current gyp source's module, not any version | 26 # Ensure we import our current gyp source's module, not any version |
27 # pre-installed in your PYTHONPATH. | 27 # pre-installed in your PYTHONPATH. |
28 sys.path.insert(0, os.path.join(gyp_source_dir, 'pylib')) | 28 sys.path.insert(0, os.path.join(gyp_source_dir, 'pylib')) |
29 import gyp | 29 import gyp |
30 | 30 |
31 ENVVAR_GYP_GENERATORS = 'GYP_GENERATORS' | 31 ENVVAR_GYP_GENERATORS = 'GYP_GENERATORS' |
| 32 ENVVAR_GYP_GENERATOR_FLAGS = 'GYP_GENERATOR_FLAGS' |
32 | 33 |
33 | 34 |
34 def additional_include_files(args=[]): | 35 def additional_include_files(args=[]): |
35 # Determine the include files specified on the command line. | 36 # Determine the include files specified on the command line. |
36 # This doesn't cover all the different option formats you can use, | 37 # This doesn't cover all the different option formats you can use, |
37 # but it's mainly intended to avoid duplicating flags on the automatic | 38 # but it's mainly intended to avoid duplicating flags on the automatic |
38 # makefile regeneration which only uses this format. | 39 # makefile regeneration which only uses this format. |
39 specified_includes = set() | 40 specified_includes = set() |
40 for arg in args: | 41 for arg in args: |
41 if arg.startswith('-I') and len(arg) > 2: | 42 if arg.startswith('-I') and len(arg) > 2: |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 | 120 |
120 # Tell gyp to write the build files into output_dir. | 121 # Tell gyp to write the build files into output_dir. |
121 args.extend(['--generator-output', os.path.abspath(get_output_dir())]) | 122 args.extend(['--generator-output', os.path.abspath(get_output_dir())]) |
122 | 123 |
123 # Tell ninja to write its output into the same directory. | 124 # Tell ninja to write its output into the same directory. |
124 args.extend(['-Goutput_dir=.']) | 125 args.extend(['-Goutput_dir=.']) |
125 | 126 |
126 # By default, we build 'most' instead of 'all' or 'everything'. See skia.gyp. | 127 # By default, we build 'most' instead of 'all' or 'everything'. See skia.gyp. |
127 args.extend(['-Gdefault_target=most']) | 128 args.extend(['-Gdefault_target=most']) |
128 | 129 |
| 130 # Fail if any files specified in the project are missing |
| 131 if sys.platform.startswith('win'): |
| 132 gyp_generator_flags = os.getenv(ENVVAR_GYP_GENERATOR_FLAGS, '') |
| 133 if not 'msvs_error_on_missing_sources' in gyp_generator_flags: |
| 134 os.environ[ENVVAR_GYP_GENERATOR_FLAGS] = ( |
| 135 gyp_generator_flags + ' msvs_error_on_missing_sources=1') |
| 136 |
129 print 'Updating projects from gyp files...' | 137 print 'Updating projects from gyp files...' |
130 sys.stdout.flush() | 138 sys.stdout.flush() |
131 | 139 |
132 if '--dry-run' in args: | 140 if '--dry-run' in args: |
133 args.remove('--dry-run') | 141 args.remove('--dry-run') |
134 print gyp_source_dir, ' '.join(args) | 142 print gyp_source_dir, ' '.join(args) |
135 else: | 143 else: |
136 # Off we go... | 144 # Off we go... |
137 sys.exit(gyp.main(args)) | 145 sys.exit(gyp.main(args)) |
OLD | NEW |