'OpenCL syntax highlighting in CLion
Does anyone have a solution for syntax highlighting of OpenCL code for CLion? I am placing the OpenCL source code in a file with the extension .cl and would like to have syntax highlighting for such files.
Solution 1:[1]
In CLion you can add .cl files as custom file types and manually provide the list of OpenCL C keywords for syntax highlighting.
There is an alternative to loading the OpenCL C code from a .cl file at runtime: Embedding it right within C++, such as used in this OpenCL-Wrapper. While naive string literals would destroy syntax highlighting, there is a way to retain syntax highlighting with the
#define R(...) std::string(" "#__VA_ARGS__" ")
stringification macro and by using #defines for all the OpenCL C functions and keywords.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | ProjectPhysX |
