| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 | 2 |
| 3 # Copyright 2016 Google Inc. | 3 # Copyright 2016 Google Inc. |
| 4 # | 4 # |
| 5 # Use of this source code is governed by a BSD-style license that can be | 5 # Use of this source code is governed by a BSD-style license that can be |
| 6 # found in the LICENSE file. | 6 # found in the LICENSE file. |
| 7 | 7 |
| 8 | 8 |
| 9 """ | 9 """ |
| 10 Script to build the shaderc library. | 10 Script to build the shaderc library. |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 os.makedirs(args.output_dir) | 66 os.makedirs(args.output_dir) |
| 67 except os.error: | 67 except os.error: |
| 68 sys.exit('Error creating output dir ' + args.output_dir) | 68 sys.exit('Error creating output dir ' + args.output_dir) |
| 69 | 69 |
| 70 try: | 70 try: |
| 71 build_type_arg='-DCMAKE_BUILD_TYPE=' + args.build_type | 71 build_type_arg='-DCMAKE_BUILD_TYPE=' + args.build_type |
| 72 cmake_cmd = ['cmake', '-G', generator, | 72 cmake_cmd = ['cmake', '-G', generator, |
| 73 '-DSPIRV_SKIP_EXECUTABLES=ON', | 73 '-DSPIRV_SKIP_EXECUTABLES=ON', |
| 74 '-DSHADERC_ENABLE_SHARED_CRT=ON'] | 74 '-DSHADERC_ENABLE_SHARED_CRT=ON'] |
| 75 if args.android_toolchain and args.android_toolchain.strip() : | 75 if args.android_toolchain and args.android_toolchain.strip() : |
| 76 cmake_cmd.append('-DCMAKE_TOOLCHAIN_FILE=' + args.src_dir +\ | 76 cmake_cmd.append('-DCMAKE_TOOLCHAIN_FILE=' +\ |
| 77 '/third_party/android-cmake/android.toolchain.cmake') | 77 os.environ['ANDROID_SDK_ROOT'] +\ |
| 78 '/cmake/android.toolchain.cmake') |
| 78 cmake_cmd.append('-DANDROID_TOOLCHAIN_NAME=standalone-clang') | 79 cmake_cmd.append('-DANDROID_TOOLCHAIN_NAME=standalone-clang') |
| 79 cmake_cmd.append('-DANDROID_STANDALONE_TOOLCHAIN=' +\ | 80 cmake_cmd.append('-DANDROID_STANDALONE_TOOLCHAIN=' +\ |
| 80 os.path.abspath(args.android_toolchain)) | 81 os.path.abspath(args.android_toolchain)) |
| 81 cmake_cmd.extend([build_type_arg, args.src_dir]) | 82 cmake_cmd.extend([build_type_arg, args.src_dir]) |
| 82 subprocess.check_call(cmake_cmd, cwd=args.output_dir) | 83 subprocess.check_call(cmake_cmd, cwd=args.output_dir) |
| 83 except subprocess.CalledProcessError as error: | 84 except subprocess.CalledProcessError as error: |
| 84 sys.exit('Error (ret code: {code}) calling "{cmd}" in {dir}'.format( | 85 sys.exit('Error (ret code: {code}) calling "{cmd}" in {dir}'.format( |
| 85 code = error.returncode, cmd = error.cmd, dir = args.src_dir)) | 86 code = error.returncode, cmd = error.cmd, dir = args.src_dir)) |
| 86 | 87 |
| 87 try: | 88 try: |
| 88 subprocess.check_call(['cmake', '--build', args.output_dir, '--config', | 89 subprocess.check_call(['cmake', '--build', args.output_dir, '--config', |
| 89 args.build_type], cwd=args.output_dir) | 90 args.build_type], cwd=args.output_dir) |
| 90 except subprocess.CalledProcessError as error: | 91 except subprocess.CalledProcessError as error: |
| 91 sys.exit('Error (ret code: {code}) calling "{cmd}" in {dir}'.format( | 92 sys.exit('Error (ret code: {code}) calling "{cmd}" in {dir}'.format( |
| 92 code = error.returncode, cmd = error.cmd, dir = args.src_dir)) | 93 code = error.returncode, cmd = error.cmd, dir = args.src_dir)) |
| 93 | 94 |
| 94 if __name__ == '__main__': | 95 if __name__ == '__main__': |
| 95 main() | 96 main() |
| OLD | NEW |