Plugin: CMake

Discussion about CodeLite development process and patches
NTSFka
CodeLite Enthusiast
Posts: 10
Joined: Sat Nov 30, 2013 12:57 pm
Genuine User: Yes
IDE Question: C++
Location: Czech Republic
Contact:

Plugin: CMake

Post by NTSFka »

Hi,

I'm working on CMake plugin that adds ability to build project by CMake.

Current source code is availabe on GitHub: https://github.com/NTSFka/CMakePlugin

The plugin is not finished yet. The building system is not integrated into Codelite's because I'm not sure what is the best solution to do it. For now the only way to build project with CMake enabled is by menu in the workspace tree. I'd like to integrate into Codelite's building system but I didn't find solution that suits the CMake build system best.

Any ideas that can improve the plugin are welcomed ;)

I've created a patch that adds an option to add custom plugins as a cmake's parameter:
https://github.com/NTSFka/CMakePlugin/b ... gins.patch
User avatar
eranif
CodeLite Plugin
Posts: 6372
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Plugin: CMake

Post by eranif »

Hi,

This is a great news and It was actually on my TODO list :D

Some comments:

If you plan on submitting this plugin to codelite in the future then the following must be changed:
- The compiler requirements is not acceptable (codelite is built on many distros / old Mac etc) so requiring a C++11 compiler is not possible
- UI should be created using wxCrafter designer, otherwise, maintaining the code is a bitch ;)
- I suggest that you follow the QMake plugin soruce code for an example of how to integrate CMake into the build system

The timing could not be better:
- I am in the process of adding new event to codelite's plugin system: clBuildEvent (hopefully I will commit it today)
- Various event types will be submitting the new event class (the documentation on plugin.h will also be updated to reflect the change)

EDIT:
My changes are committed, looking at your code - you will need to update it to use the new clBuildEvent class

Eran
Make sure you have read the HOW TO POST thread
NTSFka
CodeLite Enthusiast
Posts: 10
Joined: Sat Nov 30, 2013 12:57 pm
Genuine User: Yes
IDE Question: C++
Location: Czech Republic
Contact:

Re: Plugin: CMake

Post by NTSFka »

Well:
  • Ok, now should require only C++98/03 compiler.
  • I know, but I don't like some output that generate those tools (nothing against wxCrafter). If someone else want to modify it, it can have problem with that. I will rewrite that.
  • Yeah, the QMake plugin is always good inspiration for this plugin.
The plugin doesn't use Codelite's building system so it works even with current changes. The code, you mean, is unused now (old experimental code). I'll try to modify plugin with clBuildEvent. The main reason why it's not integrated yet is I had different view how to build the whole workspace.

Have this plugin as a part of Codelite will be nice, but it's not about what I want or plan. It's about what do you allow ;)
User avatar
eranif
CodeLite Plugin
Posts: 6372
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Plugin: CMake

Post by eranif »

NTSFka wrote:The plugin doesn't use Codelite's building system so it works even with current changes
I am not sure I understand this. codelite uses a CMake under Linux / Mac so it should be easy adding it. As a general rule, just make sure it compiles on one platform - I will take care of making it compile on the rest
NTSFka wrote:I know, but I don't like some output that generate those tools (nothing against wxCrafter)
Its not about the output. Making UI using a tool (it used to be wxFormBuilder, and recently we moved to wxCrafter) makes it easy to maintain and change UI quickly without damaging the logic (both tools separate the UI from the logic)
NTSFka wrote:I will rewrite that.
Thanks
NTSFka wrote:Have this plugin as a part of Codelite will be nice, but it's not about what I want or plan. It's about what do you allow
Usually, when a plugin is well written and is useful, it makes it into codelite ( see: git plugin, db-explorer, Zoom Navigator )

EDIT:
You can also read this document:
http://codelite.org/Developers/CodingGuidelines

Eran
Make sure you have read the HOW TO POST thread
NTSFka
CodeLite Enthusiast
Posts: 10
Joined: Sat Nov 30, 2013 12:57 pm
Genuine User: Yes
IDE Question: C++
Location: Czech Republic
Contact:

Re: Plugin: CMake

Post by NTSFka »

