Git Product home page Git Product logo

Comments (8)

mosra avatar mosra commented on May 16, 2024 1

Hi, thanks for the report!

I tried to do this in a way that doesn't make the whole ImGuiIntegration library depend on the imgui_stdlib.cpp file, since this particular STL compatibility is not used there. I came up with the following, currently only in the next branch -- first take the updated FindImGui.cmake from here, then in your CMakeLists add this:

find_package(ImGui REQUIRED SourcesMiscCpp)

...

target_link_libraries(your-app PRIVATE ImGui::SourcesMiscCpp)

After that, you should be able to

#include <misc/cpp/imgui_stdlib.h>

and everything should work as expected. Though I'm not sure if the misc/cpp prefix makes sense, maybe I'll make it so only #include <imgui_stdlib.h> is needed. What do you say? Can you test on your side and confirm it works? Also, suggestions welcome :)

from magnum-integration.

melix99 avatar melix99 commented on May 16, 2024 1

Oh ok, that worked. Thanks!

from magnum-integration.

paladium avatar paladium commented on May 16, 2024

Yes that works, thanks for the fix. The stdlib for imgui is still in development and has little useful functions at this point, however if it becomes larger, it will make sense to make ImGUIIntegration dependent on that file. At this point, this would work.

from magnum-integration.

mosra avatar mosra commented on May 16, 2024

Thanks for the confirmation! 👍 3a2cb98 is now in master.

I'm not sure if @ocornut wants to depend on STL too much, so I assume it will stay like this for quite a while. But who knows. If it will later make sense to have it directly, then I can make that change, of course :)

from magnum-integration.

melix99 avatar melix99 commented on May 16, 2024

Unfortunately I'm having problems even using the find_package(ImGui REQUIRED SourcesMiscCpp) inside my CMakeLists: CMake says that it could not find the component SourcesMiscCpp.
I'm using the latest ImGui release, and the path of the misc folder is the same as the one specified in the FindImGui.cmake so... idk what's going on.

I also want to specify that I have magnum-integration as my CMake's subdirectory, and that if I add the SourcesMiscCpp to the find_package inside the CMakeLists of the library, the find_package inside my CMakeLists can find the component for some reason (but it's not the best solution obv).

Any suggestions?

from magnum-integration.

mosra avatar mosra commented on May 16, 2024

That's weird ... I just tried to reproduce here (adding the find_package() to the imgui example), but everything works as expected.

  • Are you sure your copy of FindImGui.cmake is the same as the one in the integration repo?
  • If you look into CMakeCache.txt, which of the ImGui_* variables are set to -NOTFOUND?

from magnum-integration.

melix99 avatar melix99 commented on May 16, 2024

Are you sure your copy of FindImGui.cmake is the same as the one in the integration repo?

Yep, I literally copied the modules directory from magnum-integration inside mine.

I just tried to reproduce here (adding the find_package() to the imgui example), but everything works as expected.

I just tried that too and it worked for me either, so I analyzed the differences between the example and my project and found that in my project I have the magnum-integration and imgui subprojects inside a ThirdParty directory with a CMakeLists, but, in the imgui example, I putted magnum-integration and imgui directly in a subdirectory inside the main CMakeLists. In fact I did the same thing in my project and it worked fine. To clarify:

My project:
Main CMakeLists -> ThirdParty subdir -> magnum-integration subdir (with imgui)

Imgui example:
Main CMakeLists -> magnum-integration subdir (with imgui)

This is the CMakeLists inside the ThirdParty dir:

set(WITH_IMGUI ON CACHE BOOL "" FORCE)
set(IMGUI_DIR "${CMAKE_CURRENT_SOURCE_DIR}/imgui/")

add_subdirectory(magnum-integration)

Maybe I did something wrong here?

from magnum-integration.

mosra avatar mosra commented on May 16, 2024

I see the problem now -- find_package(ImGui REQUIRED SourcesMiscCpp) needs the IMGUI_DIR. Because you're setting it in a subdirectory, the parent won't see it, and then FindImGui.cmake will fail to find the sources because it doesn't know where to look. One way to fix this would be to put it into the cache, so parent dir can pick it up from there:

set(IMGUI_DIR "${CMAKE_CURRENT_SOURCE_DIR}/imgui" CACHE STRING "" FORCE)

from magnum-integration.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.