diff options
Diffstat (limited to 'tools/build_shaderc.py')
-rw-r--r-- | tools/build_shaderc.py | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/tools/build_shaderc.py b/tools/build_shaderc.py index 93b42bd70e..0a3fc3aa28 100644 --- a/tools/build_shaderc.py +++ b/tools/build_shaderc.py @@ -29,6 +29,8 @@ def main(): 'Directory for cmake build') parser.add_argument('-p', '--project_type', required=True, help= 'Project type to use. Must be "ninja", "MSVS2013", or "MSVS2015"') + parser.add_argument('-c', '--android_toolchain', required=False, help= + 'Location of standalone android toolchain to use for crosscompiling') args = parser.parse_args() args.src_dir = os.path.abspath(args.src_dir) @@ -44,12 +46,9 @@ def main(): else: args.exit('Invalid build type: ' + args.build_type); - if args.arch_type == 'x86': - vs_arch = '' - elif args.arch_type == 'x86_64': + vs_arch = '' + if args.arch_type == 'x86_64': vs_arch = ' Win64' - else: - sys.exit('Invalid arch type: ' + args.arch_type); if args.project_type == 'ninja': generator = 'Ninja' @@ -70,9 +69,17 @@ def main(): try: build_type_arg='-DCMAKE_BUILD_TYPE=' + args.build_type - subprocess.check_call(['cmake', '-G', generator, - '-DSPIRV_SKIP_EXECUTABLES=ON', '-DSHADERC_ENABLE_SHARED_CRT=ON', - args.src_dir, build_type_arg], cwd=args.output_dir) + cmake_cmd = ['cmake', '-G', generator, + '-DSPIRV_SKIP_EXECUTABLES=ON', + '-DSHADERC_ENABLE_SHARED_CRT=ON'] + if args.android_toolchain and args.android_toolchain.strip() : + cmake_cmd.append('-DCMAKE_TOOLCHAIN_FILE=' + args.src_dir +\ + '/third_party/android-cmake/android.toolchain.cmake') + cmake_cmd.append('-DANDROID_TOOLCHAIN_NAME=standalone-clang') + cmake_cmd.append('-DANDROID_STANDALONE_TOOLCHAIN=' +\ + os.path.abspath(args.android_toolchain)) + cmake_cmd.extend([build_type_arg, args.src_dir]) + subprocess.check_call(cmake_cmd, 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)) @@ -86,4 +93,3 @@ def main(): if __name__ == '__main__': main() - |