Coder Social home page Coder Social logo

mes_imgui_template's Introduction

Mes_Imgui_template

This is a template of Imgui + Implot Project, with opengl + glfw backend.

This template is built with CMake, supporting both Windows and Linux.

Dependencies

  • OpenGL
    On Windows, you can download it in Visual Studio.

How to build

git clone https://github.com/Mes0903/Mes_Imgui_template.git
cd Mes_Imgui_template
git submodule init
git submodule update
mkdir build && cd build
cmake ..
cmake --build .

wsl

if you are using WSL as your environment, you may encounter the wayland-scanner error:

... failed to find wayland-scanner

In this case, you can uncomment the cmake flag for glfw to disable wayland:

# 3rdparty/CMakeLists.txt

if(UNIX)
  set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE)
  set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE)
  set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
  set(GLFW_BUILD_WAYLAND OFF CACHE BOOL "" FORCE)
endif()

add_subdirectory(glfw)

glad

Glad in this template is for opengl 4.6, so you need to change the version of glad if you are using a different version of opengl.

You can download the correspond version on the glad loader website.

mingw64

I'm not quite familar with mingw, but this is how I compile with mingw64:

C:\mingw64\bin\cmake.EXE --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_C_COMPILER:FILEPATH=C:\mingw64\bin\gcc.exe -DCMAKE_CXX_COMPILER:FILEPATH=C:\mingw64\bin\g++.exe -SD:/document/GitHub/Mes_Imgui_template -Bd:/document/GitHub/Mes_Imgui_template/build -G "MinGW Makefiles"

cd build
cmake --build .

The path of my project was D:\document\GitHub\Mes_Imgui_template, and the path of my mingw was C:\mingw64, please changed the path to yours.

(This command is generated by Visual Studio Code, so it may not be the best way to compile with mingw64.)

mes_imgui_template's People

Contributors

mes0903 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

mes_imgui_template's Issues

关于 GLFW 的位数设置

我用mingw64编译了这个repo,但我发现GLFW似乎不能用32位版本的静态库,一旦使用就会爆出很多undefined reference,所以我想问下这个版本设置在了哪里?是64位有一些独有的接口函数?

PS E:\SouceCode\C++_CODE\C++_Multiple\Mes_Imgui_mingw64\build> make
[ 12%] Built target glad
[ 62%] Built target IMGUI_LIB
[ 87%] Built target IMPLOT_LIB
[ 93%] Building CXX object CMakeFiles/IMGUI_DEMO.dir/src/imgui_demo.cpp.obj
[100%] Linking CXX executable IMGUI_DEMO.exe
CMakeFiles\IMGUI_DEMO.dir/objects.a(imgui_demo.cpp.obj): In function `main':
E:/SouceCode/C++_CODE/C++_Multiple/Mes_Imgui_mingw64/src/imgui_demo.cpp:28: undefined reference to `glfwSetErrorCallback'
E:/SouceCode/C++_CODE/C++_Multiple/Mes_Imgui_mingw64/src/imgui_demo.cpp:29: undefined reference to `glfwInit'
E:/SouceCode/C++_CODE/C++_Multiple/Mes_Imgui_mingw64/src/imgui_demo.cpp:49: undefined reference to `glfwWindowHint'
E:/SouceCode/C++_CODE/C++_Multiple/Mes_Imgui_mingw64/src/imgui_demo.cpp:50: undefined reference to `glfwWindowHint'
E:/SouceCode/C++_CODE/C++_Multiple/Mes_Imgui_mingw64/src/imgui_demo.cpp:57: undefined reference to `glfwCreateWindow'
E:/SouceCode/C++_CODE/C++_Multiple/Mes_Imgui_mingw64/src/imgui_demo.cpp:60: undefined reference to `glfwMakeContextCurrent'
E:/SouceCode/C++_CODE/C++_Multiple/Mes_Imgui_mingw64/src/imgui_demo.cpp:61: undefined reference to `glfwSwapInterval'
E:/SouceCode/C++_CODE/C++_Multiple/Mes_Imgui_mingw64/src/imgui_demo.cpp:85: undefined reference to `glfwWindowShouldClose'
E:/SouceCode/C++_CODE/C++_Multiple/Mes_Imgui_mingw64/src/imgui_demo.cpp:86: undefined reference to `glfwPollEvents'
E:/SouceCode/C++_CODE/C++_Multiple/Mes_Imgui_mingw64/src/imgui_demo.cpp:143: undefined reference to `glfwGetFramebufferSize'
E:/SouceCode/C++_CODE/C++_Multiple/Mes_Imgui_mingw64/src/imgui_demo.cpp:149: undefined reference to `glfwSwapBuffers'
E:/SouceCode/C++_CODE/C++_Multiple/Mes_Imgui_mingw64/src/imgui_demo.cpp:158: undefined reference to `glfwDestroyWindow'
E:/SouceCode/C++_CODE/C++_Multiple/Mes_Imgui_mingw64/src/imgui_demo.cpp:159: undefined reference to `glfwTerminate'
3rdparty/imgui/libIMGUI_LIB.a(imgui_impl_glfw.cpp.obj): In function `ImGui_ImplGlfw_GetClipboardText':
E:/SouceCode/C++_CODE/C++_Multiple/Mes_Imgui_mingw64/3rdparty/imgui/imgui_impl_glfw.cpp:132: undefined reference to `glfwGetClipboardString'
3rdparty/imgui/libIMGUI_LIB.a(imgui_impl_glfw.cpp.obj): In function `ImGui_ImplGlfw_SetClipboardText':
E:/SouceCode/C++_CODE/C++_Multiple/Mes_Imgui_mingw64/3rdparty/imgui/imgui_impl_glfw.cpp:137: undefined reference to `glfwSetClipboardString'
3rdparty/imgui/libIMGUI_LIB.a(imgui_impl_glfw.cpp.obj): In function `ImGui_ImplGlfw_TranslateUntranslatedKey':
E:/SouceCode/C++_CODE/C++_Multiple/Mes_Imgui_mingw64/3rdparty/imgui/imgui_impl_glfw.cpp:308: undefined reference to `glfwGetKeyName'
3rdparty/imgui/libIMGUI_LIB.a(imgui_impl_glfw.cpp.obj): In function `ImGui_ImplGlfw_CursorPosCallback(GLFWwindow*, double, double)':
E:/SouceCode/C++_CODE/C++_Multiple/Mes_Imgui_mingw64/3rdparty/imgui/imgui_impl_glfw.cpp:363: undefined reference to `glfwGetInputMode'
3rdparty/imgui/libIMGUI_LIB.a(imgui_impl_glfw.cpp.obj): In function `ImGui_ImplGlfw_CursorEnterCallback(GLFWwindow*, int)':
E:/SouceCode/C++_CODE/C++_Multiple/Mes_Imgui_mingw64/3rdparty/imgui/imgui_impl_glfw.cpp:378: undefined reference to `glfwGetInputMode'
3rdparty/imgui/libIMGUI_LIB.a(imgui_impl_glfw.cpp.obj): In function `ImGui_ImplGlfw_InstallCallbacks(GLFWwindow*)':
E:/SouceCode/C++_CODE/C++_Multiple/Mes_Imgui_mingw64/3rdparty/imgui/imgui_impl_glfw.cpp:416: undefined reference to `glfwSetWindowFocusCallback'
E:/SouceCode/C++_CODE/C++_Multiple/Mes_Imgui_mingw64/3rdparty/imgui/imgui_impl_glfw.cpp:417: undefined reference to `glfwSetCursorEnterCallback'
E:/SouceCode/C++_CODE/C++_Multiple/Mes_Imgui_mingw64/3rdparty/imgui/imgui_impl_glfw.cpp:418: undefined reference to `glfwSetCursorPosCallback'
E:/SouceCode/C++_CODE/C++_Multiple/Mes_Imgui_mingw64/3rdparty/imgui/imgui_impl_glfw.cpp:419: undefined reference to `glfwSetMouseButtonCallback'
E:/SouceCode/C++_CODE/C++_Multiple/Mes_Imgui_mingw64/3rdparty/imgui/imgui_impl_glfw.cpp:420: undefined reference to `glfwSetScrollCallback'
E:/SouceCode/C++_CODE/C++_Multiple/Mes_Imgui_mingw64/3rdparty/imgui/imgui_impl_glfw.cpp:421: undefined reference to `glfwSetKeyCallback'
E:/SouceCode/C++_CODE/C++_Multiple/Mes_Imgui_mingw64/3rdparty/imgui/imgui_impl_glfw.cpp:422: undefined reference to `glfwSetCharCallback'
E:/SouceCode/C++_CODE/C++_Multiple/Mes_Imgui_mingw64/3rdparty/imgui/imgui_impl_glfw.cpp:423: undefined reference to `glfwSetMonitorCallback'
3rdparty/imgui/libIMGUI_LIB.a(imgui_impl_glfw.cpp.obj): In function `ImGui_ImplGlfw_RestoreCallbacks(GLFWwindow*)':
E:/SouceCode/C++_CODE/C++_Multiple/Mes_Imgui_mingw64/3rdparty/imgui/imgui_impl_glfw.cpp:433: undefined reference to `glfwSetWindowFocusCallback'
E:/SouceCode/C++_CODE/C++_Multiple/Mes_Imgui_mingw64/3rdparty/imgui/imgui_impl_glfw.cpp:434: undefined reference to `glfwSetCursorEnterCallback'
E:/SouceCode/C++_CODE/C++_Multiple/Mes_Imgui_mingw64/3rdparty/imgui/imgui_impl_glfw.cpp:435: undefined reference to `glfwSetCursorPosCallback'
E:/SouceCode/C++_CODE/C++_Multiple/Mes_Imgui_mingw64/3rdparty/imgui/imgui_impl_glfw.cpp:436: undefined reference to `glfwSetMouseButtonCallback'
E:/SouceCode/C++_CODE/C++_Multiple/Mes_Imgui_mingw64/3rdparty/imgui/imgui_impl_glfw.cpp:437: undefined reference to `glfwSetScrollCallback'
E:/SouceCode/C++_CODE/C++_Multiple/Mes_Imgui_mingw64/3rdparty/imgui/imgui_impl_glfw.cpp:438: undefined reference to `glfwSetKeyCallback'
E:/SouceCode/C++_CODE/C++_Multiple/Mes_Imgui_mingw64/3rdparty/imgui/imgui_impl_glfw.cpp:439: undefined reference to `glfwSetCharCallback'
E:/SouceCode/C++_CODE/C++_Multiple/Mes_Imgui_mingw64/3rdparty/imgui/imgui_impl_glfw.cpp:440: undefined reference to `glfwSetMonitorCallback'
3rdparty/imgui/libIMGUI_LIB.a(imgui_impl_glfw.cpp.obj): In function `ImGui_ImplGlfw_Init':
E:/SouceCode/C++_CODE/C++_Multiple/Mes_Imgui_mingw64/3rdparty/imgui/imgui_impl_glfw.cpp:474: undefined reference to `glfwGetWin32Window'
E:/SouceCode/C++_CODE/C++_Multiple/Mes_Imgui_mingw64/3rdparty/imgui/imgui_impl_glfw.cpp:481: undefined reference to `glfwSetErrorCallback'
E:/SouceCode/C++_CODE/C++_Multiple/Mes_Imgui_mingw64/3rdparty/imgui/imgui_impl_glfw.cpp:482: undefined reference to `glfwCreateStandardCursor'
E:/SouceCode/C++_CODE/C++_Multiple/Mes_Imgui_mingw64/3rdparty/imgui/imgui_impl_glfw.cpp:483: undefined reference to `glfwCreateStandardCursor'
E:/SouceCode/C++_CODE/C++_Multiple/Mes_Imgui_mingw64/3rdparty/imgui/imgui_impl_glfw.cpp:484: undefined reference to `glfwCreateStandardCursor'
E:/SouceCode/C++_CODE/C++_Multiple/Mes_Imgui_mingw64/3rdparty/imgui/imgui_impl_glfw.cpp:485: undefined reference to `glfwCreateStandardCursor'
E:/SouceCode/C++_CODE/C++_Multiple/Mes_Imgui_mingw64/3rdparty/imgui/imgui_impl_glfw.cpp:486: undefined reference to `glfwCreateStandardCursor'
3rdparty/imgui/libIMGUI_LIB.a(imgui_impl_glfw.cpp.obj):E:/SouceCode/C++_CODE/C++_Multiple/Mes_Imgui_mingw64/3rdparty/imgui/imgui_impl_glfw.cpp:488: more undefined references to `glfwCreateStandardCursor' follow
3rdparty/imgui/libIMGUI_LIB.a(imgui_impl_glfw.cpp.obj): In function `ImGui_ImplGlfw_Init':
E:/SouceCode/C++_CODE/C++_Multiple/Mes_Imgui_mingw64/3rdparty/imgui/imgui_impl_glfw.cpp:499: undefined reference to `glfwGetError'
E:/SouceCode/C++_CODE/C++_Multiple/Mes_Imgui_mingw64/3rdparty/imgui/imgui_impl_glfw.cpp:501: undefined reference to `glfwSetErrorCallback'
3rdparty/imgui/libIMGUI_LIB.a(imgui_impl_glfw.cpp.obj): In function `ImGui_ImplGlfw_Shutdown()':
E:/SouceCode/C++_CODE/C++_Multiple/Mes_Imgui_mingw64/3rdparty/imgui/imgui_impl_glfw.cpp:536: undefined reference to `glfwDestroyCursor'
3rdparty/imgui/libIMGUI_LIB.a(imgui_impl_glfw.cpp.obj): In function `ImGui_ImplGlfw_UpdateMouseData':
E:/SouceCode/C++_CODE/C++_Multiple/Mes_Imgui_mingw64/3rdparty/imgui/imgui_impl_glfw.cpp:548: undefined reference to `glfwGetInputMode'
E:/SouceCode/C++_CODE/C++_Multiple/Mes_Imgui_mingw64/3rdparty/imgui/imgui_impl_glfw.cpp:557: undefined reference to `glfwGetWindowAttrib'
E:/SouceCode/C++_CODE/C++_Multiple/Mes_Imgui_mingw64/3rdparty/imgui/imgui_impl_glfw.cpp:563: undefined reference to `glfwSetCursorPos'
E:/SouceCode/C++_CODE/C++_Multiple/Mes_Imgui_mingw64/3rdparty/imgui/imgui_impl_glfw.cpp:569: undefined reference to `glfwGetCursorPos'
3rdparty/imgui/libIMGUI_LIB.a(imgui_impl_glfw.cpp.obj): In function `ImGui_ImplGlfw_UpdateMouseCursor':
E:/SouceCode/C++_CODE/C++_Multiple/Mes_Imgui_mingw64/3rdparty/imgui/imgui_impl_glfw.cpp:580: undefined reference to `glfwGetInputMode'
E:/SouceCode/C++_CODE/C++_Multiple/Mes_Imgui_mingw64/3rdparty/imgui/imgui_impl_glfw.cpp:587: undefined reference to `glfwSetInputMode'
E:/SouceCode/C++_CODE/C++_Multiple/Mes_Imgui_mingw64/3rdparty/imgui/imgui_impl_glfw.cpp:593: undefined reference to `glfwSetCursor'
E:/SouceCode/C++_CODE/C++_Multiple/Mes_Imgui_mingw64/3rdparty/imgui/imgui_impl_glfw.cpp:594: undefined reference to `glfwSetInputMode'
3rdparty/imgui/libIMGUI_LIB.a(imgui_impl_glfw.cpp.obj): In function `ImGui_ImplGlfw_UpdateGamepads':
E:/SouceCode/C++_CODE/C++_Multiple/Mes_Imgui_mingw64/3rdparty/imgui/imgui_impl_glfw.cpp:609: undefined reference to `glfwGetGamepadState'
3rdparty/imgui/libIMGUI_LIB.a(imgui_impl_glfw.cpp.obj): In function `ImGui_ImplGlfw_NewFrame()':
E:/SouceCode/C++_CODE/C++_Multiple/Mes_Imgui_mingw64/3rdparty/imgui/imgui_impl_glfw.cpp:660: undefined reference to `glfwGetWindowSize'
E:/SouceCode/C++_CODE/C++_Multiple/Mes_Imgui_mingw64/3rdparty/imgui/imgui_impl_glfw.cpp:661: undefined reference to `glfwGetFramebufferSize'
E:/SouceCode/C++_CODE/C++_Multiple/Mes_Imgui_mingw64/3rdparty/imgui/imgui_impl_glfw.cpp:667: undefined reference to `glfwGetTime'
collect2.exe: error: ld returned 1 exit status
make[2]: *** [CMakeFiles\IMGUI_DEMO.dir\build.make:105: IMGUI_DEMO.exe] Error 1
make[1]: *** [CMakeFiles\Makefile2:152: CMakeFiles/IMGUI_DEMO.dir/all] Error 2
make: *** [Makefile:90: all] Error 2

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.