eranif wrote:
NTSFka wrote:The plugin doesn't use Codelite's building system so it works even with current changes
I am not sure I understand this. codelite uses a CMake under Linux / Mac so it should be easy adding it. As a general rule, just make sure it compiles on one platform - I will take care of making it compile on the rest
Sorry, I mean how the plugin build user projects, not how is the plugin built. The plugin itself can be compiled on Linux (CMake) and Windows (I hope).
eranif wrote:
NTSFka wrote:I know, but I don't like some output that generate those tools (nothing against wxCrafter)
Its not about the output. Making UI using a tool (it used to be wxFormBuilder, and recently we moved to wxCrafter) makes it easy to maintain and change UI quickly without damaging the logic (both tools separate the UI from the logic)
I undestand and agree with that.
eranif wrote:
NTSFka wrote:Have this plugin as a part of Codelite will be nice, but it's not about what I want or plan. It's about what do you allow
Usually, when a plugin is well written and is useful, it makes it into codelite ( see: git plugin, db-explorer, Zoom Navigator )
Ok, I hope this plugin will be too.
eranif wrote: EDIT:
You can also read this document:
http://codelite.org/Developers/CodingGuidelines
I haven't notice that, thanks (ah, it doesn't exists before).

Jiri
User avatar
eranif
CodeLite Plugin
Posts: 6372
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Plugin: CMake

Post by eranif »

Hi,

I am working on adding support for cmake to generate codelite's project files. Its currently in the "stage" branch waiting for review by cmake developer once its done - it will be added cmake
So next cmake release will have a codelite generator;

http://cmake.org/gitweb?p=stage/cmake.g ... -generator

Eran
Make sure you have read the HOW TO POST thread
NTSFka
CodeLite Enthusiast
Posts: 10
Joined: Sat Nov 30, 2013 12:57 pm
Genuine User: Yes
IDE Question: C++
Location: Czech Republic
Contact:

Re: Plugin: CMake

Post by NTSFka »

Hi,

Nice. I'll test it and add a feature to import CMake projects into the plugin.

I think, the current version of the plugin is very usable now. Only thing I want to change is the CMake help -- move it into dockable window so it can be used while editing CMakeFiles.txt. And testing...

Jiri
User avatar
eranif
CodeLite Plugin
Posts: 6372
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Plugin: CMake

Post by eranif »

Hi,

I just built and tried the plugin on Windows
The first thing I did was "Plugins -> CMake -> Help..."
It took near 1 minutes until the "Loading CMake Help" message disappeared, while in the meanwhile I got CMD shell poping and closing fast :D
I decided the wait and see if it ends ... and it did after a minute

The result however, was very impressive (the Help Dialog) with all CMake commands and options

I will look into the sources and see how this can be optimized for Windows

Eran
Make sure you have read the HOW TO POST thread
User avatar
eranif
CodeLite Plugin
Posts: 6372
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Plugin: CMake

Post by eranif »

Update:

I added CMakePlugin to codelite source tree
I also did the following changes:

- The help content is now being loaded using a background thread instead of using the main thread and blocking the UI (on Windows, it can take a long time until the UI is "released")
- Minor update to the Help Dialog (changed the wxSplitterWindow flags, since it looks bad on Windows )

But the main change was adding the new thread to load and notify the main thread when it has finished loading the help content (I also added 2 messages to the Status Bar to notify when the load has completed)
I have tested the plugin on CMake's source tree using the generated codelite's project files (using my new CMake generator) and it worked without a problem

There are still some tooltips missing in CMake's tab (especially in the large text box)
Tomorrow hopefully, I will find some time and I will write a help page for this plugin on codelite's wiki

Thanks,
Eran
Make sure you have read the HOW TO POST thread
NTSFka
CodeLite Enthusiast
Posts: 10
Joined: Sat Nov 30, 2013 12:57 pm
Genuine User: Yes
IDE Question: C++
Location: Czech Republic
Contact:

Re: Plugin: CMake

Post by NTSFka »

Well,

I moved the CMake Help to dockable window and "Plugins -> CMake -> Help" is no more :mrgreen: . I didn't expected you will be so fast.

I know the initial loading was slow but my plan is to move it so I didn't care at the moment. The version with dockable window loads the data from sqlite database and that must be created by user -- there is a button for that. It still blocks the whole UI but with your changes in older version there is no problem to use separate thread as well. My plan is use a wxGauge on top (maybe on bottom).

Add tooltips is not a problem.

If you want, I can create Czech translation for the plugin.

Jiri
Post Reply