Skip to content

Commit

Permalink
Remove linking against unused GLEW on GNU/Linux. (#420)
Browse files Browse the repository at this point in the history
* Remove linking against unused GLEW on GNU/Linux.

* Use SDL OpenGL headers instead of GLEW headers.

* Try to fix Mac OS building.

* Try to fix MSVC building.

* Remove residual GLEW linking on Windows and Mac OS too.

* Revert "Remove residual GLEW linking on Windows and Mac OS too."

This reverts commit d3fcf48.

* Revert "Try to fix MSVC building."

This reverts commit 480b2d1.

* Revert "Try to fix Mac OS building."

This reverts commit 5f0de0b.

* Revert "Use SDL OpenGL headers instead of GLEW headers."

This reverts commit fdf95bd.

* Use proper SDL2 OpenGL header instead of GLEW headers GNU/Linux.
  • Loading branch information
vanfanel authored Feb 8, 2024
1 parent 21a5df5 commit bd20dd4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
5 changes: 2 additions & 3 deletions extern/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,11 @@ elseif (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_ARC YES
)
elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux")
find_package(GLEW REQUIRED)
if (DEFINED USE_OPENGLES)
target_link_libraries(ImGui PUBLIC ${OPENGL_GLESv2_LIBRARY} GLEW::GLEW)
target_link_libraries(ImGui PUBLIC ${OPENGL_GLESv2_LIBRARY})
add_compile_definitions(IMGUI_IMPL_OPENGL_ES3)
else()
target_link_libraries(ImGui PUBLIC ${OPENGL_opengl_LIBRARY} GLEW::GLEW)
target_link_libraries(ImGui PUBLIC ${OPENGL_opengl_LIBRARY})
endif()
endif()

Expand Down
5 changes: 2 additions & 3 deletions src/graphic/Fast3D/gfx_opengl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,8 @@
#include <GLES3/gl3.h>
#else
#include <SDL2/SDL.h>
#include <GL/glew.h>
#define GL_GLEXT_PROTOTYPES 1
// #include <SDL2/SDL_opengles2.h>
#include <SDL2/SDL_opengl.h>
#endif

#include "gfx_cc.h"
Expand Down Expand Up @@ -847,7 +846,7 @@ static void gfx_opengl_draw_triangles(float buf_vbo[], size_t buf_vbo_len, size_
}

static void gfx_opengl_init(void) {
#if !defined(__SWITCH__) && !defined(USE_OPENGLES)
#if !defined(__SWITCH__) && !defined(__linux__)
glewInit();
#endif

Expand Down

0 comments on commit bd20dd4

Please sign in to comment.