Skip to content

Commit

Permalink
Fix cling incorrect LLVM path for external LLVM+clang
Browse files Browse the repository at this point in the history
  • Loading branch information
maksgraczyk authored and jenkins committed Jul 20, 2023
1 parent c157468 commit 01ff272
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
8 changes: 6 additions & 2 deletions include/cling/Interpreter/Interpreter.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
#ifndef CLING_INTERPRETER_H
#define CLING_INTERPRETER_H

#ifndef LLVM_PATH
#define LLVM_PATH nullptr
#endif

#include "cling/Interpreter/InvocationOptions.h"
#include "cling/Interpreter/RuntimeOptions.h"

Expand Down Expand Up @@ -357,7 +361,7 @@ namespace cling {
///\param[in] extraLibHandle - resolve symbols also from this dylib
///\param[in] noRuntime - flag to control the presence of runtime universe
///
Interpreter(int argc, const char* const* argv, const char* llvmdir = nullptr,
Interpreter(int argc, const char* const* argv, const char* llvmdir = LLVM_PATH,
const ModuleFileExtensions& moduleExtensions = {},
void *extraLibHandle = nullptr, bool noRuntime = false)
: Interpreter(argc, argv, llvmdir, moduleExtensions, extraLibHandle,
Expand All @@ -374,7 +378,7 @@ namespace cling {
///\param[in] noRuntime - flag to control the presence of runtime universe
///
Interpreter(const Interpreter& parentInterpreter, int argc,
const char* const* argv, const char* llvmdir = nullptr,
const char* const* argv, const char* llvmdir = LLVM_PATH,
const ModuleFileExtensions& moduleExtensions = {},
void *extraLibHandle = nullptr, bool noRuntime = true);

Expand Down
6 changes: 6 additions & 0 deletions lib/Interpreter/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -374,3 +374,9 @@ if ((NOT builtin_llvm) AND builtin_clang)
list(INSERT P 0 ${FixInclude})
set_property(SOURCE TransactionUnloader.cpp PROPERTY INCLUDE_DIRECTORIES "${P}")
endif()

# If both LLVM and Clang are external, we need to define LLVM_PATH in order for
# cling to use the correct (external) LLVM/Clang directories.
if ((NOT builtin_llvm) AND (NOT builtin_clang))
target_compile_definitions(clingInterpreter PUBLIC "LLVM_PATH=\"${LLVM_BINARY_DIR}\"")
endif()

0 comments on commit 01ff272

Please sign in to comment.