diff --git a/CMakeLists.txt b/CMakeLists.txt index fc5c8d9..28eb52d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,11 +12,22 @@ embed_resource(gles-compatibility-layer src/shaders/main.fsh) # Warnings 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 set(GLES_COMPATIBILITY_LAYER_DEPENDENCY "" CACHE STRING "Compatibility Layer Dependency") if(NOT GLES_COMPATIBILITY_LAYER_DEPENDENCY) - find_package(SDL2 REQUIRED) - target_link_libraries(gles-compatibility-layer SDL2::SDL2) + if(gles-compatibility-layer) + 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() target_link_libraries(gles-compatibility-layer "${GLES_COMPATIBILITY_LAYER_DEPENDENCY}") endif() diff --git a/src/passthrough.h b/src/passthrough.h index 1b31172..7966589 100644 --- a/src/passthrough.h +++ b/src/passthrough.h @@ -1,4 +1,10 @@ +#ifdef GLES_COMPATIBILITY_LAYER_USE_SDL #include +#else +#define GLFW_INCLUDE_NONE +#include +#define SDL_GL_GetProcAddress glfwGetProcAddress +#endif #include "log.h"