Skip to content
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

imgui: make backends available as optional components #25325

Open
wants to merge 21 commits into
base: master
Choose a base branch
from

Conversation

valgur
Copy link
Contributor

@valgur valgur commented Sep 19, 2024

Summary

Changes to recipe: imgui/[*]

Motivation

There are two major issues with the current approach of building only the core imgui.cpp and no backends or other optional components:

  • Difficult to use. The consuming projects will need to inject the <package_folder>/res/... source files into the build system in order to use the optional components. This is manageable but very inconvenient compared to the alternative of linking against a suitable component target.
  • Tends to break shared builds. Imgui uses a IMGUI_API export macro for shared builds and visibility handling. The users need to take care that the core library symbols provided by the imgui recipe and the optional components built by the consuming projects have the correct IMGUI_API corresponding the static/shared build of either project. This is tricky to manage and easy to mess up.

In addition to that, the current recipe does not provide a way to modify imconfig.h. These values cannot be changed after the core library has already been built.

Another minor benefit is that the Conan and system dependencies for the optional components are handled by package_info() in the imgui recipe and don't need to be duplicated in the consuming projects.

Details

The PR aims to be backwards-compatible. imgui::imgui CMake target still links against the core library only. All backends can be disabled altogether by setting build_backends=False for the old behavior.

These changes are not without their downsides:

  • Significantly more complex recipe. Imgui famously not providing any kind of build system outside of examples does not help in this regard.
  • Potential for option conflicts. The CCI recipe will likely need to build with most if not all backends enabled (or at the very least OpenGL and Vulkan ones) to avoid conflicts on CCI itself.
  • Recipes listing imgui::imgui as a cpp_info.requires either explicitly or implicitly no longer link against just the core lib but against all the optional components as well.

