Files
mcpe/source/renderer/CMakeLists.txt
2023-12-09 21:15:27 +03:00

42 lines
1.4 KiB
CMake

set(RENDER GL CACHE STRING "Active renderer")
set_property(CACHE RENDER PROPERTY STRINGS GL GLES)
#add_library(reminecraftpe-renderer STATIC)
if (RENDER STREQUAL GL)
# OpenGL
set(USE_GL 1)
set(SOURCES GL/GL.cpp GL/GL.hpp)
if(NOT EMSCRIPTEN)
option(USE_GLES1_COMPATIBILITY_LAYER "Whether To Enable The GLESv1_CM Compatibility Layer" TRUE)
else()
set(USE_GLES1_COMPATIBILITY_LAYER TRUE)
endif()
elseif (RENDER STREQUAL GLES)
# OpenGL ES
# nothing?
set(SOURCES GL/GL.cpp GL/GL.hpp)
else()
message(FATAL_ERROR "Unknown renderer!")
endif()
add_library(reminecraftpe-renderer STATIC ${SOURCES})
target_include_directories(reminecraftpe-renderer PUBLIC .)
target_include_directories(reminecraftpe-renderer PRIVATE ../..)
if (USE_GL)
if(USE_GLES1_COMPATIBILITY_LAYER)
set(GLES_COMPATIBILITY_LAYER_USE_SDL TRUE CACHE BOOL "" FORCE)
set(GLES_COMPATIBILITY_LAYER_DEPENDENCY SDL CACHE STRING "" FORCE)
add_subdirectory(../../thirdparty/gles-compatibility-layer gles-compatibility-layer)
target_link_libraries(reminecraftpe-renderer PUBLIC gles-compatibility-layer)
target_compile_definitions(reminecraftpe-renderer PUBLIC USE_GLES1_COMPATIBILITY_LAYER)
if(EMSCRIPTEN)
target_link_options(reminecraftpe-core PUBLIC -sMIN_WEBGL_VERSION=2 -sMAX_WEBGL_VERSION=2)
endif()
else()
find_package(OpenGL REQUIRED)
target_link_libraries(reminecraftpe-renderer PUBLIC OpenGL::OpenGL OpenGL::GLU)
endif()
endif()