From 8eface137bb182f2b30c5e047daca538e1dfca82 Mon Sep 17 00:00:00 2001 From: Cat Flynn Date: Wed, 26 Jul 2023 23:29:51 +0200 Subject: [PATCH] feat: include glew on windows chore: update window title build: link correct lib path build: copy dll to artifacts fix: remove redundant include docs: remove duplicate lines --- CMakeLists.txt | 10 ++++++++-- hello.cpp | 9 +++++---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index baa96f0..21ee535 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,7 +11,7 @@ if(WIN32) # GLEW set(GLEW_PATH "C:/libs/glew-2.2.0") include_directories(${GLEW_PATH}/include) - link_directories(${GLEW_PATH}/lib) + link_directories(${GLEW_PATH}/lib/Release/x64) # OpenGL find_package(OpenGL REQUIRED) @@ -27,8 +27,14 @@ endif() add_executable(${PROJECT_NAME} hello.cpp) if(WIN32) + add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + "${GLEW_PATH}/bin/Release/x64/glew32.dll" + $ + ) + target_link_libraries(${PROJECT_NAME} glfw3) - target_link_libraries(${PROJECT_NAME} glew) + target_link_libraries(${PROJECT_NAME} glew32) target_include_directories(${PROJECT_NAME} PRIVATE ${GLEW_INCLUDE_DIRS}) target_link_libraries(${PROJECT_NAME} OpenGL::GL) elseif(UNIX) diff --git a/hello.cpp b/hello.cpp index 50b857e..c2d74f6 100644 --- a/hello.cpp +++ b/hello.cpp @@ -2,8 +2,10 @@ // Install GLFW 3.3.8 // https://www.glfw.org/download.html -// On Windows: -// extract the downloaded .zip file to "C:/libs"; this is currently expected +// Install GLEW 2.2.0 +// https://github.com/nigels-com/glew/releases/tag/glew-2.2.0 +// +// extract the downloaded .zip files to "C:/libs"; this is currently expected // by our CMakeLists.txt. // Install CMake @@ -32,7 +34,6 @@ #include #include -#include #include @@ -41,7 +42,7 @@ int main() if (!glfwInit()) return -1; - GLFWwindow* window = glfwCreateWindow(640, 480, "Hello GL", NULL, NULL); + GLFWwindow* window = glfwCreateWindow(640, 480, "Hello GLEW", NULL, NULL); if (!window) { glfwTerminate();