Giter Site home page Giter Site logo

Comments (20)

mosra avatar mosra commented on May 21, 2024

You need to:

  1. if you haven't done already, install ImGuiIntegration via vcpkg install magnum-integration[imgui]
  2. add FindImGui.cmake and FindMagnumIntegration.cmake from here to the modules/ directory in your project
  3. then reconfigure the project via CMake, it should pick up everything correctly

from magnum-plugins.

al-sabr avatar al-sabr commented on May 21, 2024

Step by step ouhhhhh babbbbyyyy gonna get to you gurrrllllll https://www.youtube.com/watch?v=ay6GjmiJTPM:

  1. Install integration:
vcpkg install magnum-integration[imgui]
The following packages will be built and installed:
  * imgui[core]:x86-windows
    magnum-integration[core,imgui]:x86-windows
Additional packages (*) will be modified to complete this operation.
Starting package 1/2: imgui:x86-windows
Building package imgui[core]:x86-windows...
CMake Warning at ports/imgui/portfile.cmake:4 (message):
  The author of imgui strongly advises users of this lib against using a DLL.
  For more details, please visit:
  https://github.com/Microsoft/vcpkg/issues/5110
Call Stack (most recent call first):
  scripts/ports.cmake:71 (include)


-- Downloading https://github.com/ocornut/imgui/archive/v1.68.tar.gz...
-- Extracting source G:/programming/c++/vcpkg/downloads/ocornut-imgui-v1.68.tar.gz
-- Using source at G:/programming/c++/vcpkg/buildtrees/imgui/src/v1.68-35b2ef549f
-- Configuring x86-windows
-- Building x86-windows-dbg
-- Building x86-windows-rel
-- Performing post-build validation
-- Performing post-build validation done
Building package imgui[core]:x86-windows... done
Installing package imgui[core]:x86-windows...
Installing package imgui[core]:x86-windows... done
Elapsed time for package imgui:x86-windows: 23.66 s
Starting package 2/2: magnum-integration:x86-windows
Building package magnum-integration[core,imgui]:x86-windows...
-- Downloading https://github.com/mosra/magnum-integration/archive/v2019.01.tar.gz...
-- Extracting source G:/programming/c++/vcpkg/downloads/mosra-magnum-integration-v2019.01.tar.gz
-- Using source at G:/programming/c++/vcpkg/buildtrees/magnum-integration/src/v2019.01-a206003452
-- Configuring x86-windows
-- Building x86-windows-dbg
-- Building x86-windows-rel
-- Performing post-build validation
-- Performing post-build validation done
Building package magnum-integration[core,imgui]:x86-windows... done
Installing package magnum-integration[core,imgui]:x86-windows...
Installing package magnum-integration[core,imgui]:x86-windows... done
Elapsed time for package magnum-integration:x86-windows: 19.19 s

Total elapsed time: 42.84 s

The package magnum-integration:x86-windows provides CMake targets:

    find_package(MagnumIntegration CONFIG REQUIRED)
    target_link_libraries(main PRIVATE MagnumIntegration::${_component})
  1. Added both files into my root modules folder.
  2. CMakeList.txt of my project:
find_package(Magnum REQUIRED GL Shaders Sdl2Application)
find_package(MagnumIntegration REQUIRED ImGui)

set_directory_properties(PROPERTIES CORRADE_USE_PEDANTIC_FLAGS ON)

add_executable(Multiverses Multiverses.cpp)
target_link_libraries(Multiverses PRIVATE
    Magnum::Application
    Magnum::GL
    Magnum::Magnum
    Magnum::Shaders
	MagnumIntegration::ImGui)
  1. Rebuild all and only one error

image

from magnum-plugins.

mosra avatar mosra commented on May 21, 2024

Hmm. Weird, shouldn't happen. Did you reconfigure/regenerate CMake before hitting rebuild?

from magnum-plugins.

al-sabr avatar al-sabr commented on May 21, 2024

Visual Studio popped a dialog which asked me to reload all.

image

I've checked the additional dependencies:

G:\programming\c++\vcpkg\installed\x86-windows\debug\lib\MagnumSdl2Application-d.lib
G:\programming\c++\vcpkg\installed\x86-windows\debug\lib\MagnumGL-d.lib
G:\programming\c++\vcpkg\installed\x86-windows\debug\lib\Magnum-d.lib
G:\programming\c++\vcpkg\installed\x86-windows\debug\lib\MagnumShaders-d.lib
G:\programming\c++\vcpkg\installed\x86-windows\debug\lib\MagnumImGuiIntegration-d.lib
G:\programming\c++\vcpkg\installed\x86-windows\debug\lib\SDL2d.lib
opengl32.lib
G:\programming\c++\vcpkg\installed\x86-windows\debug\lib\CorradeUtility-d.lib
ImGui::ImGui.lib

from magnum-plugins.

mosra avatar mosra commented on May 21, 2024

Yeah well that's wrong. You need to hit Configure/Generate from the CMake GUI. Please post here what the log says.

from magnum-plugins.

al-sabr avatar al-sabr commented on May 21, 2024

Yeah well that's wrong. You need to hit Configure/Generate from the CMake GUI. Please post here what the log says.

image

from magnum-plugins.

mosra avatar mosra commented on May 21, 2024

🤔 right, yes that explains the linker error. Since this didn't happen for anybody before I optimistically assume this is just some internal CMake state getting confused (yes, this happens sometimes, CMake is a complex beast). Can you delete the build directory generated by CMake and do the CMake configuration again from scratch?

from magnum-plugins.

al-sabr avatar al-sabr commented on May 21, 2024

🤔 right, yes that explains the linker error. Since this didn't happen for anybody before I optimistically assume this is just some internal CMake state getting confused (yes, this happens sometimes, CMake is a complex beast). Can you delete the build directory generated by CMake and do the CMake configuration again from scratch?

image

from magnum-plugins.

mosra avatar mosra commented on May 21, 2024

Looks like you forgot to point CMAKE_TOOLCHAIN_FILE to the vcpkg toolchain file in the initial run.

from magnum-plugins.

al-sabr avatar al-sabr commented on May 21, 2024

I added the entry in the UI and still error:

image

I tried to launch CMake from the command line instead:

PS G:\programming\c++\multiverses\build> cmake .. -DCMAKE_TOOLCHAIN_FILE=G:\programming\c++\vcpkg\scripts\buildsystems/vcpkg.cmake
-- Building for: Visual Studio 15 2017
-- Selecting Windows SDK version 10.0.17763.0 to target Windows 10.0.17134.
-- The C compiler identification is MSVC 19.16.27027.1
-- The CXX compiler identification is MSVC 19.16.27027.1
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Corrade: G:/programming/c++/vcpkg/installed/x86-windows/include  found components:  Containers rc Utility
-- Found OpenGL: opengl32
-- Found SDL2: optimized;G:/programming/c++/vcpkg/installed/x86-windows/lib/SDL2.lib;debug;G:/programming/c++/vcpkg/installed/x86-windows/debug/lib/SDL2d.lib
-- Found Magnum: G:/programming/c++/vcpkg/installed/x86-windows/include  found components:  GL Shaders Sdl2Application
-- LIB_SUFFIX variable is not defined. It will be autodetected now.
-- You can set it manually with -DLIB_SUFFIX=<value> (64 for example)
-- LIB_SUFFIX autodetected as '', libraries will be installed into C:/Program Files (x86)/Multiverses/lib
-- Found Magnum: G:/programming/c++/vcpkg/installed/x86-windows/include  found components:  GL
-- Found MagnumIntegration: G:/programming/c++/vcpkg/installed/x86-windows/include  found components:  ImGui
-- Configuring done
CMake Error at G:/programming/c++/vcpkg/scripts/buildsystems/vcpkg.cmake:148 (_add_executable):
  Target "Multiverses" links to target "ImGui::ImGui" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?
Call Stack (most recent call first):
  src/CMakeLists.txt:6 (add_executable)


CMake Error at G:/programming/c++/vcpkg/scripts/buildsystems/vcpkg.cmake:148 (_add_executable):
  Target "Multiverses" links to target "ImGui::ImGui" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?
Call Stack (most recent call first):
  src/CMakeLists.txt:6 (add_executable)


CMake Error at G:/programming/c++/vcpkg/scripts/buildsystems/vcpkg.cmake:148 (_add_executable):
  Target "Multiverses" links to target "ImGui::ImGui" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?
