diff options
| author | Yong He <yonghe@outlook.com> | 2024-04-19 21:02:32 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-19 21:02:32 -0700 |
| commit | beae3a9d219dac1e4e3da9c357b25d06370388f3 (patch) | |
| tree | ca4eb2a8e9ca67a130e3894c517114709576af75 /source/compiler-core/slang-gcc-compiler-util.cpp | |
| parent | f9bcad35562c1f08638e6d3eb397d370d7d2f8f8 (diff) | |
Add metal downstream compiler + metallib target. (#3990)
* Add metal downstream compiler + metallib target.
* Add more comments.
* Add missing override.
Diffstat (limited to 'source/compiler-core/slang-gcc-compiler-util.cpp')
| -rw-r--r-- | source/compiler-core/slang-gcc-compiler-util.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/source/compiler-core/slang-gcc-compiler-util.cpp b/source/compiler-core/slang-gcc-compiler-util.cpp index 79aefc71d..2bcdfcbfa 100644 --- a/source/compiler-core/slang-gcc-compiler-util.cpp +++ b/source/compiler-core/slang-gcc-compiler-util.cpp @@ -107,12 +107,15 @@ SlangResult GCCDownstreamCompilerUtil::calcVersion(const ExecutableLocation& exe UnownedStringSlice::fromLiteral("clang version"), UnownedStringSlice::fromLiteral("gcc version"), UnownedStringSlice::fromLiteral("Apple LLVM version"), + UnownedStringSlice::fromLiteral("Apple metal version"), + }; const SlangPassThrough types[] = { SLANG_PASS_THROUGH_CLANG, SLANG_PASS_THROUGH_GCC, SLANG_PASS_THROUGH_CLANG, + SLANG_PASS_THROUGH_METAL, }; SLANG_COMPILE_TIME_ASSERT(SLANG_COUNT_OF(prefixes) == SLANG_COUNT_OF(types)); @@ -262,8 +265,9 @@ static SlangResult _parseGCCFamilyLine(SliceAllocator& allocator, const UnownedS const auto split1 = split[1].trim(); const auto text = split[2].trim(); - // Check for special handling for clang (Can be Clang or clang apparently) + // Check for special handling for clang or metal if (split0.startsWith(UnownedStringSlice::fromLiteral("clang")) || + split0.startsWith(UnownedStringSlice::fromLiteral("metal")) || split0.startsWith(UnownedStringSlice::fromLiteral("Clang")) || split0 == UnownedStringSlice::fromLiteral("g++") || split0 == UnownedStringSlice::fromLiteral("gcc")) @@ -469,6 +473,11 @@ static SlangResult _parseGCCFamilyLine(SliceAllocator& allocator, const UnownedS // C++17 since we share headers with slang itself (which uses c++17) cmdLine.addArg("-std=c++17"); } + + if (targetDesc.payload == ArtifactDesc::Payload::MetalAIR) + { + cmdLine.addArg("-std=macos-metal2.3"); + } // Our generated code very often casts between dissimilar types with the // knowledge that they have the same representation. This is strictly |
