1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-18 09:00:07 +02:00

Fix clang compiler build info

Make GCC/clang differentiation more accurate
Add "Apple clang" detection

Signed-off-by: Emily Mabrey <emabrey@tenacityaudio.org>
This commit is contained in:
Emily Mabrey 2021-09-14 22:58:51 -04:00
parent 400ef4096c
commit 6831615d3f
No known key found for this signature in database
GPG Key ID: 6F4EF47256A1B7DC

View File

@ -26,17 +26,19 @@
class BuildInfo { class BuildInfo {
public: public:
enum class CompilerType { MSVC, MinGW, GCC, Clang, Unknown }; enum class CompilerType { MSVC, MinGW, GCC, Clang, AppleClang, Unknown };
static constexpr auto CurrentBuildCompiler = static constexpr auto CurrentBuildCompiler =
#if defined(_MSC_FULL_VER) #if defined(_MSC_FULL_VER)
CompilerType::MSVC; CompilerType::MSVC;
#elif defined(__GNUC_PATCHLEVEL__) && defined(__MINGW32__) #elif defined(__GNUC_PATCHLEVEL__) && defined(__MINGW32__)
CompilerType::MinGW; CompilerType::MinGW;
#elif defined(__GNUC_PATCHLEVEL__) #elif defined(__GNUC_PATCHLEVEL__) && !defined(__llvm__) && !defined(__clang__)
CompilerType::GCC; CompilerType::GCC;
#elif defined(__clang_version__) #elif defined(__clang_version__) && !defined(__apple_build_version__)
CompilerType::Clang; CompilerType::Clang;
#elif defined(__clang_version__) && defined(__apple_build_version__)
CompilerType::AppleClang;
#else #else
CompilerType::Unknown; CompilerType::Unknown;
#endif #endif
@ -81,6 +83,15 @@ public:
#endif #endif
return wxString::Format( wxT("clang %s"), CUSTOM_wxMAKE_VERSION_DOT_STRING_T(__clang_major__, __clang_minor__, __clang_patchlevel__)); return wxString::Format( wxT("clang %s"), CUSTOM_wxMAKE_VERSION_DOT_STRING_T(__clang_major__, __clang_minor__, __clang_patchlevel__));
case BuildInfo::CompilerType::AppleClang:
#if !defined(__clang_major__) || !defined (__clang_minor__) || !defined(__clang_patchlevel__)
// This should be unreachable, but it makes the compiler realize that they will always be defined
#define __clang_major__ 0
#define __clang_minor__ 0
#define __clang_patchlevel__ 0
#endif
return wxString::Format( wxT("Apple clang %s"), CUSTOM_wxMAKE_VERSION_DOT_STRING_T(__clang_major__, __clang_minor__, __clang_patchlevel__));
case BuildInfo::CompilerType::Unknown: case BuildInfo::CompilerType::Unknown:
default: default:
return wxT("Unknown!!!"); return wxT("Unknown!!!");