From 1f2632786c4efbe236281cf5bc0446450b89ceea Mon Sep 17 00:00:00 2001 From: Brian Fiete Date: Mon, 4 May 2020 15:05:42 -0700 Subject: [PATCH] Fixed GUI Application setting on non-Windows platforms --- IDEHelper/Compiler/BfCompiler.cpp | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/IDEHelper/Compiler/BfCompiler.cpp b/IDEHelper/Compiler/BfCompiler.cpp index 4f03b2d9..e294bdce 100644 --- a/IDEHelper/Compiler/BfCompiler.cpp +++ b/IDEHelper/Compiler/BfCompiler.cpp @@ -1614,12 +1614,16 @@ void BfCompiler::CreateVData(BfVDataModule* bfModule) bfModule->mBfIRBuilder->CreateRetVoid(); } + auto targetType = project->mTargetType; + if ((targetType == BfTargetType_BeefWindowsApplication) && (mOptions.mPlatformType != BfPlatformType_Windows)) + targetType = BfTargetType_BeefConsoleApplication; + // Generate "main" if (!IsHotCompile()) { BfIRFunctionType mainFuncType; BfIRFunction mainFunc; - if ((project->mTargetType == BfTargetType_BeefConsoleApplication) || (project->mTargetType == BfTargetType_BeefTest)) + if ((targetType == BfTargetType_BeefConsoleApplication) || (targetType == BfTargetType_BeefTest)) { SmallVector paramTypes; paramTypes.push_back(int32Type); @@ -1628,7 +1632,7 @@ void BfCompiler::CreateVData(BfVDataModule* bfModule) mainFunc = bfModule->mBfIRBuilder->CreateFunction(mainFuncType, BfIRLinkageType_External, "main"); bfModule->SetupIRMethod(NULL, mainFunc, false); } - else if (project->mTargetType == BfTargetType_BeefDynLib) + else if (targetType == BfTargetType_BeefDynLib) { SmallVector paramTypes; paramTypes.push_back(nullPtrType); // hinstDLL @@ -1640,7 +1644,7 @@ void BfCompiler::CreateVData(BfVDataModule* bfModule) bfModule->mBfIRBuilder->SetFuncCallingConv(mainFunc, BfIRCallingConv_StdCall); bfModule->SetupIRMethod(NULL, mainFunc, false); } - else if (project->mTargetType == BfTargetType_BeefWindowsApplication) + else if (targetType == BfTargetType_BeefWindowsApplication) { SmallVector paramTypes; paramTypes.push_back(nullPtrType); // hInstance @@ -1685,7 +1689,7 @@ void BfCompiler::CreateVData(BfVDataModule* bfModule) #endif BfIRBlock initSkipBlock; - if (project->mTargetType == BfTargetType_BeefDynLib) + if (targetType == BfTargetType_BeefDynLib) { auto initBlock = bfModule->mBfIRBuilder->CreateBlock("doInit", false); initSkipBlock = bfModule->mBfIRBuilder->CreateBlock("skipInit", false); @@ -1749,8 +1753,8 @@ void BfCompiler::CreateVData(BfVDataModule* bfModule) } BfIRValue retValue; - if ((project->mTargetType == BfTargetType_BeefConsoleApplication) || (project->mTargetType == BfTargetType_BeefWindowsApplication) || - (project->mTargetType == BfTargetType_BeefApplication_StaticLib) || (project->mTargetType == BfTargetType_BeefApplication_DynamicLib)) + if ((targetType == BfTargetType_BeefConsoleApplication) || (targetType == BfTargetType_BeefWindowsApplication) || + (targetType == BfTargetType_BeefApplication_StaticLib) || (targetType == BfTargetType_BeefApplication_DynamicLib)) { bool hadRet = false; @@ -1890,16 +1894,16 @@ void BfCompiler::CreateVData(BfVDataModule* bfModule) if (!hadRet) retValue = bfModule->GetConstValue32(0); } - else if (project->mTargetType == BfTargetType_BeefDynLib) + else if (targetType == BfTargetType_BeefDynLib) { retValue = bfModule->GetConstValue32(1); } - if (project->mTargetType == BfTargetType_BeefTest) + if (targetType == BfTargetType_BeefTest) EmitTestMethod(bfModule, testMethods, retValue); BfIRBlock deinitSkipBlock; - if (project->mTargetType == BfTargetType_BeefDynLib) + if (targetType == BfTargetType_BeefDynLib) { auto deinitBlock = bfModule->mBfIRBuilder->CreateBlock("doDeinit", false); deinitSkipBlock = bfModule->mBfIRBuilder->CreateBlock("skipDeinit", false);