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

Unified Diff: tools/build_shaderc.py

Issue 1760493003: Pull and build shaderc rather than use checked in lib/header (Closed) Base URL: https://skia.googlesource.com/skia@depsos
Patch Set: use shaderc2 dir Created 4 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 | « third_party/shaderc/shaderc.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/build_shaderc.py
diff --git a/tools/build_shaderc.py b/tools/build_shaderc.py
new file mode 100644
index 0000000000000000000000000000000000000000..1f05e84672412d79b16044f48a7668c001f4b3f6
--- /dev/null
+++ b/tools/build_shaderc.py
@@ -0,0 +1,81 @@
+#!/usr/bin/python
+
+# Copyright 2016 Google Inc.
+#
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+
+"""
+Script to build the shaderc library.
+"""
+
+import argparse
+import os
+import shlex
+import shutil
+import subprocess
+import sys
+
+def main():
+ parser = argparse.ArgumentParser(description='Builds shaderc')
+ parser.add_argument('-s', '--src-dir', required=True, help=
+ 'path to shaderc source')
+ parser.add_argument('-t', '--build-type', required=True, help=
+ 'Either Release or Debug')
+ parser.add_argument('-a', '--arch-type', required=True, help=
+ 'Either x86 or x86_64')
+ parser.add_argument('-o', '--output-dir', required=True, help=
+ 'Directory for cmake build')
+ parser.add_argument('-p', '--project_type', required=True, help=
+ 'Project type to use. Must be "ninja", "MSVS2013", or "MSVS2015"')
+ args = parser.parse_args()
+
+ args.src_dir = os.path.abspath(args.src_dir)
+ args.output_dir = os.path.abspath(args.output_dir)
+
+ if not os.path.isdir(args.src_dir):
+ sys.exit(args.src_dir + ' is not a directory.')
+
+ if args.build_type != 'Debug' and args.build_type != 'Release':
+ sys.exit('Invalid build type: ' + args.build_type);
+
+ if args.arch_type == 'x86':
+ vs_arch = ''
+ elif args.arch_type == 'x86_64':
+ vs_arch = ' Win64'
+ else:
+ sys.exit('Invalid arch type: ' + args.arch_type);
+
+ if args.project_type == 'ninja':
+ generator = 'Ninja'
+ elif args.project_type == 'MSVS2013':
+ generator = 'Visual Studio 12 2013' + vs_arch
+ elif args.project_type == "MSVS2015":
+ generator = 'Visual Studio 14 2015' + vs_arch
+ else:
+ sys.exit('Invalid project type: ' + args.project_type);
+
+ if not os.path.isdir(args.output_dir):
+ try:
+ os.makedirs(args.output_dir)
+ except os.error:
+ sys.exit('Error creating output dir ' + args.output_dir)
+
+ try:
+ subprocess.check_call(['cmake', '-G', generator,
+ '-DSPIRV_SKIP_EXECUTABLES=ON', args.src_dir], cwd=args.output_dir)
+ except subprocess.CalledProcessError as error:
+ sys.exit('Error (ret code: {code}) calling "{cmd}" in {dir}'.format(
+ code = error.returncode, cmd = error.cmd, dir = args.src_dir))
+
+ try:
+ subprocess.check_call(['cmake', '--build', args.output_dir, '--config',
+ args.build_type], cwd=args.output_dir)
+ except subprocess.CalledProcessError as error:
+ sys.exit('Error (ret code: {code}) calling "{cmd}" in {dir}'.format(
+ code = error.returncode, cmd = error.cmd, dir = args.src_dir))
+
+if __name__ == '__main__':
+ main()
+
« no previous file with comments | « third_party/shaderc/shaderc.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698