Chromium Code Reviews

Side by Side Diff: webrtc/sdk/objc/compile_metal_lib.py

Issue 2673573003: Modify build scripts for ios .framework to compile metal shaders. (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
OLDNEW
(Empty)
1 # 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.
2 #
3 # Use of this source code is governed by a BSD-style license
4 # that can be found in the LICENSE file in the root of the source
5 # tree. An additional intellectual property rights grant can be found
6 # in the file PATENTS. All contributing project authors may
7 # be found in the AUTHORS file in the root of the source tree.
8
9 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.
10 import subprocess
11 import sys
12
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.
13 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.
14 parser = argparse.ArgumentParser(
15 description='A script to compile metal shaders.')
16 parser.add_argument('-i', '--input', required=True,
17 help='Path to input metal shaders.')
18 parser.add_argument('-o', '--output', required=True,
19 help='Path to output bundle.')
20 args, unknown_args = parser.parse_known_args()
21
22 # TODO(denicija): replace the hardcoded iphoneos with the proper sdk var when w e 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.
23 metal_air_args = [
24 'xcrun',
25 '-sdk',
26 'iphoneos',
27 'metal',
28 args.input,
29 '-o',
30 args.output+'/rtc_shaders.air'
31 ]
32 toolout = subprocess.Popen(metal_air_args)
33 if toolout.wait() == 0:
34 metal_lib_args = [
35 'xcrun',
36 '-sdk',
37 'iphoneos',
38 'metallib',
39 args.output+'/rtc_shaders.air',
40 '-o',
41 args.output+'/rtc_shaders.metallib'
42 ]
43 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.
44
45 sys.exit(toolout.returncode)
OLDNEW

Powered by Google App Engine