Add #ifndef IMGUI_DISABLE to all the backends #6601

Closed
opened 2023-07-13 07:21:36 +00:00 by yosoymin · 3 comments
yosoymin commented 2023-07-13 07:21:36 +00:00 (Migrated from github.com)

Version: all
Branch: all

Back-ends: all
Operating System: all

I'm disabling imgui by configuration, because I don't want to distribute my application with imgui. I'm using imgui for internal tools, so the Distribution build defines IMGUI_DISABLE, but I have to modify some backends in order to avoid compilation errors when compiling that configuration. I've tried ignoring the files in cmake with expressions like this:

set_source_files_properties(${backendSourceList} PROPERTIES HEADER_FILE_ONLY $<IF:$<CONFIG:Distribution>,TRUE,FALSE>)

but set_source_files_properties doesn't allow generator expressions. So at the end I have to add #ifndef IMGUI_DISABLE manually to the backends I use. This is an inconvenience when I want to update imgui library.

If anyone knows another way to achiveve this, please let me know.
Thanks.

Version: all Branch: all Back-ends: all Operating System: all I'm disabling imgui by configuration, because I don't want to distribute my application with imgui. I'm using imgui for internal tools, so the Distribution build defines IMGUI_DISABLE, but I have to modify some backends in order to avoid compilation errors when compiling that configuration. I've tried ignoring the files in cmake with expressions like this: `set_source_files_properties(${backendSourceList} PROPERTIES HEADER_FILE_ONLY $<IF:$<CONFIG:Distribution>,TRUE,FALSE>)` but set_source_files_properties doesn't allow generator expressions. So at the end I have to add `#ifndef IMGUI_DISABLE` manually to the backends I use. This is an inconvenience when I want to update imgui library. If anyone knows another way to achiveve this, please let me know. Thanks.
ocornut commented 2023-07-13 08:19:47 +00:00 (Migrated from github.com)

Hello,
I am pretty sure this is something you can solve with your build system and that cmake can do this.
However for sake of completeness I don’t mind adding support for this in the backends.

Hello, I am pretty sure this is something you can solve with your build system and that cmake can do this. However for sake of completeness I don’t mind adding support for this in the backends.
GamingMinds-DanielC commented 2023-07-13 08:56:17 +00:00 (Migrated from github.com)

Easy fix:
You can exclude the backend sources from the build without modifying them. If you want to control this with defines, you can just not add them to the project and instead include them in a redirector like this:

// imgui_impl_custom_redirect.cpp
#ifndef IMGUI_DISABLE
#include "imgui_impl_any_backend.cpp"
#endif
Easy fix: You can exclude the backend sources from the build without modifying them. If you want to control this with defines, you can just not add them to the project and instead include them in a redirector like this: ```c++ // imgui_impl_custom_redirect.cpp #ifndef IMGUI_DISABLE #include "imgui_impl_any_backend.cpp" #endif ```
ocornut commented 2023-07-13 09:28:15 +00:00 (Migrated from github.com)

Modified all backends to support this: 33e13c8

Modified all backends to support this: 33e13c8
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ocornut/imgui#6601
No description provided.