Add Back GLFW Support

This commit is contained in:
TheBrokenRail 2023-08-04 22:13:08 -04:00
parent 1f14454d63
commit 38d17dd080
2 changed files with 19 additions and 2 deletions

View File

@ -12,11 +12,22 @@ embed_resource(gles-compatibility-layer src/shaders/main.fsh)
# Warnings # Warnings
target_compile_options(gles-compatibility-layer PRIVATE -Wall -Wextra -Werror -Wpointer-arith -Wshadow -Wnull-dereference) target_compile_options(gles-compatibility-layer PRIVATE -Wall -Wextra -Werror -Wpointer-arith -Wshadow -Wnull-dereference)
# GLFW/SDL
option(GLES_COMPATIBILITY_LAYER_USE_SDL "Use SDL" TRUE)
if(GLES_COMPATIBILITY_LAYER_USE_SDL)
target_compile_definitions(gles-compatibility-layer PUBLIC GLES_COMPATIBILITY_LAYER_USE_SDL)
endif()
# Dependencies # Dependencies
set(GLES_COMPATIBILITY_LAYER_DEPENDENCY "" CACHE STRING "Compatibility Layer Dependency") set(GLES_COMPATIBILITY_LAYER_DEPENDENCY "" CACHE STRING "Compatibility Layer Dependency")
if(NOT GLES_COMPATIBILITY_LAYER_DEPENDENCY) if(NOT GLES_COMPATIBILITY_LAYER_DEPENDENCY)
find_package(SDL2 REQUIRED) if(gles-compatibility-layer)
target_link_libraries(gles-compatibility-layer SDL2::SDL2) find_package(SDL2 REQUIRED)
target_link_libraries(gles-compatibility-layer SDL2::SDL2)
else()
find_package(glfw3 3.3 REQUIRED)
target_link_libraries(gles-compatibility-layer glfw)
endif()
else() else()
target_link_libraries(gles-compatibility-layer "${GLES_COMPATIBILITY_LAYER_DEPENDENCY}") target_link_libraries(gles-compatibility-layer "${GLES_COMPATIBILITY_LAYER_DEPENDENCY}")
endif() endif()

View File

@ -1,4 +1,10 @@
#ifdef GLES_COMPATIBILITY_LAYER_USE_SDL
#include <SDL.h> #include <SDL.h>
#else
#define GLFW_INCLUDE_NONE
#include <GLFW/glfw3.h>
#define SDL_GL_GetProcAddress glfwGetProcAddress
#endif
#include "log.h" #include "log.h"