allow to enable the cuda mode of the compilerInstance
set the AuxTarget, if the LangOpt CUDA is true and enable the compilation of cuda runtime code needs a preload of the libcudart.so and the arguments -std=c++11 and --cuda-host-only at start of cling
This commit is contained in:
parent
6bbf1f3311
commit
757fca022f
@ -1116,6 +1116,15 @@ static void stringifyPreprocSetting(PreprocessorOptions& PPOpts,
|
|||||||
Buffer = llvm::MemoryBuffer::getMemBuffer("/*CLING DEFAULT MEMBUF*/;\n");
|
Buffer = llvm::MemoryBuffer::getMemBuffer("/*CLING DEFAULT MEMBUF*/;\n");
|
||||||
const_cast<SrcMgr::ContentCache*>(MainFileCC)->setBuffer(std::move(Buffer));
|
const_cast<SrcMgr::ContentCache*>(MainFileCC)->setBuffer(std::move(Buffer));
|
||||||
|
|
||||||
|
// Create TargetInfo for the other side of CUDA and OpenMP compilation.
|
||||||
|
if ((CI->getLangOpts().CUDA || CI->getLangOpts().OpenMPIsDevice) &&
|
||||||
|
!CI->getFrontendOpts().AuxTriple.empty()) {
|
||||||
|
auto TO = std::make_shared<TargetOptions>();
|
||||||
|
TO->Triple = CI->getFrontendOpts().AuxTriple;
|
||||||
|
TO->HostTriple = CI->getTarget().getTriple().str();
|
||||||
|
CI->setAuxTarget(TargetInfo::CreateTargetInfo(CI->getDiagnostics(), TO));
|
||||||
|
}
|
||||||
|
|
||||||
// Set up the preprocessor
|
// Set up the preprocessor
|
||||||
CI->createPreprocessor(TU_Complete);
|
CI->createPreprocessor(TU_Complete);
|
||||||
Preprocessor& PP = CI->getPreprocessor();
|
Preprocessor& PP = CI->getPreprocessor();
|
||||||
|
Loading…
Reference in New Issue
Block a user