ocornut/imgui

Conan package

Closed this issue ยท 11 comments

Hello,
Do you know about Conan?
Conan is modern dependency manager for C++. And will be great if your library will be available via package manager for other developers.

Here you can find example, how you can create package for the library.

If you have any questions, just ask :-)

Dear ImGui doesn't fit within the traditional "packageable" scheme, it is meant to be copied and compiled by the user inside their project.

If you want to create a Conan setup please feel free to do so, but it's not something I would do or maintain myself seeing I don't know its ecosystem, it's up to Conan users.

Will close this as there is no task/issue for imgui that I can see, but if please us you if you make it, will add it to the Wiki-Links section.

if i create conan package for your library, do you want to support it and update every imgui release?

No I likely won't support it, it has to be supported by people actually using it. Creating a package if you are not a user of the library yourself is possibly not a good idea, if I may say so.

Ok, i understand you.

In case anyone runs across this, don't think conan is the only C++ dependency manager at all. hunter is a pure CMake dependency manager for those that use cmake, it can bring in dependencies from about any source that uses any build system (or embeds straight), no python or anything else needed but CMake itself, in addition, although a library itself can register itself as a dependency into the system, users can do it pretty trivially as well (and grabbing imgui as a dependency is pretty trivial since you can just add it's source and header directories in the single call). This really is something the user community should do either by each just setting up the dependency information in their own projects, or adding a hunter repo that manages it (or PR'ing it into the main repo).

Thanks for the precision @OvermindDL1. Closing this topic as discussed.
Links will be posted in the readme and/or wiki as submitted.

Hi there!

Just reporting about Conan package for imgui.

We provided a recipe to build, package and distribute imgui. The original artifacts were preserved, including the license.

Conan recipe at Github:
https://github.com/bincrafters/conan-imgui

Conan package at Bintray:
https://bintray.com/bincrafters/public-conan/imgui%3Abincrafters

Regards!

@uilianries

Error

FreePhoenix@FreePhoenix MINGW64 ~/Documents/Programming/examples2/tutorial/consuming_packages/simple_cmake_project/build (main)
$ cmake ..
-- Using Conan toolchain: C:/Users/FreePhoenix/Documents/Programming/examples2/tutorial/consuming_packages/simple_cmake_project/build/conan_toolchain.cmake
-- Conan toolchain: CMAKE_GENERATOR_TOOLSET=v143
-- Conan toolchain: C++ Standard 14 with extensions OFF
-- Conan: Target declared 'ZLIB::ZLIB'
CMake Error at CMakeLists.txt:5 (find_package):
  By not providing "Findimgui.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "imgui", but
  CMake did not find one.

  Could not find a package configuration file provided by "imgui" with any of
  the following names:

    imguiConfig.cmake
    imgui-config.cmake

  Add the installation prefix of "imgui" to CMAKE_PREFIX_PATH or set
  "imgui_DIR" to a directory containing one of the above files.  If "imgui"
  provides a separate development package or SDK, be sure it has been
  installed.


-- Configuring incomplete, errors occurred!

CMakeLists.txt

cmake_minimum_required(VERSION 3.15)
project(compressor C)

find_package(ZLIB REQUIRED)
find_package(imgui REQUIRED)

add_executable(${PROJECT_NAME} src/main.c)
target_link_libraries(${PROJECT_NAME} ZLIB::ZLIB)
target_link_libraries(${PROJECT_NAME} imgui::imgui)

conanfile.txt

[requires]
imgui/1.90.1
[generators]
CMakeDeps
CMakeToolchain
[layout]
cmake_layout

Output of conan install

FreePhoenix@FreePhoenix MINGW64 ~/Documents/Programming/examples2/tutorial/consuming_packages/simple_cmake_project (main)
$ conan install conanfile.txt

======== Input profiles ========
Profile host:
[settings]
arch=x86_64
build_type=Release
compiler=msvc
compiler.cppstd=14
compiler.runtime=dynamic
compiler.runtime_type=Release
compiler.version=193
os=Windows

Profile build:
[settings]
arch=x86_64
build_type=Release
compiler=msvc
compiler.cppstd=14
compiler.runtime=dynamic
compiler.runtime_type=Release
compiler.version=193
os=Windows


======== Computing dependency graph ========
Graph root
    conanfile.txt: C:\Users\FreePhoenix\Documents\Programming\examples2\tutorial\consuming_packages\simple_cmake_project\conanfile.txt
Requirements
    imgui/1.90.1#9d0cdd8ade9de3d71bc1db2cb1b0ed69 - Cache

======== Computing necessary packages ========
Requirements
    imgui/1.90.1#9d0cdd8ade9de3d71bc1db2cb1b0ed69:9bdee485ef71c14ac5f8a657202632bdb8b4482b#3413ffd4135b01df3bb48ff398c8966f - Cache

======== Installing packages ========
imgui/1.90.1: Already installed! (1 of 1)
imgui/1.90.1: Appending PATH env var with : C:\Users\FreePhoenix\.conan2\p\imguiba9b8af73dc4d\p\bin
WARN: deprecated: Usage of deprecated Conan 1.X features that will be removed in Conan 2.X:
WARN: deprecated:     'env_info' used in: imgui/1.90.1

======== Finalizing install (deploy, generators) ========
conanfile.txt: Writing generators to C:\Users\FreePhoenix\Documents\Programming\examples2\tutorial\consuming_packages\simple_cmake_project\build\generators
conanfile.txt: Generator 'CMakeDeps' calling 'generate()'
conanfile.txt: CMakeDeps necessary find_package() and targets for your CMakeLists.txt
    find_package(imgui)
    target_link_libraries(... imgui::imgui)
conanfile.txt: Generator 'CMakeToolchain' calling 'generate()'
conanfile.txt: CMakeToolchain generated: conan_toolchain.cmake
conanfile.txt: Preset 'conan-default' added to CMakePresets.json. Invoke it manually using 'cmake --preset conan-default' if using CMake>=3.23
conanfile.txt: If your CMake version is not compatible with CMakePresets (<3.23) call cmake like: 'cmake <path> -G "Visual Studio 17 2022" -DCMAKE_TOOLCHAIN_FILE=C:\Users\FreePhoenix\Documents\Programming\examples2\tutorial\consuming_packages\simple_cmake_project\build\generators\conan_toolchain.cmake -DCMAKE_POLICY_DEFAULT_CMP0091=NEW'
conanfile.txt: CMakeToolchain generated: CMakePresets.json
conanfile.txt: CMakeToolchain generated: ..\..\CMakeUserPresets.json
conanfile.txt: Generating aggregated env files
conanfile.txt: Generated aggregated env files: ['conanbuild.bat', 'conanrun.bat']
Install finished successfully

Output of cmake

FreePhoenix@FreePhoenix MINGW64 ~/Documents/Programming/examples2/tutorial/consuming_packages/simple_cmake_project/build (main)
$ cmake ..
-- Using Conan toolchain: C:/Users/FreePhoenix/Documents/Programming/examples2/tutorial/consuming_packages/simple_cmake_project/build/conan_toolchain.cmake
-- Conan toolchain: CMAKE_GENERATOR_TOOLSET=v143
-- Conan toolchain: C++ Standard 14 with extensions OFF
-- Conan: Target declared 'ZLIB::ZLIB'
CMake Error at CMakeLists.txt:5 (find_package):
  By not providing "Findimgui.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "imgui", but
  CMake did not find one.

  Could not find a package configuration file provided by "imgui" with any of
  the following names:

    imguiConfig.cmake
    imgui-config.cmake

  Add the installation prefix of "imgui" to CMAKE_PREFIX_PATH or set
  "imgui_DIR" to a directory containing one of the above files.  If "imgui"
  provides a separate development package or SDK, be sure it has been
  installed.


-- Configuring incomplete, errors occurred!

Hello @FreePhoenix888 , you are trying to use an old and outdated version of this package. Please, follow the instruction from https://conan.io/center/recipes/imgui

Hello @FreePhoenix888 , you are trying to use an old and outdated version of this package. Please, follow the instruction from https://conan.io/center/recipes/imgui

CMakeLists.txt

FreePhoenix@FreePhoenix MINGW64 ~/Documents/Programming/examples2/tutorial/consuming_packages/simple_cmake_project (main)
$ cat CMakeLists.txt
cmake_minimum_required(VERSION 3.15)
project(compressor C)

find_package(ZLIB REQUIRED)
find_package(imgui REQUIRED)

add_executable(${PROJECT_NAME} src/main.c)
target_link_libraries(${PROJECT_NAME} ZLIB::ZLIB)
target_link_libraries(${PROJECT_NAME} imgui::imgui)

conanfile.txt

FreePhoenix@FreePhoenix MINGW64 ~/Documents/Programming/examples2/tutorial/consuming_packages/simple_cmake_project (main)
$ cat conanfile.txt
[requires]
imgui/cci.20230105+1.89.2.docking
[generators]
CMakeDeps
CMakeToolchain
[layout]
cmake_layout

Output of conan install

FreePhoenix@FreePhoenix MINGW64 ~/Documents/Programming/examples2/tutorial/consuming_packages/simple_cmake_project (main)
$ conan install conanfile.txt

======== Input profiles ========
Profile host:
[settings]
arch=x86_64
build_type=Release
compiler=msvc
compiler.cppstd=14
compiler.runtime=dynamic
compiler.runtime_type=Release
compiler.version=193
os=Windows

Profile build:
[settings]
arch=x86_64
build_type=Release
compiler=msvc
compiler.cppstd=14
compiler.runtime=dynamic
compiler.runtime_type=Release
compiler.version=193
os=Windows


======== Computing dependency graph ========
Graph root
    conanfile.txt: C:\Users\FreePhoenix\Documents\Programming\examples2\tutorial\consuming_packages\simple_cmake_project\conanfile.txt
Requirements
    imgui/cci.20230105+1.89.2.docking#18e2e1eb7009f6d5e16788061856aa22 - Cache

======== Computing necessary packages ========
Requirements
    imgui/cci.20230105+1.89.2.docking#18e2e1eb7009f6d5e16788061856aa22:9bdee485ef71c14ac5f8a657202632bdb8b4482b#184e616ca46d6091ac6d705a345e80af - Cache

======== Installing packages ========
imgui/cci.20230105+1.89.2.docking: Already installed! (1 of 1)
imgui/cci.20230105+1.89.2.docking: Appending PATH env var with : C:\Users\FreePhoenix\.conan2\p\imgui1895edcc2db9a\p\bin
WARN: deprecated: Usage of deprecated Conan 1.X features that will be removed in Conan 2.X:
WARN: deprecated:     'env_info' used in: imgui/cci.20230105+1.89.2.docking

======== Finalizing install (deploy, generators) ========
conanfile.txt: Writing generators to C:\Users\FreePhoenix\Documents\Programming\examples2\tutorial\consuming_packages\simple_cmake_project\build\generators
conanfile.txt: Generator 'CMakeDeps' calling 'generate()'
conanfile.txt: CMakeDeps necessary find_package() and targets for your CMakeLists.txt
    find_package(imgui)
    target_link_libraries(... imgui::imgui)
conanfile.txt: Generator 'CMakeToolchain' calling 'generate()'
conanfile.txt: CMakeToolchain generated: conan_toolchain.cmake
conanfile.txt: Preset 'conan-default' added to CMakePresets.json. Invoke it manually using 'cmake --preset conan-default' if using CMake>=3.23
conanfile.txt: If your CMake version is not compatible with CMakePresets (<3.23) call cmake like: 'cmake <path> -G "Visual Studio 17 2022" -DCMAKE_TOOLCHAIN_FILE=C:\Users\FreePhoenix\Documents\Programming\examples2\tutorial\consuming_packages\simple_cmake_project\build\generators\conan_toolchain.cmake -DCMAKE_POLICY_DEFAULT_CMP0091=NEW'
conanfile.txt: CMakeToolchain generated: CMakePresets.json
conanfile.txt: CMakeToolchain generated: ..\..\CMakeUserPresets.json
conanfile.txt: Generating aggregated env files
conanfile.txt: Generated aggregated env files: ['conanbuild.bat', 'conanrun.bat']
Install finished successfully

Output of cmake

FreePhoenix@FreePhoenix MINGW64 ~/Documents/Programming/examples2/tutorial/consuming_packages/simple_cmake_project/build (main)
$ cmake ..
-- Using Conan toolchain: C:/Users/FreePhoenix/Documents/Programming/examples2/tutorial/consuming_packages/simple_cmake_project/build/conan_toolchain.cmake
-- Conan toolchain: CMAKE_GENERATOR_TOOLSET=v143
-- Conan toolchain: C++ Standard 14 with extensions OFF
-- Conan: Target declared 'ZLIB::ZLIB'
CMake Error at CMakeLists.txt:5 (find_package):
  By not providing "Findimgui.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "imgui", but
  CMake did not find one.

  Could not find a package configuration file provided by "imgui" with any of
  the following names:

    imguiConfig.cmake
    imgui-config.cmake

  Add the installation prefix of "imgui" to CMAKE_PREFIX_PATH or set
  "imgui_DIR" to a directory containing one of the above files.  If "imgui"
  provides a separate development package or SDK, be sure it has been
  installed.


-- Configuring incomplete, errors occurred!

@FreePhoenix888 Please, open an issue to https://github.com/conan-io/conan-center-index/issues so we can discuss about this. This issue is closed and it's not related to your error.

Plus, something is missing, your conanfile.txt shows imgui, but it does not have zlib listed. At same time, your build output shows zlib from Conan ...