[Qt-creator] Generating QtCreator cmake project for given CMakeLists.txt from command line

Nikolaus Demmel nikolaus at nikolaus-demmel.de
Thu Mar 31 09:59:59 CEST 2016


Hi Tobias,

thanks for trying it out.

I think I made the wrong impression of what feature I am actually asking. It should be much simpler. :-)

The catkin_tools workflow is currently supported quite well with qtcreator, given that catkin_tools creates more-or-less standard cmake build directories, one for each ROS package. So go ahead in your new ROS workspace after calling `catkin build`, open the CMakeLists.txt of one of the ROS packages in QtCreator as a project, then select one configuration and point the build directory to <ros-ws>/build/<ros-pkg-name>. Now you can call make from within QtCreator, rerun cmake, have code completion, click on warnings to get to the source location, use the debugger, etc. That is all great.

The step that is inconvenient, which I was asking about in this thread, is the fact that for each ROS package, you have to manually select the correct build directory and Kit when opening the project. Since there can be many ROS packages in a workspace (>100), it gets cumbersome. That’s why I am looking for a way to generate the project file (CMakeLists.txt.user) from command line without user interaction. I want to be able to specify the build directory(s), and also the configuration(s)/Kit(s). For the latter it would be great if there was a “environment Kit”, which selects compiler/qmake/cmake in the same way that cmake would on the command line (in fact cmake has already been run from the initial `catkin build` call, so QtCreator could just ask cmake what compiler it configured, which would maybe be a sort of “cmake Kit”, where you let cmake run in the current environment determine the compiler).

Of course one could also think about integrating catkin_tools itself better into QtCreator (which is I think what you were talking about), but that is a completely different story and to me catkin_tools is so great from the command line, that I am happy continue using it there in conjunction with editing code in an IDE.

Best,
Nikolaus


On 30.03.2016, at 10:52, Tobias Hunger <tobias.hunger at gmail.com> wrote:

> Hi Nikolaus,
> 
> Thanks for the instructions! I just managed to do a successful catkin
> build (outside of Qt Creator for now:-)
> 
> My first impression is that it will be tricky to fully integrate the
> catkin_tools workflow, even simple things like figuring out how to map
> source and build directories or even find the full path to files that
> compiler warnings are about. I will need to poke around a bit before I
> dare to make suggestions on how to support this though.
> 
> Best Regards,
> Tobias
> 
> On Tue, Mar 29, 2016 at 4:06 AM, Nikolaus Demmel
> <nikolaus at nikolaus-demmel.de> wrote:
>> Hi Tobias,
>> 
>> thanks for your reply.
>> 
>>> do you have an easy to follow guide to set up some demo project for ROS? I
>>> have been trying to test ROS projects for a while now, but so far failed
>>> most of the time with setting up everything so that I could build some
>>> not-too-simple project that I can test Qt Creator and ROS together.
>> 
>> I never used Arch Linux before, but I came up with this tutorial that should get you started with a catkin workspace of 77 ros-core packages from source: https://gist.github.com/NikolausDemmel/aeea157e00b2520aedee
>> 
>> Note that if you just want to test catkin itself, there is actually no need to install all the ROS packages. You just would need a few of the python dependencies, and then create a workspace with catkin and some test packages. But you wanted a not-too-simple setup, so here you go :-).
>> 
>> It is maybe worth reiterating that I am talking about the catkin_tools workflow. There is also catkin_make, which has a different approach in that it adds a top-level CMakeLists.txt to your workspace and builds all packages in one giant CMake project. This makes QtCreator integration easier, since there is just one project to import with one build directory. But the catkin-tools workflow has many advantages and is meant to eventually replace catkin_make as the default workflow: https://github.com/catkin/catkin_tools/issues/90
>> 
>>> I did fix some bugs with ROS and Qt Creator already, but so far have not
>>> had the opportunity to test the whole workflow myself.
>> 
>> Yeah I noticed things getting smoother over time. Thanks! With 3.6.1 I actually sill have an issue where `include_directories` is not properly propagated to the code-model such that QtCreator does not find include files. This is in conjunction with catkin. But I haven’t had that issue in 4.0 yet, so I stopped to investigate.
>> 
>> Cheers,
>> Niko
>> 
>> P.S.: For your reference, there seem to also be people wanting a feature like this outside of ROS: http://stackoverflow.com/q/3898763/1813258
>> 




More information about the Qt-creator mailing list