Given these downsides, I was initially hesitant to open this PR and shelved it for a while, but after hitting a wall in the Ogre PR (#21073) when trying to unvendor ImGui there, this PR started to look a lot more reasonable. That is, Ogre expects the optional Freetype component to be available and building it as part of the Ogre recipe hits the shared build issues listed above.

Test build with nearly all options enabled (only DirectX 11 and DirectX 12 disabled): #25325 (comment)


@conan-center-bot conan-center-bot added Failed Missing dependencies Build failed due missing dependencies in Conan Center labels Sep 19, 2024
@conan-center-bot

This comment has been minimized.

@AbrilRBS AbrilRBS self-assigned this Sep 19, 2024
@conan-center-bot conan-center-bot removed the Missing dependencies Build failed due missing dependencies in Conan Center label Sep 23, 2024
@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@valgur valgur force-pushed the feature/imgui-refacto branch 2 times, most recently from 4e686f8 to c44ea09 Compare September 23, 2024 13:07
@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

Copy link
Contributor

Hooks produced the following warnings for commit 9f6b90e
imgui/1.86@#f71b2c36f40b6b38a05c882e11fe20bf
post_package(): WARN: [APPLE RELOCATABLE SHARED LIBS (KB-H077)] install_name dir of these shared libs is not @rpath: libimgui-osx.dylib, libimgui-metal.dylib
imgui/1.85@#5b7ab2f3ec1b8f0fe42e0d230d1d99a7
post_package(): WARN: [APPLE RELOCATABLE SHARED LIBS (KB-H077)] install_name dir of these shared libs is not @rpath: libimgui-osx.dylib, libimgui-metal.dylib

@conan-center-bot

This comment has been minimized.

@conan-center-bot
Copy link
Collaborator

Conan v1 pipeline ✔️

All green in build 26 (2b349e6adb18b2e97f86dfd761c468feb8c48a82):

  • imgui/1.91.2:
    Built 18 packages out of 22 (All logs)

  • imgui/1.90.9:
    Built 18 packages out of 22 (All logs)

  • imgui/1.91.0:
    Built 18 packages out of 22 (All logs)

  • imgui/1.90.9-docking:
    Built 18 packages out of 22 (All logs)

  • imgui/1.90.5-docking:
    Built 18 packages out of 22 (All logs)

  • imgui/1.91.2-docking:
    Built 18 packages out of 22 (All logs)

  • imgui/1.90.5:
    Built 18 packages out of 22 (All logs)

  • imgui/1.89.9-docking:
    Built 18 packages out of 22 (All logs)

  • imgui/1.88:
    Built 18 packages out of 22 (All logs)

  • imgui/1.90.6:
    Built 18 packages out of 22 (All logs)

  • imgui/1.90.6-docking:
    Built 18 packages out of 22 (All logs)

  • imgui/1.87:
    Built 18 packages out of 22 (All logs)

  • imgui/1.89.9:
    Built 18 packages out of 22 (All logs)

  • imgui/1.86:
    All packages built successfully! (All logs)

  • imgui/1.90.7-docking:
    Built 18 packages out of 22 (All logs)

  • imgui/1.90.8-docking:
    Built 18 packages out of 22 (All logs)

  • imgui/1.85:
    All packages built successfully! (All logs)

  • imgui/1.90.7:
    Built 18 packages out of 22 (All logs)

  • imgui/1.90.8:
    Built 18 packages out of 22 (All logs)

  • imgui/1.91.0-docking:
    Built 18 packages out of 22 (All logs)


Conan v2 pipeline ✔️

Note: Conan v2 builds are now mandatory. Please read our discussion about it.

All green in build 26 (2b349e6adb18b2e97f86dfd761c468feb8c48a82):

  • imgui/1.91.2:
    Built 6 packages out of 10 (All logs)

  • imgui/1.91.2-docking:
    Built 6 packages out of 10 (All logs)

  • imgui/1.90.5:
    Built 6 packages out of 10 (All logs)

  • imgui/1.90.5-docking:
    Built 6 packages out of 10 (All logs)

  • imgui/1.91.0:
    Built 6 packages out of 10 (All logs)

  • imgui/1.91.0-docking:
    Built 6 packages out of 10 (All logs)

  • imgui/1.90.9-docking:
    Built 6 packages out of 10 (All logs)

  • imgui/1.90.6:
    Built 6 packages out of 10 (All logs)

  • imgui/1.90.8-docking:
    Built 6 packages out of 10 (All logs)

  • imgui/1.90.9:
    Built 6 packages out of 10 (All logs)

  • imgui/1.90.8:
    Built 6 packages out of 10 (All logs)

  • imgui/1.90.7-docking:
    Built 6 packages out of 10 (All logs)

  • imgui/1.90.6-docking:
    Built 6 packages out of 10 (All logs)

  • imgui/1.88:
    Built 6 packages out of 10 (All logs)

  • imgui/1.90.7:
    Built 6 packages out of 10 (All logs)

  • imgui/1.89.9:
    Built 6 packages out of 10 (All logs)

  • imgui/1.86:
    All packages built successfully! (All logs)

  • imgui/1.89.9-docking:
    Built 6 packages out of 10 (All logs)

  • imgui/1.87:
    Built 6 packages out of 10 (All logs)

  • imgui/1.85:
    All packages built successfully! (All logs)

Copy link
Contributor

Hooks produced the following warnings for commit 2b349e6
imgui/1.86@#6c07b2eebf35b7365ace7efe78b7e7de
post_package(): WARN: [APPLE RELOCATABLE SHARED LIBS (KB-H077)] install_name dir of these shared libs is not @rpath: libimgui-osx.dylib, libimgui-metal.dylib
imgui/1.85@#d6f43ac34007b753a47994a8d1303440
post_package(): WARN: [APPLE RELOCATABLE SHARED LIBS (KB-H077)] install_name dir of these shared libs is not @rpath: libimgui-osx.dylib, libimgui-metal.dylib

@valgur
Copy link
Contributor Author

valgur commented Sep 24, 2024

The recipe is ready for review.

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.

3 participants