Skip to content

Making some major changes #296

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: docking_inter
Choose a base branch
from

Conversation

DuilioPerez
Copy link

These are some major changes done:

  1. Updated CMakeLists.txt to make it easy to maintain and to use. It adds the ability to compiile theibrary with the selected backends. At the same time, makes cimgui being findable by another CMake based project and install the shared and static version of the library in their corresponding location.
  2. Updated the CMakeLists.txt in the test directory to link agains the shared library.
  3. Updated cimgui.h, cimgui.cpp, cimgui_impl.h and cimgui_impl.cpp to include almost all backends.
    These are some remarks.
  4. DirectX 12 and WebGPU was not include due a generation error. However, it is available in the root directory CMake file.
  5. To add a new or modify any existing backend, just add an conditional or modify the include/link flags
  6. You can specify as variables the full and compatibility version of the library. This makes easy to update the version.

@sonoro1234 sonoro1234 assigned sonoro1234 and unassigned sonoro1234 Apr 18, 2025
@DuilioPerez
Copy link
Author

With some minor, this modifications can work with DearImGui, not only cimgui

@sonoro1234
Copy link
Contributor

If you run generate, most of your work will be lost!!!

@DuilioPerez
Copy link
Author

I don't understand what do you mean. If is related to cmake, then there isn't any modification to source code. I've tested from Android and there aren't errors:

~/cimgui $ cmake -S . -B build -DCIMGUI_BACKEND_SDL3=ON -DCIMGUI_BACKEND_SDLRENDERER3=ON -DCMAKE_INSTALL_PREFIX=$PREFIX
-- The C compiler identification is Clang 20.1.3
-- The CXX compiler identification is Clang 20.1.3
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /data/data/com.termux/files/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /data/data/com.termux/files/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done (4.6s)
-- Generating done (0.1s)
-- Build files have been written to: /data/data/com.termux/files/home/cimgui/build
~/cimgui $ cd build/
~/cimgui/build $ make install
[  5%] Building CXX object CMakeFiles/cimgui-Shared.dir/cimgui.cpp.o
[ 10%] Building CXX object CMakeFiles/cimgui-Shared.dir/cimgui_impl.cpp.o
[ 15%] Building CXX object CMakeFiles/cimgui-Shared.dir/imgui/imgui.cpp.o
[ 20%] Building CXX object CMakeFiles/cimgui-Shared.dir/imgui/imgui_demo.cpp.o
[ 25%] Building CXX object CMakeFiles/cimgui-Shared.dir/imgui/imgui_draw.cpp.o
[ 30%] Building CXX object CMakeFiles/cimgui-Shared.dir/imgui/imgui_tables.cpp.o
[ 35%] Building CXX object CMakeFiles/cimgui-Shared.dir/imgui/imgui_widgets.cpp.o
[ 40%] Building CXX object CMakeFiles/cimgui-Shared.dir/imgui/backends/imgui_impl_sdl3.cpp.o
[ 45%] Building CXX object CMakeFiles/cimgui-Shared.dir/imgui/backends/imgui_impl_sdlrenderer3.cpp.o
[ 50%] Linking CXX shared library libcimgui.so
[ 50%] Built target cimgui-Shared                                                                             [ 55%] Building CXX object CMakeFiles/cimgui-Static.dir/cimgui.cpp.o
[ 60%] Building CXX object CMakeFiles/cimgui-Static.dir/cimgui_impl.cpp.o                                     [ 65%] Building CXX object CMakeFiles/cimgui-Static.dir/imgui/imgui.cpp.o                                     [ 70%] Building CXX object CMakeFiles/cimgui-Static.dir/imgui/imgui_demo.cpp.o                                [ 75%] Building CXX object CMakeFiles/cimgui-Static.dir/imgui/imgui_draw.cpp.o
[ 80%] Building CXX object CMakeFiles/cimgui-Static.dir/imgui/imgui_tables.cpp.o                              [ 85%] Building CXX object CMakeFiles/cimgui-Static.dir/imgui/imgui_widgets.cpp.o                             [ 90%] Building CXX object CMakeFiles/cimgui-Static.dir/imgui/backends/imgui_impl_sdl3.cpp.o                  [ 95%] Building CXX object CMakeFiles/cimgui-Static.dir/imgui/backends/imgui_impl_sdlrenderer3.cpp.o
[100%] Linking CXX static library libcimgui.a
[100%] Built target cimgui-Static
Install the project...
-- Install configuration: "RelWithDebInfo"
-- Installing: /data/data/com.termux/files/usr/lib/libcimgui.so.1.91.9
-- Up-to-date: /data/data/com.termux/files/usr/lib/libcimgui.so.1
-- Up-to-date: /data/data/com.termux/files/usr/lib/libcimgui.so
-- Installing: /data/data/com.termux/files/usr/include/cimgui.h
-- Installing: /data/data/com.termux/files/usr/include/cimgui_impl.h
-- Installing: /data/data/com.termux/files/usr/lib/libcimgui.a
-- Old export file "/data/data/com.termux/files/usr/share/cimguiConfig/cmake/cimguiConfig.cmake" will be replaced.  Removing files [/data/data/com.termux/files/usr/share/cimguiConfig/cmake/cimguiConfig-relwithdebinfo.cmake].
-- Installing: /data/data/com.termux/files/usr/share/cimguiConfig/cmake/cimguiConfig.cmake
-- Installing: /data/data/com.termux/files/usr/share/cimguiConfig/cmake/cimguiConfig-relwithdebinfo.cmake
~/cimgui/build $

If is about generation of the header cimgui.h and cimgui_impl.h, then they was generated once, and the cmake doesn't generate again.

If you mean about GitHub Actions, then the workflow needs a small modification to generate all the backends in the cimgui.h and cimgui_impl.h. As far as I've tested, it can generate all of the except WebGPU and DirectX12

@sonoro1234
Copy link
Contributor

If is about generation of the header cimgui.h and cimgui_impl.h, then they was generated once,

Every time imgui is updated generate must be run again

@DuilioPerez
Copy link
Author

Now I've added some other changes like a pkg-config file and the option to target for Emscripten. If GitHub Actions rewrite some of my work with the cimgui.h, cimgui.c, cimgui_impl.h and cimgui_impl.c there is no problem. I've made a small change to GitHub workflow that will autogenerate the code for almost all the backends. The only backends that were not added was wgpu and dx12 that halt in the generation with error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants