| 21 | } |
| 22 | |
| 23 | int wmain(int argc, wchar_t* argv[]) |
| 24 | { |
| 25 | int returnValue = -1; |
| 26 | { |
| 27 | // We need to parse any command-line arguments. |
| 28 | String outputDir; |
| 29 | CompileOptions options; |
| 30 | |
| 31 | // As we parse the command line, we will rewrite the |
| 32 | // entries in `argv` to collect any "ordinary" arguments. |
| 33 | wchar_t const** inputPaths = (wchar_t const**)&argv[1]; |
| 34 | wchar_t const** inputPathCursor = inputPaths; |
| 35 | |
| 36 | wchar_t** argCursor = &argv[1]; |
| 37 | wchar_t** argEnd = &argv[argc]; |
| 38 | while (argCursor != argEnd) |
| 39 | { |
| 40 | wchar_t const* arg = *argCursor++; |
| 41 | if (arg[0] == '-') |
| 42 | { |
| 43 | String argStr = String::FromWString(arg); |
| 44 | |
| 45 | // The argument looks like an option, so try to parse it. |
| 46 | if (argStr == "-out") |
| 47 | outputDir = tryReadCommandLineArgument(arg, &argCursor, argEnd); |
| 48 | else if (argStr == "-symbo") |
| 49 | options.SymbolToCompile = tryReadCommandLineArgument(arg, &argCursor, argEnd); |
| 50 | else if (argStr == "-schedule") |
| 51 | options.ScheduleFileName = tryReadCommandLineArgument(arg, &argCursor, argEnd); |
| 52 | else if (argStr == "-backend") |
| 53 | { |
| 54 | String name = tryReadCommandLineArgument(arg, &argCursor, argEnd); |
| 55 | if (name == "glsl") |
| 56 | { |
| 57 | options.Target = CodeGenTarget::GLSL; |
| 58 | } |
| 59 | else if (name == "glsl_vk") |
| 60 | { |
| 61 | options.Target = CodeGenTarget::GLSL_Vulkan; |
| 62 | } |
| 63 | else if (name == "glsl_vk_onedesc") |
| 64 | { |
| 65 | options.Target = CodeGenTarget::GLSL_Vulkan_OneDesc; |
| 66 | } |
| 67 | else if (name == "hlsl") |
| 68 | { |
| 69 | options.Target = CodeGenTarget::HLSL; |
| 70 | } |
| 71 | else if (name == "spriv") |
| 72 | { |
| 73 | options.Target = CodeGenTarget::SPIRV; |
| 74 | } |
| 75 | else |
| 76 | { |
| 77 | fprintf(stderr, "unknown code generation target '%S'\n", name.ToWString()); |
| 78 | } |
| 79 | } |
| 80 | else if (argStr == "-genchoice") |
nothing calls this directly
no test coverage detected