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

Unified Diff: webrtc/sdk/objc/compile_metal_lib.py

Issue 2673573003: Modify build scripts for ios .framework to compile metal shaders. (Closed)
Patch Set: Address comments from patchset 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/sdk/objc/Framework/Headers/WebRTC/WebRTC.h ('k') | webrtc/sdk/objc/metal.gni » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..55ed44ab65bd1f63e37011309bca637eb87c7d70
--- /dev/null
+++ b/webrtc/sdk/objc/compile_metal_lib.py
@@ -0,0 +1,61 @@
+# Copyright 2017 The WebRTC project authors. All Rights Reserved.
+#
+# 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.
+
+"""Compiles metal shader file into rtc_shaders.metallib.
+
+The produced metal library will be created in the output folder
+like so:
+ oututDir/rtc_shaders.metallib
+The script is intended to be used as gn action.
+"""
+
+
+import argparse
+import subprocess
+import sys
+
+
+def main():
+ 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, _ = parser.parse_known_args()
+
+ # TODO(denicija): replace the hardcoded iphoneos with
+ # the proper sdk var when we add metal for mac.
+ 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)
+ toolout.wait()
+
+ return toolout.returncode
+
+
+if __name__ == '__main__':
+ sys.exit(main())
« no previous file with comments | « webrtc/sdk/objc/Framework/Headers/WebRTC/WebRTC.h ('k') | webrtc/sdk/objc/metal.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698