0

I would like to use ImGui within a toy app that I have created (a raytracer). Since ImGui does not provide a simple library that can be easily consumed I have to jump through hoops to get it to work.

To avoid polluting my own CMakeFile.txt I thought I would pull the code and run the installer and move on with my life. But it doesn't work like that. To keep I things tidy I decided that instead of filling my CMake files and git repo up with noise that has nothing to do with raytracing I decided to download ImGui in the Dockerfile, have the ignore file ignore ext/imgui folder so it is never checked in, compile it to a static library and then just consume it.

The Dockerfile was created with VSCode, so it is located within .devcontainer alongside devcontainer.json. Into the Dockerfile I added the following lines

# get dear imgui
RUN mkdir -p ext/imgui
RUN git clone https://github.com/ocornut/imgui.git ext/imgui

which according to the terminal at start up did work as it is cached:

=> CACHED [dev_container_auto_added_stage_label 2/4] RUN mkdir -p ext/im  0.0s
=> CACHED [dev_container_auto_added_stage_label 3/4] RUN git clone https  0.0s
=> CACHED [dev_container_auto_added_stage_label 4/4] RUN apt-get update   0.0s

However the folder and files are not visible within folder structure of the app.

I tried putting the git clone as a CMD and making it the last line of the Dockerfile but this time there was no recognisable (ie no clone occurred) output in the terminal log.

Where are my ImGui files? What is the correct way of doing this?

My thoughts were, once I had confirmed that the folder and files were visible I would compile ImGui to a static lib and copy it a lib folder along with the headers in my tree and consume it like any other library.

Update: I have moved on from here, forking giladreich/cmake-imgui and adding the required backend for glfw-vulkan. However I still need the compilation and build to occur when creating the container.

graham.reeds
  • 16,230
  • 17
  • 74
  • 137

0 Answers0