Generate build commands and run configurations in CLion

Answered

I have a custom build system for my C/C++ project at work that I'm trying to integrate with a plugin for CLion.

Currently I'm generating with a script the different files that can be used to generate both the custom build target and run configuration (customTargets.xml, External Tools.xml and so forth) but I wanted to integrate it all in a custom plugin.

Is that possible? At what classes, interfaces and/or extension points should I be looking?

Also, as a bonus, is it possible to not use a compilation database and provide the compilation information directly to the CLion engine? Or having a compilation database is unavoidable?

 

Thank you

0
2 comments

Thank you for the question. It is possible, though it's a slightly challenging process. Suppose you want to tell CLion information about how your files are compiled, which compilation flags are used, and other things to make code insight work correctly. In that case, the entry point is OCWorkspace.getModifiableModel. Then, once you define your key, you can manipulate the model's configurations and set language options for them, and so on. However, this has almost nothing in common with the build process. The entry point there should be your Run Configuration type, inherited from CLionRunConfiguration; as a part, you'll need to define your own BuildConfiguration and BuildTargets. Then another important point is your implementation of CidrProjectTaskRunner, which should return your implementation of CidrTaskRunner, which by itself is the main runner that should execute the build for your target/project. The last but not the least important item is your implementation of CidrProjectOpenProcessor; this should be an entry point to trigger any activities expected from your build system once the project is opened.

0

Thank you for your answer, I will take a look at those entry points.

Is it recommended to also take a look at externalSystemManager and the related entry points or is not strictly necessary in order to have custom run and/or build configurations?

0

Please sign in to leave a comment.