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, convert -docking versions into an option #25325

Open
wants to merge 26 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.

@valgur valgur force-pushed the feature/imgui-refacto branch from 3a803d1 to 3746762 Compare September 23, 2024 06:50
@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 from b105a72 to 57dc335 Compare September 23, 2024 08:21
@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.

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.

@valgur valgur changed the title imgui: make backends available as optional components imgui: make backends available as optional components, convert -docking versions into an option Oct 21, 2024
The source() method is meant for configuration-independent source downloads, so I moved it into build() instead, as recommended by the Conan docs.

I kept support for the old -docking versions, but their use should be discontinued after this change.
@valgur valgur force-pushed the feature/imgui-refacto branch from e0562fd to feaa8a5 Compare October 21, 2024 05:49
import os
import re
from pathlib import Path
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not related to the recipe, but the linter incorrectly flags this line as

conan-import-disallowed: Private modules are disallowed, import tools from 'from conan.tools.xxxx import yyyyy'

@conan-center-bot

This comment has been minimized.

…ure/imgui-refacto

# Conflicts:
#	recipes/imgui/all/conandata.yml
#	recipes/imgui/config.yml
@conan-center-bot

This comment has been minimized.

@valgur valgur force-pushed the feature/imgui-refacto branch from 28ac6ce to b6498c1 Compare October 24, 2024 11:22
@conan-center-bot

This comment has been minimized.

@valgur valgur force-pushed the feature/imgui-refacto branch from 7312680 to 1dfb051 Compare October 24, 2024 12:12
@conan-center-bot
Copy link
Collaborator

Conan v1 pipeline ❌

Warning

Conan Center will stop receiving updates for Conan 1.x packages soon - please see announcement.

