OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2015 The Chromium Authors. All rights reserved. | 2 # Copyright 2015 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 # This script returns the flags that should be passed to clang. | 6 # This script returns the flags that should be passed to clang. |
7 | 7 |
| 8 # TODO(sof): the script can be removed when/once gyp support is retired; |
| 9 # unused with gn. |
| 10 |
8 import os | 11 import os |
9 import sys | 12 import sys |
10 | 13 |
11 THIS_DIR = os.path.abspath(os.path.dirname(__file__)) | 14 THIS_DIR = os.path.abspath(os.path.dirname(__file__)) |
12 SRC_DIR = os.path.join(THIS_DIR, '..', '..', '..') | 15 SRC_DIR = os.path.join(THIS_DIR, '..', '..', '..') |
13 CLANG_LIB_PATH = os.path.normpath(os.path.join( | 16 CLANG_LIB_PATH = os.path.normpath(os.path.join( |
14 SRC_DIR, 'third_party', 'llvm-build', 'Release+Asserts', 'lib')) | 17 SRC_DIR, 'third_party', 'llvm-build', 'Release+Asserts', 'lib')) |
15 | 18 |
16 FLAGS = '-Xclang -add-plugin -Xclang blink-gc-plugin' | 19 FLAGS = '-Xclang -add-plugin -Xclang blink-gc-plugin' |
17 PREFIX= ' -Xclang -plugin-arg-blink-gc-plugin -Xclang ' | 20 PREFIX= ' -Xclang -plugin-arg-blink-gc-plugin -Xclang ' |
18 | 21 |
19 for arg in sys.argv[1:]: | 22 for arg in sys.argv[1:]: |
20 if arg == 'dump-graph=1': | 23 if arg == 'dump-graph=1': |
21 FLAGS += PREFIX + 'dump-graph' | 24 FLAGS += PREFIX + 'dump-graph' |
22 elif arg == 'warn-unneeded-finalizer=1': | 25 elif arg == 'warn-unneeded-finalizer=1': |
23 FLAGS += PREFIX + 'warn-unneeded-finalizer' | 26 FLAGS += PREFIX + 'warn-unneeded-finalizer' |
24 elif arg.startswith('custom_clang_lib_path='): | 27 elif arg.startswith('custom_clang_lib_path='): |
25 CLANG_LIB_PATH = arg[len('custom_clang_lib_path='):] | 28 CLANG_LIB_PATH = arg[len('custom_clang_lib_path='):] |
26 elif arg == 'target_os=ios': | 29 elif arg == 'target_os=ios': |
27 sys.stderr.write('error: blink is unsupported on iOS\n') | 30 sys.stderr.write('error: blink is unsupported on iOS\n') |
28 sys.exit(1) | 31 sys.exit(1) |
29 | 32 |
30 if not sys.platform in ['win32', 'cygwin']: | 33 if not sys.platform in ['win32', 'cygwin']: |
31 LIBSUFFIX = 'dylib' if sys.platform == 'darwin' else 'so' | 34 LIBSUFFIX = 'dylib' if sys.platform == 'darwin' else 'so' |
32 FLAGS = ('-Xclang -load -Xclang "%s/libBlinkGCPlugin.%s" ' + FLAGS) % \ | 35 FLAGS = ('-Xclang -load -Xclang "%s/libBlinkGCPlugin.%s" ' + FLAGS) % \ |
33 (CLANG_LIB_PATH, LIBSUFFIX) | 36 (CLANG_LIB_PATH, LIBSUFFIX) |
34 | 37 |
35 print FLAGS | 38 print FLAGS |
OLD | NEW |