mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-13 07:57:51 +00:00
Compile fix for macOS
This commit is contained in:
parent
08a90a13f4
commit
2838e1b5de
2 changed files with 17 additions and 1 deletions
|
@ -55,6 +55,10 @@
|
||||||
#include <llvm/MC/MCAsmInfo.h>
|
#include <llvm/MC/MCAsmInfo.h>
|
||||||
#include <llvm/Target/TargetSubtargetInfo.h>
|
#include <llvm/Target/TargetSubtargetInfo.h>
|
||||||
|
|
||||||
|
#if LLVM_VERSION_MAJOR < 3 || (LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR < 8)
|
||||||
|
#include <llvm/Support/FormattedStream.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
#pragma clang diagnostic pop
|
#pragma clang diagnostic pop
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -474,7 +474,11 @@ void LLVMProgram::CreateEE()
|
||||||
if (!machine)
|
if (!machine)
|
||||||
I_FatalError("Could not create LLVM target machine");
|
I_FatalError("Could not create LLVM target machine");
|
||||||
|
|
||||||
|
#if LLVM_VERSION_MAJOR < 3 || (LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR < 8)
|
||||||
|
std::string targetTriple = machine->getTargetTriple();
|
||||||
|
#else
|
||||||
std::string targetTriple = machine->getTargetTriple().getTriple();
|
std::string targetTriple = machine->getTargetTriple().getTriple();
|
||||||
|
#endif
|
||||||
std::string cpuName = machine->getTargetCPU();
|
std::string cpuName = machine->getTargetCPU();
|
||||||
Printf("LLVM target triple: %s\n", targetTriple.c_str());
|
Printf("LLVM target triple: %s\n", targetTriple.c_str());
|
||||||
Printf("LLVM target CPU: %s\n", cpuName.c_str());
|
Printf("LLVM target CPU: %s\n", cpuName.c_str());
|
||||||
|
@ -540,7 +544,11 @@ std::string LLVMProgram::GenerateAssembly(std::string cpuName)
|
||||||
if (!machine)
|
if (!machine)
|
||||||
I_FatalError("Could not create LLVM target machine");
|
I_FatalError("Could not create LLVM target machine");
|
||||||
|
|
||||||
|
#if LLVM_VERSION_MAJOR < 3 || (LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR < 8)
|
||||||
|
std::string targetTriple = machine->getTargetTriple();
|
||||||
|
#else
|
||||||
std::string targetTriple = machine->getTargetTriple().getTriple();
|
std::string targetTriple = machine->getTargetTriple().getTriple();
|
||||||
|
#endif
|
||||||
|
|
||||||
module->setTargetTriple(targetTriple);
|
module->setTargetTriple(targetTriple);
|
||||||
#if LLVM_VERSION_MAJOR < 3 || (LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR < 8)
|
#if LLVM_VERSION_MAJOR < 3 || (LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR < 8)
|
||||||
|
@ -558,9 +566,13 @@ std::string LLVMProgram::GenerateAssembly(std::string cpuName)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SmallString<16*1024> str;
|
SmallString<16*1024> str;
|
||||||
|
#if LLVM_VERSION_MAJOR < 3 || (LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR < 8)
|
||||||
|
raw_svector_ostream vecstream(str);
|
||||||
|
formatted_raw_ostream stream(vecstream);
|
||||||
|
#else
|
||||||
raw_svector_ostream stream(str);
|
raw_svector_ostream stream(str);
|
||||||
|
#endif
|
||||||
machine->addPassesToEmitFile(PerModulePasses, stream, TargetMachine::CGFT_AssemblyFile);
|
machine->addPassesToEmitFile(PerModulePasses, stream, TargetMachine::CGFT_AssemblyFile);
|
||||||
PerModulePasses.add(createPrintMIRPass(stream));
|
|
||||||
|
|
||||||
PassManagerBuilder passManagerBuilder;
|
PassManagerBuilder passManagerBuilder;
|
||||||
passManagerBuilder.OptLevel = 3;
|
passManagerBuilder.OptLevel = 3;
|
||||||
|
|
Loading…
Reference in a new issue