(argv)
| 366 | |
| 367 | |
| 368 | def main(argv): |
| 369 | parser = argparse.ArgumentParser() |
| 370 | parser.add_argument('--perforce', choices=('submit', 'save', 'revert', 'none'), default='save', |
| 371 | help='Perforce action for compiled files: submit CL, leave CL, revert CL, no perforce interaction') |
| 372 | parser.add_argument('--rebuild', action='store_true', help='Rebuild shaders instead of doing incremental build') |
| 373 | parser.add_argument('--cl', default='Compiled shaders', help='Perforce CL description') |
| 374 | parser.add_argument('--log', choices=('critical', 'error', 'warning', 'info', 'debug'), default='error', |
| 375 | help='Logging verbosity') |
| 376 | parser.add_argument('--compiler', default=SHADER_COMPILER, help='Override shader compiler executable location') |
| 377 | parser.add_argument('--platform', action='append', default=[], help='Override platforms to build') |
| 378 | parser.add_argument('--model', nargs='*', default=[], help='Override shader models to build') |
| 379 | parser.add_argument('--warnings', type=str2bool, default=True, help='Emit compiler warnings (true by default)') |
| 380 | parser.add_argument('--staging', default='', help='Path to the output staging directory to place compiled files (if not specified, files are modified in-place)') |
| 381 | parser.add_argument('--teamcity', action='store_true', default=False, help='Use TeamCity formatter for logs') |
| 382 | parser.add_argument('path', nargs='+', help='Path to .fx file, folder or VS Code workspace') |
| 383 | |
| 384 | args = parser.parse_args(argv) |
| 385 | logging.basicConfig(level=args.log.upper(), stream=sys.stdout) |
| 386 | if args.teamcity: |
| 387 | logging.root.handlers[0].setFormatter(TeamCityFormatter()) |
| 388 | else: |
| 389 | logging.root.handlers[0].setFormatter(OutputFormatter(logging.BASIC_FORMAT)) |
| 390 | |
| 391 | return build(args.path, Perforce(args.perforce, args.cl), incremental=not args.rebuild, platforms=args.platform, |
| 392 | shader_models=args.model, shader_compiler=args.compiler, warnings=args.warnings, staging=args.staging) |
| 393 | |
| 394 | |
| 395 | if __name__ == '__main__': |
no test coverage detected