From a3cae3d67493f1068f5fc4c39fb8b34766ff4cfa Mon Sep 17 00:00:00 2001 From: Brian Fiete Date: Sat, 16 Apr 2022 13:23:53 -0700 Subject: [PATCH] BF_MACHINE defines --- IDE/src/IDEApp.bf | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/IDE/src/IDEApp.bf b/IDE/src/IDEApp.bf index 9b20dbd8..c4f66d42 100644 --- a/IDE/src/IDEApp.bf +++ b/IDE/src/IDEApp.bf @@ -8089,7 +8089,31 @@ namespace IDE public void GetBeefPreprocessorMacros(DefinesSet macroList) { var workspaceOptions = GetCurWorkspaceOptions(); - let platform = Workspace.PlatformType.GetFromName(mPlatformName, workspaceOptions.mTargetTriple); + var targetTriple = scope String(); + + if (TargetTriple.IsTargetTriple(gApp.mPlatformName)) + targetTriple.Set(gApp.mPlatformName); + else + Workspace.PlatformType.GetTargetTripleByName(gApp.mPlatformName, .GNU, targetTriple); + if (!workspaceOptions.mTargetTriple.IsEmpty) + targetTriple.Set(workspaceOptions.mTargetTriple); + + if (targetTriple.StartsWith("x86_64-")) + macroList.Add("BF_MACHINE_X64"); + else if (targetTriple.StartsWith("i686-")) + macroList.Add("BF_MACHINE_X86"); + else if ((targetTriple.StartsWith("arm64")) || (targetTriple.StartsWith("aarch64"))) + macroList.Add("BF_MACHINE_AARCH64"); + else if (targetTriple.StartsWith("armv")) + macroList.Add("BF_MACHINE_ARM"); + else if (targetTriple.StartsWith("wasm32")) + macroList.Add("BF_MACHINE_WASM32"); + else if (targetTriple.StartsWith("wasm64")) + macroList.Add("BF_MACHINE_WASM64"); + else + macroList.Add("BF_MACHINE_X64"); // Default + + let platform = Workspace.PlatformType.GetFromName(mPlatformName, targetTriple); if (platform != .Unknown) { String def = scope .();