hugoam / kiui

Auto-layout Ui library, lightweight, skinnable and system agnostic, with an OpenGL backend
zlib License
749 stars 70 forks source link

Lack of documentation on adding kiui to larger cmake project. #32

Open Tarinaky opened 9 years ago

Tarinaky commented 9 years ago

Attempting something similar to the following (on a Windows version of cmake): add_subdirectory(glfw-3.1.1) add_subdirectory(kiui) ... target_link_libraries(foo kiui ${OPENGL_LIBRARIES} glfw)

resulting in unresolved external symbols from glfw when trying to build kiui.dll. Have tried to force kiui to build statically, however it keeps failing trying to build kiui.dll.

I was not having this problem when using imgui+glfw, so I think there's something that may need to be improved with KiUi's build process.

hugoam commented 9 years ago

Does imgui depends on glfw ? What did kiui CMake process say about finding glfw ? There lack an option for a static build, but this pull request has added it : https://github.com/novembermonk/kiui/pull/21

kiUi build process is far from perfect : I learned CMake as I was writing it, so it should get better, with your help, eventually

Tarinaky commented 9 years ago

Sorry I've not been able to reply to this as quickly as I'd have liked.

IMGUI does not directly depend on glfw, however the examples for imgui comes with a glfw bindings, which I'm using.

I will have a gist test-case online asap :)

Tarinaky commented 9 years ago

https://github.com/Tarinaky/laughing-octo-ninja/tree/4c1b09163f61cc5286c61b2fc33b89ccaa9c9906

Error log is here: https://github.com/Tarinaky/laughing-octo-ninja/blob/4c1b09163f61cc5286c61b2fc33b89ccaa9c9906/build/log.txt

hugoam commented 9 years ago

Okay, thanks for the test sample. I know the problem, but I'm not sure of the appropriate fix. The kiui script uses the GLFW_LIBRARIES variable to link the glfw lib, which is usually set by a FIND_PACKAGE() command. Since you are directly adding glfw as a directory, I suppose this variable is never set.

Also, I'm gonna make a change soon where kiui.lib will just contain the UI lib and kiui_glfw.lib will contain the frontend (and the dependency on glfw). This will just move the 'problem' to kiui_glfw, but just letting you know.