CMake Daemon for user tools

I’ve been working for quite some time on a daemon mode for CMake in order to make it easier to build advanced tooling for CMake. I made a video about this today:

The general idea is that CMake is started as a long-running process, and can then be communicated with via a JSON protocol.

So, for example, a client sends a request like

{
  "type": "code_completion_at",
  "line": 50,
  "path": "/home/stephen/dev/src/cmake-browser/CMakeLists.txt",
  "column": 7
}

and the daemon responds with

{  
   "completion":{  
      "commands":[  
         "target_compile_definitions",
         "target_compile_features",
         "target_compile_options",
         "target_include_directories",
         "target_link_libraries",
         "target_sources"
      ],
      "matcher":"target_"
   }
}
Many more features are implemented such as semantic annotation, variable introspection, contextual help etc, all without the client having to implement it themselves.
Aside from the daemon, I implemented a Qt client making use of all of the features, and a Kate plugin to use the debugging features in that editor. This is the subject of my talk at FOSDEM, which I previewed in Berlin last week.
Come to my talk there to learn more!

Tags: , , , , ,

14 Responses to “CMake Daemon for user tools”

  1. Taylor Braun-Jones Says:

    Awesome. I’ve been waiting for something like this for a long time! Do you have a link to a Qt Creator bug report for the task of integrating this work with Qt Creator?

  2. fntlnz Says:

    Very interesting where can I find more about this topic? Unfortunately I will not come at FOSDEM. If there will be any video of your talk available please let me know

  3. Links 26/1/2016: MPlayer 1.2.1, Parsix GNU/Linux 8.5 | Techrights Says:

    […] CMake Daemon for user tools […]

  4. zerothat Says:

    Very nice! I hope the CMake refactoring mentioned here http://article.gmane.org/gmane.comp.programming.tools.cmake.devel/15741 allows functionality like this to be integrated soon! I’m exploring cmake-daemon for purposes of C++ JIT in an IDE. Since I need link information I added to Source/cmServerProtocol.cxx ProcessTargetInfo():

    + auto link_info = tgt->GetLinkInformation(config);
    + root[“link_language”] = link_info->GetLinkLanguage();
    + Json::Value& out_link_libs = root[“link_libraries”] = Json::arrayValue;
    + auto link_libs = tgt->GetLinkImplementationLibraries(config);
    + for (auto const& it : link_libs->Libraries) out_link_libs.append(it);

    • steveire Says:

      Cool. I’ve made a note to add something like that to the cmake-daemon. Do you want to collaborate more on it on github?

  5. CMake support in Visual Studio | Techno Mega News | Dailay IT News Updates Says:

    […] first initiative, in the CMake community, was the CMake-server prototype developed initially by Stephen Kelly to improve the tooling story for CMake. This started some […]

  6. CMake support in Qt Creator (and elsewhere?) - Qt Blog Says:

    […] The Qt Creator team has had contact with the CMake communinity for a long time now and was actively involved in discussions with CMake and other IDE and tools vendors. After many discussions the CMake community decided that the best way forward to support the use-cases of IDEs was to add a new interactive way to interact with CMake, the so called server-mode. There was some initial development started by Stephen Kelly, who made an impressive prototype. […]

  7. Tarmo Pikaro Says:

    Hi !

    I have now started to develop alternative to cmake, project called syncproj. Here is a documentation in case if you’re interested:

    https://docs.google.com/document/d/1C1YrbFUVpTBXajbtrC62aXru2om6dy5rClyknBj5zHU/edit

    Main advantage over cmake is that it’s based upon C#, and can be executed as C# script. So you can debug project building if you want.

    Also first time migration (project to .cs) is also supported, and after that you can simply mimic what is written in .cs script.

  8. Joseph Garnier Says:

    Hi,
    Is it a way to download your Qt client ?

    Thank you,

  9. CMake support in Visual Studio | C++ Team Blog | C.C.狂熱團 Says:

    […] first initiative, in the CMake community, was the CMake-server prototype developed initially by Stephen Kelly to improve the tooling story for CMake. This started some […]

  10. How To Trace CMakeLists.txt - Programming Questions And Solutions Blog Says:

    […] there are the steveire’s CMake Daemon Tools. I haven’t used them myself, but they claim to offer possibilities for introspection that seem to […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s


%d bloggers like this: