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

Why is imgui installation not intuitive? #118

Open
FreePhoenix888 opened this issue Feb 13, 2024 · 2 comments
Open

Why is imgui installation not intuitive? #118

FreePhoenix888 opened this issue Feb 13, 2024 · 2 comments

Comments

@FreePhoenix888
Copy link

Conan center shows you only this command to install imgui:

[requires]
imgui/cci.20230105+1.89.2.docking

And this command to find and link it to your app in cmake:

# ...
find_package(imgui REQUIRED)
# ...
target_link_libraries(YOUR_TARGET imgui::imgui)

But in this repo we see that we need two other libs:

glfw/3.3.6
glew/2.2.0

Bindings:
[imports]
./res/bindings, imgui_impl_glfw.cpp -> ../bindings
./res/bindings, imgui_impl_opengl3.cpp -> ../bindings
./res/bindings, imgui_impl_glfw.h -> ../bindings
./res/bindings, imgui_impl_opengl3.h -> ../bindings

Options:
[options]
glew:shared=False

Another generator(that is not showed in conan center instruction):
[generators]
cmake_find_package_multi

Use config keyword for find_package:
# CONFIG option is important so that CMake doesnt search for modules into the default modules directory
find_package(imgui CONFIG)
find_package(glfw3 CONFIG)
find_package(glew CONFIG)

And a lot of other things you can see here:
https://github.com/conan-io/examples/blob/master/libraries/dear-imgui/basic/CMakeLists.txt#L7-L10

@jcar87
Copy link

jcar87 commented Feb 13, 2024

Hi @FreePhoenix888 - thank you for your feedback.

Please keep in mind that this repository (examples) is for Conan 1.x. Conan 2.0 was released about a year ago, and we have a new repository for examples: https://github.com/conan-io/examples2, following the tutorials you can find at: https://docs.conan.io/2/tutorial.html

As for imgui, it's a special library - the complexities stem from the source code of imgui itself:
https://github.com/ocornut/imgui/wiki/Getting-Started#compilinglinking

imgui can be powered by different backends (e.g OpenGL, DirectX, etc) - but some of the public function calls you would make to imgui also require you to make OS-specific calls - so it's not a fully encapsulated abstraction, which has some implications in how this is handled, and requires the consumer to also specify which backend to use (that's why you see calls to find package for glfw and glew, while there are other alternatives). So in short, it's not very intuitive because the library itself follows a different pattern than most others. However, it is still a hugely popular library and the example was written with the ability of being cross-platform and compatible with most mainstream OSs.

@FreePhoenix888
Copy link
Author

As for imgui, it's a special library - the complexities stem from the source code of imgui itself: https://github.com/ocornut/imgui/wiki/Getting-Started#compilinglinking

imgui can be powered by different backends (e.g OpenGL, DirectX, etc) - but some of the public function calls you would make to imgui also require you to make OS-specific calls - so it's not a fully encapsulated abstraction, which has some implications in how this is handled, and requires the consumer to also specify which backend to use (that's why you see calls to find package for glfw and glew, while there are other alternatives). So in short, it's not very intuitive because the library itself follows a different pattern than most others. However, it is still a hugely popular library and the example was written with the ability of being cross-platform and compatible with most mainstream OSs.

To make it clear for a new user we should have something like readme in npm for author to be able tell users about such things that should be done by used to setup a recipe.

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

No branches or pull requests

2 participants