Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(243)

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: Bundle metal for ios only Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 # Copyright 2017 The WebRTC project authors. All Rights Reserved.
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 """Compiles metal shader file into rtc_shaders.metallib.
10
11 The produced metal library will be created in the output folder
12 like so:
13 oututDir/rtc_shaders.metallib
14 The script is intended to be used as gn action.
15 """
16
17
18 import argparse
19 import subprocess
20 import sys
21
22
23 def main():
24 parser = argparse.ArgumentParser(
25 description='A script to compile metal shaders.')
26 parser.add_argument('-i', '--input', required=True,
27 help='Path to input metal shaders.')
28 parser.add_argument('-o', '--output', required=True,
29 help='Path to output bundle.')
30 args, _ = parser.parse_known_args()
31
32 # TODO(denicija): replace the hardcoded iphoneos with
33 # the proper sdk var when we add metal for mac.
34 metal_air_args = [
35 'xcrun',
36 '-sdk',
37 'iphoneos',
38 'metal',
39 args.input,
40 '-o',
41 args.output+'/rtc_shaders.air'
42 ]
43 toolout = subprocess.Popen(metal_air_args)
44 if toolout.wait() == 0:
45 metal_lib_args = [
46 'xcrun',
47 '-sdk',
48 'iphoneos',
49 'metallib',
50 args.output+'/rtc_shaders.air',
51 '-o',
52 args.output+'/rtc_shaders.metallib'
53 ]
54 toolout = subprocess.Popen(metal_lib_args)
55 toolout.wait()
56
57 sys.exit(toolout.returncode)
kthelgason 2017/02/02 15:22:36 return this instead of sys.exit.
kjellander_webrtc 2017/02/03 09:03:17 +1
daniela-webrtc 2017/02/07 10:43:59 Done.
58
59
60 if __name__ == '__main__':
61 sys.exit(main())
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698