Chromium Code Reviews| Index: webrtc/sdk/objc/compile_metal_lib.py |
| diff --git a/webrtc/sdk/objc/compile_metal_lib.py b/webrtc/sdk/objc/compile_metal_lib.py |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..c04b8a0f5e57135612c22e921262edf3008ee50a |
| --- /dev/null |
| +++ b/webrtc/sdk/objc/compile_metal_lib.py |
| @@ -0,0 +1,45 @@ |
| +# Copyright 2016 The WebRTC project authors. All Rights Reserved. |
|
kjellander_webrtc
2017/02/02 12:20:43
2017
daniela-webrtc
2017/02/02 15:11:44
Done.
|
| +# |
| +# Use of this source code is governed by a BSD-style license |
| +# that can be found in the LICENSE file in the root of the source |
| +# tree. An additional intellectual property rights grant can be found |
| +# in the file PATENTS. All contributing project authors may |
| +# be found in the AUTHORS file in the root of the source tree. |
| + |
| +import argparse |
|
kjellander_webrtc
2017/02/02 12:20:43
Please add a short module docstring explaining wha
daniela-webrtc
2017/02/02 15:11:44
Done.
|
| +import subprocess |
| +import sys |
| + |
|
kjellander_webrtc
2017/02/02 12:20:43
+1 blank line for top-level statements (it's a sil
daniela-webrtc
2017/02/02 15:11:44
Done.
|
| +if __name__ == '__main__': |
|
kjellander_webrtc
2017/02/02 12:20:43
Please use a main() function: https://google.githu
daniela-webrtc
2017/02/02 15:11:44
Done.
|
| + parser = argparse.ArgumentParser( |
| + description='A script to compile metal shaders.') |
| + parser.add_argument('-i', '--input', required=True, |
| + help='Path to input metal shaders.') |
| + parser.add_argument('-o', '--output', required=True, |
| + help='Path to output bundle.') |
| + args, unknown_args = parser.parse_known_args() |
| + |
| + # TODO(denicija): replace the hardcoded iphoneos with the proper sdk var when we add metal for mac |
|
kjellander_webrtc
2017/02/02 12:20:43
Wrap at column 80.
daniela-webrtc
2017/02/02 15:11:44
Done.
|
| + metal_air_args = [ |
| + 'xcrun', |
| + '-sdk', |
| + 'iphoneos', |
| + 'metal', |
| + args.input, |
| + '-o', |
| + args.output+'/rtc_shaders.air' |
| + ] |
| + toolout = subprocess.Popen(metal_air_args) |
| + if toolout.wait() == 0: |
| + metal_lib_args = [ |
| + 'xcrun', |
| + '-sdk', |
| + 'iphoneos', |
| + 'metallib', |
| + args.output+'/rtc_shaders.air', |
| + '-o', |
| + args.output+'/rtc_shaders.metallib' |
| + ] |
| + toolout = subprocess.Popen(metal_lib_args) |
|
kthelgason
2017/02/02 12:30:21
We need to wait for this subproccess to finish as
daniela-webrtc
2017/02/02 15:11:44
Done.
|
| + |
| + sys.exit(toolout.returncode) |