2023-08-05 01:58:43 +00:00
|
|
|
cmake_minimum_required(VERSION 3.16.0)
|
|
|
|
project(gles-compatibility-layer)
|
|
|
|
|
|
|
|
# Build
|
|
|
|
add_library(gles-compatibility-layer STATIC src/state.c src/passthrough.c src/matrix.c src/draw.c)
|
2023-08-05 02:04:52 +00:00
|
|
|
target_link_libraries(gles-compatibility-layer m)
|
2023-08-05 01:58:43 +00:00
|
|
|
target_include_directories(gles-compatibility-layer PUBLIC include)
|
2023-08-05 02:47:21 +00:00
|
|
|
|
2023-08-05 01:58:43 +00:00
|
|
|
# Shaders
|
|
|
|
include(cmake/util.cmake)
|
|
|
|
embed_resource(gles-compatibility-layer src/shaders/main.vsh)
|
|
|
|
embed_resource(gles-compatibility-layer src/shaders/main.fsh)
|
2023-08-05 02:47:21 +00:00
|
|
|
|
2023-08-05 01:58:43 +00:00
|
|
|
# Warnings
|
|
|
|
target_compile_options(gles-compatibility-layer PRIVATE -Wall -Wextra -Werror -Wpointer-arith -Wshadow -Wnull-dereference)
|
2023-08-05 02:04:52 +00:00
|
|
|
|
2023-08-05 02:13:08 +00:00
|
|
|
# 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()
|
|
|
|
|
2023-08-05 02:04:52 +00:00
|
|
|
# Dependencies
|
|
|
|
set(GLES_COMPATIBILITY_LAYER_DEPENDENCY "" CACHE STRING "Compatibility Layer Dependency")
|
2023-08-05 02:47:21 +00:00
|
|
|
if(GLES_COMPATIBILITY_LAYER_DEPENDENCY STREQUAL "")
|
|
|
|
message(FATAL_ERROR aaa)
|
|
|
|
if(GLES_COMPATIBILITY_LAYER_USE_SDL)
|
2023-08-05 02:13:08 +00:00
|
|
|
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()
|
2023-08-05 02:04:52 +00:00
|
|
|
else()
|
|
|
|
target_link_libraries(gles-compatibility-layer "${GLES_COMPATIBILITY_LAYER_DEPENDENCY}")
|
|
|
|
endif()
|