From 6b1a2bc34ac7398bff0b181c789f4628cd9b0d93 Mon Sep 17 00:00:00 2001 From: TakesxiSximada Date: Sun, 8 Oct 2023 20:49:33 +0900 Subject: [PATCH] fix GLEW library build configuration --- evogym/simulator/CMakeLists.txt | 4 +++- evogym/simulator/FindGLEW.cmake | 23 +++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 evogym/simulator/FindGLEW.cmake diff --git a/evogym/simulator/CMakeLists.txt b/evogym/simulator/CMakeLists.txt index 09b6add4..64dc7ee8 100644 --- a/evogym/simulator/CMakeLists.txt +++ b/evogym/simulator/CMakeLists.txt @@ -19,6 +19,9 @@ endif() if(UNIX) find_package(OpenGL REQUIRED) + set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}) # use custom FindGLEW.cmake + set(GLEW_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/externals/glew/include) + set(GLEW_LIBRARY ${PROJECT_SOURCE_DIR}/externals/glew/lib/libGLEW.*) find_package(GLEW REQUIRED) endif() @@ -46,4 +49,3 @@ add_subdirectory(SimulatorCPP/) set(CMAKE_CXX_STANDARD_LIBRARIES -ldl) # set(CMAKE_VERBOSE_MAKEFILE ON) - diff --git a/evogym/simulator/FindGLEW.cmake b/evogym/simulator/FindGLEW.cmake new file mode 100644 index 00000000..04491133 --- /dev/null +++ b/evogym/simulator/FindGLEW.cmake @@ -0,0 +1,23 @@ +# FindGLEW.cmake +# Search for GLEW library and include directories + +find_path(GLEW_INCLUDE_DIR GL/glew.h) +find_library(GLEW_LIBRARY NAMES GLEW GLEW32) + +if (GLEW_INCLUDE_DIR AND GLEW_LIBRARY) + set(GLEW_FOUND TRUE) +else() + set(GLEW_FOUND FALSE) +endif() + +if (GLEW_FOUND) + if (NOT GLEW_FIND_QUIETLY) + message(STATUS "Found GLEW: ${GLEW_LIBRARY}") + endif () +else() + if (GLEW_FIND_REQUIRED) + message(FATAL_ERROR "Could NOT find GLEW") + endif () +endif() + +mark_as_advanced(GLEW_INCLUDE_DIR GLEW_LIBRARY)