Call Stack (most recent call first):
  src/CMakeLists.txt:6 (add_executable)


CMake Error at G:/programming/c++/vcpkg/scripts/buildsystems/vcpkg.cmake:148 (_add_executable):
  Target "Multiverses" links to target "ImGui::ImGui" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?
Call Stack (most recent call first):
  src/CMakeLists.txt:6 (add_executable)


CMake Error at G:/programming/c++/vcpkg/scripts/buildsystems/vcpkg.cmake:148 (_add_executable):
  Target "Multiverses" links to target "ImGui::ImGui" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?
Call Stack (most recent call first):
  src/CMakeLists.txt:6 (add_executable)


-- Generating done
-- Build files have been written to: G:/programming/c++/multiverses/build
PS G:\programming\c++\multiverses\build>

Damn when I saved the files from Github it saved them to FindImGui.cmake.txt and FindMagnumIntegration.cmake.txt. Let me rename them!

from magnum-plugins.

al-sabr avatar al-sabr commented on May 21, 2024

Finally :

PS G:\programming\c++\multiverses\build> cmake .. -DCMAKE_TOOLCHAIN_FILE=G:\programming\c++\vcpkg\scripts\buildsystems/vcpkg.cmake
-- Building for: Visual Studio 15 2017
-- Selecting Windows SDK version 10.0.17763.0 to target Windows 10.0.17134.
-- The C compiler identification is MSVC 19.16.27027.1
-- The CXX compiler identification is MSVC 19.16.27027.1
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Corrade: G:/programming/c++/vcpkg/installed/x86-windows/include  found components:  Containers rc Utility
-- Found OpenGL: opengl32
-- Found SDL2: optimized;G:/programming/c++/vcpkg/installed/x86-windows/lib/SDL2.lib;debug;G:/programming/c++/vcpkg/installed/x86-windows/debug/lib/SDL2d.lib
-- Found Magnum: G:/programming/c++/vcpkg/installed/x86-windows/include  found components:  GL Shaders Sdl2Application
-- LIB_SUFFIX variable is not defined. It will be autodetected now.
-- You can set it manually with -DLIB_SUFFIX=<value> (64 for example)
-- LIB_SUFFIX autodetected as '', libraries will be installed into C:/Program Files (x86)/Multiverses/lib
-- Found Magnum: G:/programming/c++/vcpkg/installed/x86-windows/include  found components:  GL
-- Found ImGui: G:/programming/c++/vcpkg/installed/x86-windows/include
-- Found MagnumIntegration: G:/programming/c++/vcpkg/installed/x86-windows/include  found components:  ImGui
-- Configuring done
-- Generating done
-- Build files have been written to: G:/programming/c++/multiverses/build
PS G:\programming\c++\multiverses\build>
1>------ Build started: Project: ZERO_CHECK, Configuration: Debug Win32 ------
1>Checking Build System
1>CMake does not need to re-run because G:/programming/c++/multiverses/build/CMakeFiles/generate.stamp is up-to-date.
1>CMake does not need to re-run because G:/programming/c++/multiverses/build/src/CMakeFiles/generate.stamp is up-to-date.
2>------ Build started: Project: Multiverses, Configuration: Debug Win32 ------
2>Building Custom Rule G:/programming/c++/multiverses/src/CMakeLists.txt
2>CMake does not need to re-run because G:/programming/c++/multiverses/build/src/CMakeFiles/generate.stamp is up-to-date.
2>Multiverses.cpp
2>Multiverses.vcxproj -> G:\programming\c++\multiverses\build\src\Debug\Multiverses.exe
========== Build: 2 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
````

from magnum-plugins.

al-sabr avatar al-sabr commented on May 21, 2024

Alright I tried to use the example code from the ImGuiIntegration tutorial at : https://doc.magnum.graphics/magnum/examples-imgui.html

But I can't compile because of some RGB value in the code.

image

from magnum-plugins.

mosra avatar mosra commented on May 21, 2024

This literal is defined in the Math::Literals namespace, so you need to

using namespace Math::Literals;

to make use of it. The example code has this line, right?

from magnum-plugins.

al-sabr avatar al-sabr commented on May 21, 2024

Yeah you are right it is inside of the code but I missed it somehow because my code is a bit different from the example. It seems that using namespace can be used everywhere but I find it better to put all in the beginning.

