tint: use TINT_BUILD_IS_MAC instead of __APPLE__
This fixes the cmake build with TINT_BUILD_AS_OTHER_OS=1 on mac.
Change-Id: I14ca84dc84fa2ca6f78a585bb46e9a84772dbcdd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/178460
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
diff --git a/src/tint/cmd/remote_compile/main.cc b/src/tint/cmd/remote_compile/main.cc
index 726f986..277450e 100644
--- a/src/tint/cmd/remote_compile/main.cc
+++ b/src/tint/cmd/remote_compile/main.cc
@@ -448,7 +448,7 @@
}
return;
}
-#if TINT_BUILD_MSL_WRITER && defined(__APPLE__)
+#if TINT_BUILD_MSL_WRITER && TINT_BUILD_IS_MAC
if (req.language == SourceLanguage::MSL) {
auto version = tint::msl::validate::MslVersion::kMsl_1_2;
if (req.version_major == 2 && req.version_minor == 1) {
diff --git a/src/tint/cmd/tint/main.cc b/src/tint/cmd/tint/main.cc
index 06f2ef0..7ea30107 100644
--- a/src/tint/cmd/tint/main.cc
+++ b/src/tint/cmd/tint/main.cc
@@ -932,7 +932,7 @@
if (options.validate && options.skip_hash.count(hash) == 0) {
tint::msl::validate::Result res;
-#ifdef __APPLE__
+#if TINT_BUILD_IS_MAC
res = tint::msl::validate::ValidateUsingMetal(result->msl, msl_version);
#else
#ifdef _WIN32
@@ -948,7 +948,7 @@
res.output = "xcrun executable not found. Cannot validate.";
res.failed = true;
}
-#endif // __APPLE__
+#endif // TINT_BUILD_IS_MAC
if (res.failed) {
std::cerr << res.output << "\n";
return false;
diff --git a/src/tint/lang/msl/validate/validate.h b/src/tint/lang/msl/validate/validate.h
index 1a303d5..d7b8acf 100644
--- a/src/tint/lang/msl/validate/validate.h
+++ b/src/tint/lang/msl/validate/validate.h
@@ -69,14 +69,14 @@
/// @return the result of the compile
Result Validate(const std::string& xcrun_path, const std::string& source, MslVersion version);
-#ifdef __APPLE__
+#if TINT_BUILD_IS_MAC
/// ValidateUsingMetal attempts to compile the shader with the runtime Metal Shader Compiler
/// API, verifying that the shader compiles successfully.
/// @param source the generated MSL source
/// @param version the version of MSL to validate against
/// @return the result of the compile
Result ValidateUsingMetal(const std::string& source, MslVersion version);
-#endif // __APPLE__
+#endif // TINT_BUILD_IS_MAC
} // namespace tint::msl::validate