Skip to content

Commit 7a58368

Browse files
committed
warning fixes
1 parent 9192d40 commit 7a58368

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/cli.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -547,15 +547,14 @@ int main(int argc, char *argv[])
547547

548548
bool check_for_metal_tools(void)
549549
{
550+
#if defined(SDL_PLATFORM_MACOS) || defined(SDL_PLATFORM_WINDOWS)
551+
550552
#if defined(SDL_PLATFORM_MACOS)
551553
char *compilerName = "xcrun";
552554
char *cantFindMessage = "Install Xcode or the Xcode Command Line Tools.";
553-
#elif defined(SDL_PLATFORM_WIN32)
555+
#else
554556
char *compilerName = "metal";
555557
char *cantFindMessage = "Install Metal Developer Tools for Windows 5.0 beta 2 or newer (https://developer.apple.com/download/all/?q=metal%20developer%20tools%20for%20windows) and add \"C:\\Program Files\\Metal Developer Tools\\bin\" to your PATH.";
556-
#else
557-
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Compiling to METALLIB is not supported on this platform!");
558-
return false;
559558
#endif
560559

561560
// Check for the Metal Developer Tools...
@@ -573,27 +572,30 @@ bool check_for_metal_tools(void)
573572

574573
SDL_DestroyProcess(process);
575574
return true;
575+
576+
#else
577+
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Compiling to METALLIB is not supported on this platform!");
578+
return false;
579+
#endif
576580
}
577581

578582
int compile_metallib(ShaderCross_Platform platform, const char *outputFilename)
579583
{
580-
const char *sdkString;
581584
const char *stdString;
582585
const char *minversion;
583586
if (platform == PLATFORM_METAL_MACOS) {
584-
sdkString = "macosx";
585587
stdString = "-std=macos-metal2.0";
586588
minversion = "-mmacosx-version-min=10.13";
587589
} else {
588-
sdkString = "iphoneos";
589590
stdString = "-std=ios-metal2.0";
590591
minversion = "-miphoneos-version-min=13.0";
591592
}
592593

593594
#if defined(SDL_PLATFORM_MACOS)
595+
const char* sdkString = (platform == PLATFORM_METAL_MACOS) ? "macosx" : "iphoneos";
594596
const char* compileToIRCommand[] = { "xcrun", "-sdk", sdkString, "metal", stdString, minversion, "-Wall", "-O3", "-c", "tmp.metal", "-o", "tmp.ir", NULL };
595597
const char* compileToMetallibCommand[] = { "xcrun", "-sdk", sdkString, "metallib", "tmp.ir", "-o", outputFilename, NULL };
596-
#elif defined(SDL_PLATFORM_WINDOWS)
598+
#else
597599
const char* compileToIRCommand[] = { "metal", stdString, minversion, "-Wall", "-O3", "-c", "tmp.metal", "-o", "tmp.ir", NULL};
598600
const char* compileToMetallibCommand[] = { "metallib", "tmp.ir", "-o", outputFilename, NULL};
599601
#endif

0 commit comments

Comments
 (0)