From 2f3dd44f3366e259356454d13bb0bc1db9e90377 Mon Sep 17 00:00:00 2001 From: Anthony Nicholls Date: Tue, 22 Oct 2024 15:46:58 +0100 Subject: [PATCH] Projucer: Add arm64 warning on Windows --- .../Projucer/Source/Project/jucer_Project.h | 5 +++- .../ProjectSaving/jucer_ProjectExport_MSVC.h | 28 ++++++++++++++++++- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/extras/Projucer/Source/Project/jucer_Project.h b/extras/Projucer/Source/Project/jucer_Project.h index a3ce2124bc..96d60a31de 100644 --- a/extras/Projucer/Source/Project/jucer_Project.h +++ b/extras/Projucer/Source/Project/jucer_Project.h @@ -60,6 +60,7 @@ namespace ProjectMessages DECLARE_ID (manufacturerCodeInvalid); DECLARE_ID (deprecatedExporter); DECLARE_ID (unsupportedArm32Config); + DECLARE_ID (arm64Warning); DECLARE_ID (notification); DECLARE_ID (warning); @@ -74,7 +75,7 @@ namespace ProjectMessages static Identifier warnings[] = { Ids::cppStandard, Ids::moduleNotFound, Ids::jucePath, Ids::jucerFileModified, Ids::missingModuleDependencies, Ids::oldProjucer, Ids::pluginCodeInvalid, Ids::manufacturerCodeInvalid, - Ids::deprecatedExporter, Ids::unsupportedArm32Config }; + Ids::deprecatedExporter, Ids::unsupportedArm32Config, Ids::arm64Warning }; if (std::find (std::begin (warnings), std::end (warnings), message) != std::end (warnings)) return Ids::warning; @@ -101,6 +102,7 @@ namespace ProjectMessages if (message == Ids::manufacturerCodeInvalid) return "Invalid Manufacturer Code"; if (message == Ids::deprecatedExporter) return "Deprecated Exporter"; if (message == Ids::unsupportedArm32Config) return "Unsupported Architecture"; + if (message == Ids::arm64Warning) return "Prefer arm64ec over arm64"; jassertfalse; return {}; @@ -119,6 +121,7 @@ namespace ProjectMessages if (message == Ids::manufacturerCodeInvalid) return "The manufacturer code should be exactly four characters in length."; if (message == Ids::deprecatedExporter) return "The project includes a deprecated exporter."; if (message == Ids::unsupportedArm32Config) return "The project includes a Visual Studio configuration that uses the 32-bit Arm architecture, which is no longer supported. This configuration has been hidden, and will be removed on save."; + if (message == Ids::arm64Warning) return "For software where interoperability is a concern (such as plugins and hosts), arm64ec will provide the best compatibility with existing x64 software"; jassertfalse; return {}; diff --git a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_MSVC.h b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_MSVC.h index c371155ea6..eff607f49a 100644 --- a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_MSVC.h +++ b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_MSVC.h @@ -243,7 +243,8 @@ public: } //============================================================================== - class MSVCBuildConfiguration final : public BuildConfiguration + class MSVCBuildConfiguration final : public BuildConfiguration, + private ValueTree::Listener { public: MSVCBuildConfiguration (Project& p, const ValueTree& settings, const ProjectExporter& e) @@ -285,6 +286,31 @@ public: } optimisationLevelValue.setDefault (isDebug() ? optimisationOff : optimiseFull); + + config.addListener (this); + } + + ~MSVCBuildConfiguration() override + { + config.removeListener (this); + } + + void valueTreePropertyChanged (ValueTree&, const Identifier& property) override + { + if (property != Ids::winArchitecture) + return; + + project.removeProjectMessage (ProjectMessages::Ids::arm64Warning); + + const auto selectedArchs = architectureTypeValue.get(); + + if (! selectedArchs.getArray()->contains (toString (Architecture::arm64))) + return; + + if (selectedArchs.getArray()->contains (toString (Architecture::arm64ec))) + return; + + project.addProjectMessage (ProjectMessages::Ids::arm64Warning, {}); } String getBinaryPath (const Identifier& id, Architecture arch) const