1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 11:38:21 +02:00

Added target triple support for more useful cross compilation

This commit is contained in:
Brian Fiete 2019-10-14 17:49:10 -07:00
parent 22ec4a86b8
commit 3bf4c792d8
15 changed files with 145 additions and 124 deletions

View file

@ -954,30 +954,32 @@ void BfModule::FinishInit()
mBfIRBuilder->Start(mModuleName, mCompiler->mSystem->mPtrSize, IsOptimized());
#ifdef BF_PLATFORM_WINDOWS
if (mCompiler->mOptions.mToolsetType == BfToolsetType_GNU)
{
if (mCompiler->mOptions.mMachineType == BfMachineType_x86)
mBfIRBuilder->Module_SetTargetTriple("i686-pc-windows-gnu");
else
mBfIRBuilder->Module_SetTargetTriple("x86_64-pc-windows-gnu");
}
else //if (mCompiler->mOptions.mToolsetType == BfToolsetType_Microsoft)
{
if (mCompiler->mOptions.mMachineType == BfMachineType_x86)
mBfIRBuilder->Module_SetTargetTriple("i686-pc-windows-msvc");
else
mBfIRBuilder->Module_SetTargetTriple("x86_64-pc-windows-msvc");
}
#elif defined BF_PLATFORM_LINUX
if (mCompiler->mOptions.mMachineType == BfMachineType_x86)
mBfIRBuilder->Module_SetTargetTriple("i686-unknown-linux-gnu");
else
mBfIRBuilder->Module_SetTargetTriple("x86_64-unknown-linux-gnu");
#else
// Leave it default
mBfIRBuilder->Module_SetTargetTriple("");
#endif
mBfIRBuilder->Module_SetTargetTriple(mCompiler->mOptions.mTargetTriple);
// #ifdef BF_PLATFORM_WINDOWS
// if (mCompiler->mOptions.mToolsetType == BfToolsetType_GNU)
// {
// if (mCompiler->mOptions.mMachineType == BfMachineType_x86)
// mBfIRBuilder->Module_SetTargetTriple("i686-pc-windows-gnu");
// else
// mBfIRBuilder->Module_SetTargetTriple("x86_64-pc-windows-gnu");
// }
// else //if (mCompiler->mOptions.mToolsetType == BfToolsetType_Microsoft)
// {
// if (mCompiler->mOptions.mMachineType == BfMachineType_x86)
// mBfIRBuilder->Module_SetTargetTriple("i686-pc-windows-msvc");
// else
// mBfIRBuilder->Module_SetTargetTriple("x86_64-pc-windows-msvc");
// }
// #elif defined BF_PLATFORM_LINUX
// if (mCompiler->mOptions.mMachineType == BfMachineType_x86)
// mBfIRBuilder->Module_SetTargetTriple("i686-unknown-linux-gnu");
// else
// mBfIRBuilder->Module_SetTargetTriple("x86_64-unknown-linux-gnu");
// #else
// // Leave it default
// mBfIRBuilder->Module_SetTargetTriple("");
// #endif
mBfIRBuilder->SetBackend(IsTargetingBeefBackend());