From 62f6ac72a55d586312f4a10c0f6a11bb23de126e Mon Sep 17 00:00:00 2001 From: mcbarton <150042563+mcbarton@users.noreply.github.com> Date: Wed, 29 Oct 2025 19:44:55 +0000 Subject: [PATCH] Enable cling to be built with Emscripten --- interpreter/cling/CMakeLists.txt | 2 +- .../cling/lib/Interpreter/IncrementalCUDADeviceCompiler.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/interpreter/cling/CMakeLists.txt b/interpreter/cling/CMakeLists.txt index fe6c373c422a1..da16de5ceb68a 100644 --- a/interpreter/cling/CMakeLists.txt +++ b/interpreter/cling/CMakeLists.txt @@ -118,7 +118,7 @@ else() endif() endif() -if( NOT "NVPTX" IN_LIST LLVM_TARGETS_TO_BUILD) +if( NOT "NVPTX" IN_LIST LLVM_TARGETS_TO_BUILD AND NOT EMSCRIPTEN) message(FATAL_ERROR "NVPTX backend is not activated\n" "Please enable it via -DLLVM_TARGETS_TO_BUILD=\"host;NVPTX\"") endif() diff --git a/interpreter/cling/lib/Interpreter/IncrementalCUDADeviceCompiler.cpp b/interpreter/cling/lib/Interpreter/IncrementalCUDADeviceCompiler.cpp index a492add8a01fc..006ca8f582927 100644 --- a/interpreter/cling/lib/Interpreter/IncrementalCUDADeviceCompiler.cpp +++ b/interpreter/cling/lib/Interpreter/IncrementalCUDADeviceCompiler.cpp @@ -92,13 +92,13 @@ namespace cling { llvm::errs() << "Could not create PTX interpreter instance\n"; return; } - +#ifndef __EMSCRIPTEN__ // initialize NVPTX backend LLVMInitializeNVPTXTargetInfo(); LLVMInitializeNVPTXTarget(); LLVMInitializeNVPTXTargetMC(); LLVMInitializeNVPTXAsmPrinter(); - +#endif m_Init = true; }