from magnum-plugins.

al-sabr avatar al-sabr commented on May 21, 2024

Here I have another problem which is when I run in Debug and Release mode the app is working well. When I switch to MinSizef I get this error:

image

The translation in English is : The execution of the code can not continue because imgui.dll was not found.

Weird the file is there.

image

The CMakeList.txt from the example contains:

cmake_minimum_required(VERSION 3.1)

project(MagnumImGuiExample)

# Add module path in case this is project root
if(PROJECT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
    set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/../../modules/")
endif()

find_package(Magnum REQUIRED GL Sdl2Application)
find_package(MagnumIntegration REQUIRED ImGui)

set_directory_properties(PROPERTIES CORRADE_USE_PEDANTIC_FLAGS ON)

add_executable(magnum-imgui ImGuiExample.cpp)
target_link_libraries(magnum-imgui PRIVATE
    Magnum::Application
    Magnum::GL
    Magnum::Magnum
    MagnumIntegration::ImGui)

install(TARGETS magnum-imgui DESTINATION ${MAGNUM_BINARY_INSTALL_DIR})

Mine are two files:

Root

cmake_minimum_required(VERSION 3.1)
project(Multiverses)

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/modules/")

add_subdirectory(src)

Multiverses App

find_package(Magnum REQUIRED GL Shaders Sdl2Application)
find_package(MagnumIntegration REQUIRED ImGui)

set_directory_properties(PROPERTIES CORRADE_USE_PEDANTIC_FLAGS ON)

add_executable(Multiverses Multiverses.cpp)
target_link_libraries(Multiverses PRIVATE
    Magnum::Application
    Magnum::GL
    Magnum::Magnum
	MagnumIntegration::ImGui)

install(TARGETS Multiverses DESTINATION ${MAGNUM_BINARY_INSTALL_DIR})

from magnum-plugins.

mosra avatar mosra commented on May 21, 2024

It's complaining about imguid.dll, not imgui.dll, and that file is not there. Not sure why vcpkg didn't copy it over -- it should be somewhere in the vcpkg package directories, if you copy it manually it should work.

It's also possible that Vcpkg (or the imgui Vcpkg package) works well only with Debug or Release and not MinSizeRel. Not many people use it, so maybe you hit a corner case that's not handled properly in the vcpkg package recipe for imgui.

from magnum-plugins.

al-sabr avatar al-sabr commented on May 21, 2024

I think I found what is the problem, it is in the Solution Configuration :

image

G:\programming\c++\vcpkg\installed\x86-windows\lib\MagnumSdl2Application.lib
G:\programming\c++\vcpkg\installed\x86-windows\lib\MagnumGL.lib
G:\programming\c++\vcpkg\installed\x86-windows\lib\Magnum.lib
G:\programming\c++\vcpkg\installed\x86-windows\lib\MagnumImGuiIntegration.lib
G:\programming\c++\vcpkg\installed\x86-windows\lib\SDL2.lib
opengl32.lib
G:\programming\c++\vcpkg\installed\x86-windows\lib\CorradeUtility.lib
G:\programming\c++\vcpkg\installed\x86-windows\debug\lib\imguid.lib

The last line:
G:\programming\c++\vcpkg\installed\x86-windows\debug\lib\imguid.lib
Changed it for:
G:\programming\c++\vcpkg\installed\x86-windows\lib\imgui.lib

and it works. So it seems that at the generation stage CMake is not able to make the difference between Debug and MinSizef and Release

from magnum-plugins.

mosra avatar mosra commented on May 21, 2024

Does the file at G:\programming\c++\vcpkg\installed\x86-windows\debug\lib\imguid.lib actually exist? Is the debug/lib directory there at all?

To me this sounds like some strange packaging error (vcpkg to blame, not cmake), but looking at the vcpkg package for imgui, I wasn't able to find anything suspicious. Good to know you found a workaround.

from magnum-plugins.

al-sabr avatar al-sabr commented on May 21, 2024

The folder is correct with its content:

image

I don't know why we get that error.

from magnum-plugins.

mosra avatar mosra commented on May 21, 2024

Anything else to be done here? Otherwise I'll suggest closing this issue.

The above is most probably a packaging error in the ImGui vcpkg package, I can't really do anything about that.

from magnum-plugins.

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.