Skip to content
This repository was archived by the owner on Jun 25, 2020. It is now read-only.

Commit e1e18a4

Browse files
committed
Adds support for OpenCL source-files
1 parent 2a9c54e commit e1e18a4

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

src/compile_commands.cc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,14 @@ std::vector<std::string> CompileCommands::get_arguments(const boost::filesystem:
147147
arguments.emplace_back("cuda_runtime.h");
148148
}
149149

150+
if(extension==".cl") {
151+
arguments.emplace_back("-xcl");
152+
arguments.emplace_back("-cl-std=CL2.0");
153+
arguments.emplace_back("-Xclang");
154+
arguments.emplace_back("-finclude-default-header");
155+
arguments.emplace_back("-Wno-gcc-compat");
156+
}
157+
150158
if(!build_path.empty()) {
151159
arguments.emplace_back("-working-directory");
152160
arguments.emplace_back(build_path.string());

src/source.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ Glib::RefPtr<Gsv::Language> Source::guess_language(const boost::filesystem::path
7070
else
7171
language=language_manager->get_language("cpp");
7272
}
73+
else if(language->get_id()=="opencl") {
74+
language = language_manager->get_language("cpp");
75+
}
7376
return language;
7477
}
7578

src/usages_clang.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,8 @@ bool Usages::Clang::is_source(const boost::filesystem::path &path) {
561561
auto ext = path.extension();
562562
if(ext == ".c" || // c sources
563563
ext == ".cpp" || ext == ".cxx" || ext == ".cc" || ext == ".C" || ext == ".c++" || // c++ sources
564-
ext == ".cu") // CUDA sources
564+
ext == ".cu" || // CUDA sources
565+
ext == ".cl") // OpenCL sources
565566
return true;
566567
else
567568
return false;

0 commit comments

Comments
 (0)