Skip to content

Commit

Permalink
Added target_compile_definitions for XEUS_SEARCH_PATH
Browse files Browse the repository at this point in the history
  • Loading branch information
guptamukund22 committed Jan 28, 2025
1 parent ba37f4f commit 383efd6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,8 @@ macro(xeus_cpp_create_target target_name linkage output_name)
target_link_libraries(${target_name} PRIVATE ${CMAKE_THREAD_LIBS_INIT})
endif()

target_compile_definitions(${target_name} PRIVATE "XEUS_SEARCH_PATH=\"$<JOIN:$<TARGET_PROPERTY:${target_name},INCLUDE_DIRECTORIES>,:>\"")

endmacro()

# xeus-cpp-headers
Expand Down
13 changes: 13 additions & 0 deletions src/xinterpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,19 @@ void* createInterpreter(const Args &ExtraArgs = {}) {
ClangArgs.push_back(CxxInclude.c_str());
}
#endif

#ifdef XEUS_SEARCH_PATH
std::string search_path = XEUS_SEARCH_PATH;
std::istringstream iss(search_path);
std::string path;
while (std::getline(iss, path, ':')) {
if (!path.empty()) {
ClangArgs.push_back("-I");
ClangArgs.push_back(path.c_str());
}
}
#endif

ClangArgs.insert(ClangArgs.end(), ExtraArgs.begin(), ExtraArgs.end());
// FIXME: We should process the kernel input options and conditionally pass
// the gpu args here.
Expand Down

0 comments on commit 383efd6

Please sign in to comment.