Search code examples
clion

How can I get imgui up and running on linux and clion


Disclaimer: I'm a jvm user, I know barely enough just to set a native program via cmake

I'd like to get the imgui glfw-opengl3 example running under Ubuntu (19.10)

In Windows is pretty easy, there is already a vs project file

But on Linux I have no idea how to continue.

Trying to use CLion, I followed this guide:

  • create a compilation db

  • installed the Makefile plugin

  • and opened the file in CLion

now, how/what shall I do to have a (debug) configuration?

Edit: there is now also a CMakeLists.txt, for those who are interested


Solution

  • Let's start from scratch.

    After generating compile_commands.json with bear for exmaple (Just run bear make) I've opened compile_commands.json as a project in CLion.

    Then you need to create a custom build target. Click on Add Configuration in the toolbar and find Custom Build Application Add Configuration

    Then click on Configure Custom Build Targets link and add a new target (example_glfw_opengl3 in my case). As for build I use external task with the next parameter:

    • program: make
    • arguments: all
    • Working directory: $ContentRoot$

    Pretty similar for clean:

    • program: make
    • arguments: clean
    • Working directory: $ContentRoot$

    Then you need to build executable via CLion menu Build | Build Project. Now you can specify the executable in the Custom build Application run configuration menu. That's it. Now you can Run/Debug your app.