Failure in build 48 (1dfb05151007e2fbc28c31a738cf03f8415fc636):

  • imgui/1.91.4-docking:
    Didn't run or was cancelled before finishing

  • imgui/1.91.2-docking:
    Didn't run or was cancelled before finishing

  • imgui/1.90.8-docking:
    Didn't run or was cancelled before finishing

  • imgui/1.88:
    Didn't run or was cancelled before finishing

  • imgui/1.91.4:
    Didn't run or was cancelled before finishing

  • imgui/1.89.9:
    Didn't run or was cancelled before finishing

  • imgui/1.90.5:
    Didn't run or was cancelled before finishing

  • imgui/1.90.9-docking:
    Didn't run or was cancelled before finishing

  • imgui/1.91.0:
    Didn't run or was cancelled before finishing

  • imgui/1.87:
    Didn't run or was cancelled before finishing

  • imgui/1.90.7:
    Didn't run or was cancelled before finishing

  • imgui/1.90.6:
    Didn't run or was cancelled before finishing

  • imgui/1.85:
    Didn't run or was cancelled before finishing

  • imgui/1.91.3-docking:
    Didn't run or was cancelled before finishing

  • imgui/1.86:
    Didn't run or was cancelled before finishing

  • imgui/1.91.2:
    Didn't run or was cancelled before finishing

  • imgui/1.91.0-docking:
    CI failed to create some packages (All logs)

    Logs for packageID a05a50c44d6cbb5c20957c7934cd64a11237b9c3:
    [settings]
    arch=x86_64
    build_type=Release
    compiler=gcc
    compiler.libcxx=libstdc++11
    compiler.version=5
    os=Linux
    [options]
    imgui:shared=False
    
    [...]
    imgui/1.91.0-docking: Calling build()
    imgui/1.91.0-docking: 
    dpkg-query: no packages found matching libgl-dev
    debconf: delaying package configuration, since apt-utils is not installed
    dpkg-query: no packages found matching libfontenc-dev
    dpkg-query: no packages found matching libice-dev
    dpkg-query: no packages found matching libsm-dev
    dpkg-query: no packages found matching libxaw7-dev
    dpkg-query: no packages found matching libxcomposite-dev
    dpkg-query: no packages found matching libxcursor-dev
    dpkg-query: no packages found matching libxi-dev
    dpkg-query: no packages found matching libxinerama-dev
    dpkg-query: no packages found matching libxkbfile-dev
    dpkg-query: no packages found matching libxmu-dev
    dpkg-query: no packages found matching libxmuu-dev
    dpkg-query: no packages found matching libxpm-dev
    dpkg-query: no packages found matching libxrandr-dev
    dpkg-query: no packages found matching libxrender-dev
    dpkg-query: no packages found matching libxres-dev
    dpkg-query: no packages found matching libxss-dev
    dpkg-query: no packages found matching libxt-dev
    dpkg-query: no packages found matching libxv-dev
    dpkg-query: no packages found matching libxcb-render-util0-dev
    dpkg-query: no packages found matching libxcb-xkb-dev
    dpkg-query: no packages found matching libxcb-icccm4-dev
    dpkg-query: no packages found matching libxcb-image0-dev
    dpkg-query: no packages found matching libxcb-keysyms1-dev
    dpkg-query: no packages found matching libxcb-xinerama0-dev
    dpkg-query: no packages found matching uuid-dev
    dpkg-query: no packages found matching libxcb-cursor-dev
    dpkg-query: no packages found matching libxcb-composite0-dev
    dpkg-query: no packages found matching libxcb-ewmh-dev
    dpkg-query: no packages found matching libxcb-res0-dev
    debconf: delaying package configuration, since apt-utils is not installed
    dpkg-query: no packages found matching libxcb-util-dev
    debconf: delaying package configuration, since apt-utils is not installed
    WARN: **************************************************
    WARN: *** Conan 1 is legacy and on a deprecation path **
    WARN: *********** Please upgrade to Conan 2 ************
    WARN: **************************************************
    imgui/1.91.0-docking: WARN: The -docking versions of imgui are deprecated. Use -o imgui/*:docking=True instead.
    imgui/1.91.0-docking: WARN: Using the new toolchains and generators without specifying a build profile (e.g: -pr:b=default) is discouraged and might cause failures and unexpected behavior
    imgui/1.91.0-docking: WARN: Using the new toolchains and generators without specifying a build profile (e.g: -pr:b=default) is discouraged and might cause failures and unexpected behavior
    imgui/1.91.0-docking: ERROR: Package 'a05a50c44d6cbb5c20957c7934cd64a11237b9c3' build failed
    imgui/1.91.0-docking: WARN: Build folder /home/conan/workspace/prod-v1/bsr/113459/abdee/.conan/data/imgui/1.91.0-docking/_/_/build/a05a50c44d6cbb5c20957c7934cd64a11237b9c3/build/Release
    ERROR: imgui/1.91.0-docking: Error in build() method, line 268
    	self._source()
    while calling '_source', line 231
    	get(self, **conan_data["sources"][version][kind], destination=self.source_folder, strip_root=True)
    	KeyError: 'sources'
    
  • imgui/1.90.9:
    Didn't run or was cancelled before finishing

  • imgui/1.91.3:
    Didn't run or was cancelled before finishing

  • imgui/1.90.6-docking:
    Didn't run or was cancelled before finishing

  • imgui/1.90.8:
    Didn't run or was cancelled before finishing

  • imgui/1.90.5-docking:
    Didn't run or was cancelled before finishing

  • imgui/1.89.9-docking:
    Didn't run or was cancelled before finishing

  • imgui/1.90.7-docking:
    Didn't run or was cancelled before finishing


Note: To save resources, CI tries to finish as soon as an error is found. For this reason you might find that not all the references have been launched or not all the configurations for a given reference. Also, take into account that we cannot guarantee the order of execution as it depends on CI workload and workers availability.


Conan v2 pipeline ❌

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

The v2 pipeline failed. Please, review the errors and note this is required for pull requests to be merged. In case this recipe is still not ported to Conan 2.x, please, ping @conan-io/barbarians on the PR and we will help you.

Failure in build 48 (1dfb05151007e2fbc28c31a738cf03f8415fc636):

  • imgui/1.91.2:
    Didn't run or was cancelled before finishing

  • imgui/1.91.4-docking:
    CI failed to create some packages (All logs)

    Logs for packageID f29a724de47229c935e59bf02b6ded71474d8f2f:
    [settings]
    arch=x86_64
    build_type=Release
    compiler=gcc
    compiler.cppstd=17
    compiler.libcxx=libstdc++11
    compiler.version=11
    os=Linux
    [options]
    */*:shared=False
    
    [...]
    0 upgraded, 1 newly installed, 0 to remove and 7 not upgraded.
    Need to get 9,974 B of archives.
    After this operation, 71.7 kB of additional disk space will be used.
    Get:1 http://archive.ubuntu.com/ubuntu xenial/main amd64 libxcb-util-dev amd64 0.4.0-0ubuntu3 [9,974 B]
    debconf: delaying package configuration, since apt-utils is not installed
    Fetched 9,974 B in 0s (14.4 kB/s)
    Selecting previously unselected package libxcb-util-dev:amd64.
    (Reading database ... 
    (Reading database ... 5%
    (Reading database ... 10%
    (Reading database ... 15%
    (Reading database ... 20%
    (Reading database ... 25%
    (Reading database ... 30%
    (Reading database ... 35%
    (Reading database ... 40%
    (Reading database ... 45%
    (Reading database ... 50%
    (Reading database ... 55%
    (Reading database ... 60%
    (Reading database ... 65%
    (Reading database ... 70%
    (Reading database ... 75%
    (Reading database ... 80%
    (Reading database ... 85%
    (Reading database ... 90%
    (Reading database ... 95%
    (Reading database ... 100%
    (Reading database ... 19863 files and directories currently installed.)
    Preparing to unpack .../libxcb-util-dev_0.4.0-0ubuntu3_amd64.deb ...
    Unpacking libxcb-util-dev:amd64 (0.4.0-0ubuntu3) ...
    Setting up libxcb-util-dev:amd64 (0.4.0-0ubuntu3) ...
    
    ======== Installing packages ========
    
    -------- Downloading 3 packages --------
    opengl/system: Retrieving package da39a3ee5e6b4b0d3255bfef95601890afd80709 from remote 'conan-center' 
    opengl/system: Package installed da39a3ee5e6b4b0d3255bfef95601890afd80709
    opengl/system: Downloaded package revision 0ba8627bd47edc3a501e8f0eb9a79e5e
    xorg/system: Retrieving package da39a3ee5e6b4b0d3255bfef95601890afd80709 from remote 'conan-center' 
    xorg/system: Package installed da39a3ee5e6b4b0d3255bfef95601890afd80709
    xorg/system: Downloaded package revision 0ba8627bd47edc3a501e8f0eb9a79e5e
    glfw/3.4: Retrieving package 84ecd9745f2571953af72f2353c33a167dde83e1 from remote 'conan-center' 
    glfw/3.4: Package installed 84ecd9745f2571953af72f2353c33a167dde83e1
    glfw/3.4: Downloaded package revision 011537328d50499b6d5b907acbad679f
    
    -------- Installing package imgui/1.91.4-docking (4 of 4) --------
    imgui/1.91.4-docking: Building from source
    imgui/1.91.4-docking: Package imgui/1.91.4-docking:f29a724de47229c935e59bf02b6ded71474d8f2f
    imgui/1.91.4-docking: Copying sources to build folder
    imgui/1.91.4-docking: Building your package in /home/conan/workspace/prod-v2/bsr/101282/feeab/p/b/imguif2783dd76bb89/b
    imgui/1.91.4-docking: Calling generate()
    imgui/1.91.4-docking: Generators folder: /home/conan/workspace/prod-v2/bsr/101282/feeab/p/b/imguif2783dd76bb89/b/build/Release/generators
    imgui/1.91.4-docking: CMakeToolchain generated: conan_toolchain.cmake
    imgui/1.91.4-docking: CMakeToolchain generated: /home/conan/workspace/prod-v2/bsr/101282/feeab/p/b/imguif2783dd76bb89/b/build/Release/generators/CMakePresets.json
    imgui/1.91.4-docking: CMakeToolchain generated: /home/conan/workspace/prod-v2/bsr/101282/feeab/p/b/imguif2783dd76bb89/b/src/CMakeUserPresets.json
    imgui/1.91.4-docking: CMakeDeps necessary find_package() and targets for your CMakeLists.txt
        find_package(glfw3)
        find_package(opengl_system)
        target_link_libraries(... glfw opengl::opengl)
    imgui/1.91.4-docking: Generating aggregated env files
    imgui/1.91.4-docking: Generated aggregated env files: ['conanbuild.sh', 'conanrun.sh']
    imgui/1.91.4-docking: Calling build()
    imgui/1.91.4-docking: ERROR: 
    Package 'f29a724de47229c935e59bf02b6ded71474d8f2f' build failed
    imgui/1.91.4-docking: WARN: Build folder /home/conan/workspace/prod-v2/bsr/101282/feeab/p/b/imguif2783dd76bb89/b/build/Release
    ERROR: imgui/1.91.4-docking: Error in build() method, line 268
    	self._source()
    while calling '_source', line 231
    	get(self, **conan_data["sources"][version][kind], destination=self.source_folder, strip_root=True)
    	KeyError: 'sources'
    
  • imgui/1.91.2-docking:
    Didn't run or was cancelled before finishing

  • imgui/1.91.4:
    Didn't run or was cancelled before finishing

  • imgui/1.91.0:
    Didn't run or was cancelled before finishing

  • imgui/1.91.3-docking:
    Didn't run or was cancelled before finishing

  • imgui/1.91.0-docking:
    Didn't run or was cancelled before finishing

  • imgui/1.90.5-docking:
    Didn't run or was cancelled before finishing

  • imgui/1.85:
    Didn't run or was cancelled before finishing

  • imgui/1.87:
    Didn't run or was cancelled before finishing

  • imgui/1.90.7:
    Didn't run or was cancelled before finishing

  • imgui/1.90.9:
    Didn't run or was cancelled before finishing

  • imgui/1.91.3:
    Didn't run or was cancelled before finishing

  • imgui/1.90.6:
    Didn't run or was cancelled before finishing

  • imgui/1.89.9-docking:
    Didn't run or was cancelled before finishing

  • imgui/1.89.9:
    Didn't run or was cancelled before finishing

  • imgui/1.90.6-docking:
    Didn't run or was cancelled before finishing

  • imgui/1.90.9-docking:
    Didn't run or was cancelled before finishing

  • imgui/1.90.8-docking:
    Didn't run or was cancelled before finishing

  • imgui/1.90.8:
    Didn't run or was cancelled before finishing

  • imgui/1.90.5:
    Didn't run or was cancelled before finishing

  • imgui/1.90.7-docking:
    Didn't run or was cancelled before finishing

  • imgui/1.88:
    Didn't run or was cancelled before finishing

  • imgui/1.86:
    Didn't run or was cancelled before finishing


Note: To save resources, CI tries to finish as soon as an error is found. For this reason you might find that not all the references have been launched or not all the configurations for a given reference. Also, take into account that we cannot guarantee the order of execution as it depends on CI workload and workers availability.

@valgur valgur force-pushed the feature/imgui-refacto branch from 1dfb051 to e92dd47 Compare November 5, 2024 20:58
@valgur valgur force-pushed the feature/imgui-refacto branch from e92dd47 to c13dbf6 Compare November 5, 2024 20:59
@AbrilRBS AbrilRBS removed their assignment Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants