From 1e08c45f0cd7ba52fb39741e3ef30ca83da57fea Mon Sep 17 00:00:00 2001 From: det-fys Date: Sun, 22 Sep 2024 10:49:50 +0200 Subject: [PATCH] add glm, fix project name --- .gitignore | 3 ++- Build.cmd | 2 +- CMakeLists.txt | 16 +++++++++------- Run.cmd | 2 +- src/main.cpp | 3 ++- 5 files changed, 15 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index 078e6db..6aaa120 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ +.vs/ +.vscode/ build/ bin/ out/ -*.log diff --git a/Build.cmd b/Build.cmd index f3041b0..b241b1b 100644 --- a/Build.cmd +++ b/Build.cmd @@ -27,7 +27,7 @@ echo: echo Kopiruji exe do bin... echo: -copy %BUILD_TYPE%\MyOpenGLApp.exe ..\bin\MyOpenGLApp.exe +copy %BUILD_TYPE%\MyOpenGLProject.exe ..\bin\MyOpenGLProject.exe echo: echo Hotovo diff --git a/CMakeLists.txt b/CMakeLists.txt index d027294..2c040d1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,12 +10,13 @@ if(WIN32) # Use FetchContent to download GLFW and ImGui include(FetchContent) + # download GLM FetchContent_Declare( - glad - GIT_REPOSITORY https://github.com/Dav1dde/glad.git - GIT_TAG v2.0.7 # Latest version at the time of writing + glm + GIT_REPOSITORY https://github.com/g-truc/glm.git + GIT_TAG bf71a834948186f4097caa076cd2663c69a10e1e #refs/tags/1.0.1 ) - FetchContent_MakeAvailable(glad) + FetchContent_MakeAvailable(glm) # Download GLFW FetchContent_Declare( @@ -55,10 +56,10 @@ if(WIN32) ) # Define your executable and include ImGui and backend sources - add_executable(MyOpenGLApp WIN32 ${APP_SOURCES} ${IMGUI_SOURCES}) + add_executable(${PROJECT_NAME} WIN32 ${APP_SOURCES} ${IMGUI_SOURCES}) # Include directories for ImGui, GLEW, and GLFW - target_include_directories(MyOpenGLApp PRIVATE + target_include_directories(${PROJECT_NAME} PRIVATE ${imgui_SOURCE_DIR} ${IMGUI_BACKENDS} ${glfw_SOURCE_DIR}/include @@ -66,9 +67,10 @@ if(WIN32) ) # Link against Windows-specific libraries, GLEW, GLFW, and OpenGL - target_link_libraries(MyOpenGLApp PRIVATE + target_link_libraries(${PROJECT_NAME} PRIVATE glfw glad + glm::glm ) # Define GLEW_STATIC for static linking of GLEW diff --git a/Run.cmd b/Run.cmd index 20251fc..48d6aa0 100644 --- a/Run.cmd +++ b/Run.cmd @@ -1 +1 @@ -start /D bin MyOpenGLApp +start /D bin MyOpenGLProject diff --git a/src/main.cpp b/src/main.cpp index 2f4c0f8..87828b5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3,6 +3,7 @@ #include "imgui.h" #include "imgui_impl_glfw.h" #include "imgui_impl_opengl3.h" +//#include #include #define NOMINMAX @@ -48,7 +49,7 @@ int main() { IMGUI_CHECKVERSION(); ImGui::CreateContext(); ImGuiIO& io = ImGui::GetIO(); //(void)io; - io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\segoeui.ttf", 18); + // io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\segoeui.ttf", 18); // Setup Dear ImGui style ImGui::StyleColorsDark();