handle custom platform

This commit is contained in:
Yan Pujante 2023-12-01 11:24:37 -08:00
parent 0748dc2d1e
commit 30ccc969de
22 changed files with 3514 additions and 10 deletions

View File

@ -1,4 +1,13 @@
cmake_minimum_required(VERSION 3.0) cmake_minimum_required(VERSION 3.0)
# Directory for easier includes
# Anywhere you see include(...) you can check <root>/cmake for that file
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
include(CustomPlatform)
custom_platform_include_if_exists("raylibPlatformCustomProjectConfig")
project(raylib) project(raylib)
# Avoid excessive expansion of variables in conditionals. In particular, if # Avoid excessive expansion of variables in conditionals. In particular, if
@ -18,9 +27,6 @@ cmake_policy(SET CMP0054 NEW)
# See https://cmake.org/cmake/help/latest/policy/CMP0063.html # See https://cmake.org/cmake/help/latest/policy/CMP0063.html
cmake_policy(SET CMP0063 NEW) cmake_policy(SET CMP0063 NEW)
# Directory for easier includes
# Anywhere you see include(...) you can check <root>/cmake for that file
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
# RAYLIB_IS_MAIN determines whether the project is being used from root # RAYLIB_IS_MAIN determines whether the project is being used from root
# or if it is added as a dependency (through add_subdirectory for example). # or if it is added as a dependency (through add_subdirectory for example).

View File

@ -2,7 +2,7 @@
include(CMakeDependentOption) include(CMakeDependentOption)
include(EnumOption) include(EnumOption)
enum_option(PLATFORM "Desktop;Web;Android;Raspberry Pi;DRM" "Platform to build for.") enum_option(PLATFORM "Desktop;Web;Android;Raspberry Pi;DRM;Custom" "Platform to build for.")
enum_option(OPENGL_VERSION "OFF;4.3;3.3;2.1;1.1;ES 2.0;ES 3.0" "Force a specific OpenGL Version?") enum_option(OPENGL_VERSION "OFF;4.3;3.3;2.1;1.1;ES 2.0;ES 3.0" "Force a specific OpenGL Version?")

View File

@ -11,7 +11,7 @@ endif()
# This helps support the case where emsdk toolchain file is used # This helps support the case where emsdk toolchain file is used
# either by setting it with -DCMAKE_TOOLCHAIN_FILE=<path_to_emsdk>/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake # either by setting it with -DCMAKE_TOOLCHAIN_FILE=<path_to_emsdk>/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake
# or by using "emcmake cmake -B build -S ." as described in https://emscripten.org/docs/compiling/Building-Projects.html # or by using "emcmake cmake -B build -S ." as described in https://emscripten.org/docs/compiling/Building-Projects.html
if(EMSCRIPTEN) if(EMSCRIPTEN AND NOT ${PLATFORM} MATCHES "Custom")
SET(PLATFORM Web CACHE STRING "Forcing PLATFORM_WEB because EMSCRIPTEN was detected") SET(PLATFORM Web CACHE STRING "Forcing PLATFORM_WEB because EMSCRIPTEN was detected")
endif() endif()

View File

@ -2,6 +2,11 @@
target_compile_definitions("raylib" PUBLIC "${PLATFORM_CPP}") target_compile_definitions("raylib" PUBLIC "${PLATFORM_CPP}")
target_compile_definitions("raylib" PUBLIC "${GRAPHICS}") target_compile_definitions("raylib" PUBLIC "${GRAPHICS}")
if("${PLATFORM}" MATCHES "Custom")
target_compile_definitions("raylib" PUBLIC "PLATFORM_CUSTOM_DEFINES=\"${PLATFORM_CUSTOM_DEFINES}\"")
target_compile_definitions("raylib" PUBLIC "PLATFORM_CUSTOM_RCORE_IMPL=\"${PLATFORM_CUSTOM_RCORE_IMPL}\"")
endif()
function(define_if target variable) function(define_if target variable)
if (${${variable}}) if (${${variable}})
message(STATUS "${variable}=${${variable}}") message(STATUS "${variable}=${${variable}}")

View File

@ -0,0 +1,9 @@
macro(custom_platform_include_if_exists file)
if("${PLATFORM}" MATCHES "Custom")
if (EXISTS "${PLATFORM_CUSTOM_ROOT_DIR}/cmake/${file}.cmake")
include("${PLATFORM_CUSTOM_ROOT_DIR}/cmake/${file}.cmake")
else ()
message(STATUS "No file ${PLATFORM_CUSTOM_ROOT_DIR}/cmake/${file}.cmake detected... skipped")
endif ()
endif()
endmacro()

View File

@ -91,6 +91,8 @@ elseif ("${PLATFORM}" MATCHES "DRM")
endif () endif ()
set(LIBS_PRIVATE ${GLESV2} ${EGL} ${DRM} ${GBM} atomic pthread m dl) set(LIBS_PRIVATE ${GLESV2} ${EGL} ${DRM} ${GBM} atomic pthread m dl)
elseif ("${PLATFORM}" MATCHES "Custom")
set(PLATFORM_CPP "PLATFORM_CUSTOM")
endif () endif ()
if (NOT ${OPENGL_VERSION} MATCHES "OFF") if (NOT ${OPENGL_VERSION} MATCHES "OFF")

26
external/README.md vendored Normal file
View File

@ -0,0 +1,26 @@
For the sake of this PR, this folder was added to demonstrate what a custom platform look like as well
as how to use a custom platform
* `custom_platforms/custom_platform_1`: clone of the web platform
* `custom_platforms/custom_platform_2`: clone of the desktop platform
* `examples/example_for_custom_platform_1`: example using the custom_platform_1
How to build (use emscripten since it is a web platform: make sure you use the proper locations)
```text
mkdir build
cd build
cmake -DCMAKE_TOOLCHAIN_FILE=/usr/local/emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -DEMSDK=/usr/local/emsdk -DPLATFORM=Custom -DCMAKE_BUILD_TYPE=Debug ..
cmake --build . --target example_for_custom_platform_1
```
* `examples/example_for_custom_platform_2`: example using the custom_platform_2
How to build:
```text
mkdir build
cd build
cmake -DPLATFORM=Custom -DCMAKE_BUILD_TYPE=Debug ..
cmake --build . --target example_for_custom_platform_2
```

View File

@ -0,0 +1,5 @@
message(STATUS "From raylibPlatformCustomLibraryConfig (Custom platform 1 (Web)")
set(GRAPHICS "GRAPHICS_API_OPENGL_ES2")
set(CMAKE_LD_FLAGS "${CMAKE_LD_FLAGS} -s USE_GLFW=3 -s ASSERTIONS=1 --profiling")
set(CMAKE_STATIC_LIBRARY_SUFFIX ".a")

View File

@ -0,0 +1,3 @@
message(STATUS "From raylibPlatformCustomTargetConfig (Custom platform 1 (Web)")
target_link_options(raylib PRIVATE "-sUSE_GLFW=3")

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,36 @@
/*******************************************************************************************
* raylib_platform_custom.h
*
* Custom Platform definition file
*
* LICENSE: zlib/libpng
*
* Copyright (c) 2023 Yan Pujante
*
* This software is provided "as-is", without any express or implied warranty. In no event
* will the authors be held liable for any damages arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose, including commercial
* applications, and to alter it and redistribute it freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not claim that you
* wrote the original software. If you use this software in a product, an acknowledgment
* in the product documentation would be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and must not be misrepresented
* as being the original software.
*
* 3. This notice may not be removed or altered from any source distribution.
*
**********************************************************************************************/
#ifndef RAYLIB_PLATFORM_CUSTOM_H
#define RAYLIB_PLATFORM_CUSTOM_H
#define PLATFORM_CUSTOM_ID "platform_custom_1"
#define PLATFORM_CUSTOM_BACKEND "Platform backend: Custom Platform 1 (Web clone)"
#define PLATFORM_CUSTOM_CLOCK_MONOTONIC
// #define PLATFORM_CUSTOM_DISABLE_HI_RES_TIMER
// #define PLATFORM_CUSTOM_ENABLE_OPENGL_ES2
#endif //RAYLIB_PLATFORM_CUSTOM_H

View File

@ -0,0 +1,70 @@
message(STATUS "From aylibPlatformCustomLibraryConfig (Custom platform 2 (Desktop)")
if (APPLE)
# Need to force OpenGL 3.3 on OS X
# See: https://github.com/raysan5/raylib/issues/341
set(GRAPHICS "GRAPHICS_API_OPENGL_33")
find_library(OPENGL_LIBRARY OpenGL)
set(LIBS_PRIVATE ${OPENGL_LIBRARY})
link_libraries("${LIBS_PRIVATE}")
if (NOT CMAKE_SYSTEM STRLESS "Darwin-18.0.0")
add_definitions(-DGL_SILENCE_DEPRECATION)
MESSAGE(AUTHOR_WARNING "OpenGL is deprecated starting with macOS 10.14 (Mojave)!")
endif ()
elseif (WIN32)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
find_package(OpenGL QUIET)
set(LIBS_PRIVATE ${OPENGL_LIBRARIES} winmm)
elseif (UNIX)
find_library(pthread NAMES pthread)
find_package(OpenGL QUIET)
if ("${OPENGL_LIBRARIES}" STREQUAL "")
set(OPENGL_LIBRARIES "GL")
endif ()
if ("${CMAKE_SYSTEM_NAME}" MATCHES "(Net|Open)BSD")
find_library(OSS_LIBRARY ossaudio)
endif ()
set(LIBS_PRIVATE m pthread ${OPENGL_LIBRARIES} ${OSS_LIBRARY})
else ()
find_library(pthread NAMES pthread)
find_package(OpenGL QUIET)
if ("${OPENGL_LIBRARIES}" STREQUAL "")
set(OPENGL_LIBRARIES "GL")
endif ()
set(LIBS_PRIVATE m atomic pthread ${OPENGL_LIBRARIES} ${OSS_LIBRARY})
if ("${CMAKE_SYSTEM_NAME}" MATCHES "(Net|Open)BSD")
find_library(OSS_LIBRARY ossaudio)
set(LIBS_PRIVATE m pthread ${OPENGL_LIBRARIES} ${OSS_LIBRARY})
endif ()
if (NOT "${CMAKE_SYSTEM_NAME}" MATCHES "(Net|Open)BSD" AND USE_AUDIO)
set(LIBS_PRIVATE ${LIBS_PRIVATE} dl)
endif ()
endif ()
if("${GLFW_ROOT_DIR}" STREQUAL "")
message(FATAL_ERROR "This platform requires glfw. Provide its location via GLFW_ROOT_DIR")
endif()
message(STATUS "Using glfw from ${GLFW_ROOT_DIR}")
set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
set(GLFW_INSTALL OFF CACHE BOOL "" FORCE)
set(GLFW_USE_WAYLAND ${USE_WAYLAND} CACHE BOOL "" FORCE)
set(GLFW_LIBRARY_TYPE "STATIC" CACHE STRING "" FORCE)
add_subdirectory("${GLFW_ROOT_DIR}")
# Hide glfw's symbols when building a shared lib
if (BUILD_SHARED_LIBS)
set_property(TARGET glfw PROPERTY C_VISIBILITY_PRESET hidden)
endif()
include_directories(BEFORE SYSTEM "${GLFW_ROOT_DIR}/include")
set(LIBS_PRIVATE ${LIBS_PRIVATE} glfw)

View File

@ -0,0 +1,12 @@
message(STATUS "From raylibPlatformCustomProjectConfig (Custom platform 2 (Desktop)")
# Note that changing CMAKE_OSX_ARCHITECTURES should be done BEFORE project()
if(APPLE)
if(MACOS_FATLIB)
if (CMAKE_OSX_ARCHITECTURES)
message(FATAL_ERROR "User supplied -DCMAKE_OSX_ARCHITECTURES overrides -DMACOS_FATLIB=ON")
else()
set(CMAKE_OSX_ARCHITECTURES "x86_64;i386")
endif()
endif()
endif()

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,36 @@
/*******************************************************************************************
* raylib_platform_custom.h
*
* Custom Platform definition file
*
* LICENSE: zlib/libpng
*
* Copyright (c) 2023 Yan Pujante
*
* This software is provided "as-is", without any express or implied warranty. In no event
* will the authors be held liable for any damages arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose, including commercial
* applications, and to alter it and redistribute it freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not claim that you
* wrote the original software. If you use this software in a product, an acknowledgment
* in the product documentation would be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and must not be misrepresented
* as being the original software.
*
* 3. This notice may not be removed or altered from any source distribution.
*
**********************************************************************************************/
#ifndef RAYLIB_PLATFORM_CUSTOM_H
#define RAYLIB_PLATFORM_CUSTOM_H
#define PLATFORM_CUSTOM_ID "platform_custom_2"
#define PLATFORM_CUSTOM_BACKEND "Platform backend: Custom Platform 2 (Desktop clone)"
// #define PLATFORM_CUSTOM_CLOCK_MONOTONIC
// #define PLATFORM_CUSTOM_DISABLE_HI_RES_TIMER
#define PLATFORM_CUSTOM_ENABLE_OPENGL_ES2
#endif //RAYLIB_PLATFORM_CUSTOM_H

View File

@ -0,0 +1,38 @@
cmake_minimum_required(VERSION 3.0)
# This should be absolute to where raylib lives
set(RAYLIB_ROOT_DIR "${CMAKE_CURRENT_LIST_DIR}/../../..")
if(PLATFORM STREQUAL "Custom")
set(PLATFORM_CUSTOM_ROOT_DIR "${CMAKE_CURRENT_LIST_DIR}/../../custom_platforms/custom_platform_1")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --profiling-funcs -s USE_GLFW=3 -s ASSERTIONS=1 -s WASM=1 -s ASYNCIFY -s SAFE_HEAP=1")
endif()
project(example_for_custom_platform_1 LANGUAGES CXX)
set(target "example_for_custom_platform_1")
set(CMAKE_CXX_STANDARD 17)
#######################################################
# adding raylib
# Note: raylib is bundled in this project but could
# easily be fetched instead
#######################################################
add_subdirectory("${RAYLIB_ROOT_DIR}" raylib EXCLUDE_FROM_ALL)
#######################################################
# Main executable
#######################################################
add_executable(${target} main.cpp)
target_link_libraries(${target} PUBLIC raylib)
if(PLATFORM STREQUAL "Custom")
set(CMAKE_EXECUTABLE_SUFFIX ".html")
set(EMSDK "$ENV{EMSDK}" CACHE PATH "Location of the emscript sdk")
if("${EMSDK}" STREQUAL "")
message(FATAL_ERROR "Make sure you define the variable EMSDK (either as an environment variable or as a CMake -DEMSDK=... option).")
endif()
target_include_directories(${target} PUBLIC "${EMSDK}/emscripten/main/cache/sysroot/include")
endif()

View File

@ -0,0 +1,28 @@
#include "raylib.h"
static char BUF[1024];
int main()
{
double width = 850;
double height = 450;
SetConfigFlags(FLAG_WINDOW_RESIZABLE);
InitWindow((int) width, (int) height, "raylib custom platform 1 (web)");
SetTargetFPS(60);
while (!WindowShouldClose())
{
BeginDrawing();
ClearBackground(RAYWHITE);
DrawText("Congrats! You created your first window!", 10, 40, 20, LIGHTGRAY);
DrawLine(0, 0, GetScreenWidth(), GetScreenHeight(), RED);
DrawFPS(10, 70);
EndDrawing();
}
CloseWindow();
return 0;
}

View File

@ -0,0 +1,30 @@
cmake_minimum_required(VERSION 3.0)
# This should be absolute to where raylib lives
set(RAYLIB_ROOT_DIR "${CMAKE_CURRENT_LIST_DIR}/../../..")
if(PLATFORM STREQUAL "Custom")
# custom_platform_2 requires GLFW_ROOT_DIR to be set
set(GLFW_ROOT_DIR "${RAYLIB_ROOT_DIR}/src/external/glfw")
set(PLATFORM_CUSTOM_ROOT_DIR "${CMAKE_CURRENT_LIST_DIR}/../../custom_platforms/custom_platform_2")
endif()
project(example_for_custom_platform_2 LANGUAGES CXX)
set(target "example_for_custom_platform_2")
set(CMAKE_CXX_STANDARD 17)
#######################################################
# adding raylib
# Note: raylib is bundled in this project but could
# easily be fetched instead
#######################################################
add_subdirectory("${RAYLIB_ROOT_DIR}" raylib EXCLUDE_FROM_ALL)
#######################################################
# Main executable
#######################################################
add_executable(${target} main.cpp)
target_link_libraries(${target} PUBLIC raylib)

View File

@ -0,0 +1,28 @@
#include "raylib.h"
static char BUF[1024];
int main()
{
double width = 850;
double height = 450;
SetConfigFlags(FLAG_WINDOW_RESIZABLE);
InitWindow((int) width, (int) height, "raylib custom platform 1 (web)");
SetTargetFPS(60);
while (!WindowShouldClose())
{
BeginDrawing();
ClearBackground(RAYWHITE);
DrawText("Congrats! You created your first window!", 10, 40, 20, LIGHTGRAY);
DrawLine(0, 0, GetScreenWidth(), GetScreenHeight(), RED);
DrawFPS(10, 70);
EndDrawing();
}
CloseWindow();
return 0;
}

View File

@ -5,6 +5,7 @@ set(API_VERSION 450)
include(GNUInstallDirs) include(GNUInstallDirs)
include(JoinPaths) include(JoinPaths)
include(CustomPlatform)
# Sets build type if not set by now # Sets build type if not set by now
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
@ -38,7 +39,7 @@ set(raylib_sources
) )
# <root>/cmake/GlfwImport.cmake handles the details around the inclusion of glfw # <root>/cmake/GlfwImport.cmake handles the details around the inclusion of glfw
if (NOT ${PLATFORM} MATCHES "Web") if (NOT ${PLATFORM} MATCHES "Web" AND NOT ${PLATFORM} MATCHES "Custom")
include(GlfwImport) include(GlfwImport)
endif () endif ()
@ -47,6 +48,8 @@ endif ()
# Produces a variable LIBS_PRIVATE that will be used later # Produces a variable LIBS_PRIVATE that will be used later
include(LibraryConfigurations) include(LibraryConfigurations)
custom_platform_include_if_exists("raylibPlatformCustomLibraryConfig")
if (USE_AUDIO) if (USE_AUDIO)
MESSAGE(STATUS "Audio Backend: miniaudio") MESSAGE(STATUS "Audio Backend: miniaudio")
list(APPEND raylib_sources raudio.c) list(APPEND raylib_sources raudio.c)
@ -105,6 +108,12 @@ target_include_directories(raylib
${OPENAL_INCLUDE_DIR} ${OPENAL_INCLUDE_DIR}
) )
if("${PLATFORM}" MATCHES "Custom")
target_include_directories(raylib PUBLIC "${PLATFORM_CUSTOM_ROOT_DIR}/src")
endif()
custom_platform_include_if_exists("raylibPlatformCustomTargetConfig")
# Copy the header files to the build directory for convenience # Copy the header files to the build directory for convenience
file(COPY ${raylib_public_headers} DESTINATION "include") file(COPY ${raylib_public_headers} DESTINATION "include")

View File

@ -235,7 +235,11 @@ __declspec(dllimport) int __stdcall WideCharToMultiByte(unsigned int cp, unsigne
#define FLAG_TOGGLE(n, f) ((n) ^= (f)) #define FLAG_TOGGLE(n, f) ((n) ^= (f))
#define FLAG_CHECK(n, f) ((n) & (f)) #define FLAG_CHECK(n, f) ((n) & (f))
#if (defined(__linux__) || defined(PLATFORM_WEB)) && (_POSIX_C_SOURCE < 199309L) #if defined(PLATFORM_CUSTOM)
#include "raylib_platform_custom.h"
#endif
#if (defined(__linux__) || defined(PLATFORM_WEB) || defined(PLATFORM_CUSTOM_CLOCK_MONOTONIC)) && (_POSIX_C_SOURCE < 199309L)
#undef _POSIX_C_SOURCE #undef _POSIX_C_SOURCE
#define _POSIX_C_SOURCE 199309L // Required for: CLOCK_MONOTONIC if compiled with c99 without gnu ext. #define _POSIX_C_SOURCE 199309L // Required for: CLOCK_MONOTONIC if compiled with c99 without gnu ext.
#endif #endif
@ -491,6 +495,8 @@ const char *TextFormat(const char *text, ...); // Formatting of tex
#include "platforms/rcore_drm.c" #include "platforms/rcore_drm.c"
#elif defined(PLATFORM_ANDROID) #elif defined(PLATFORM_ANDROID)
#include "platforms/rcore_android.c" #include "platforms/rcore_android.c"
#elif defined(PLATFORM_CUSTOM)
#include "raylib_platform_custom.c"
#else #else
// TODO: Include your custom platform backend! // TODO: Include your custom platform backend!
// i.e software rendering backend or console backend! // i.e software rendering backend or console backend!
@ -559,6 +565,8 @@ void InitWindow(int width, int height, const char *title)
TRACELOG(LOG_INFO, "Platform backend: NATIVE DRM"); TRACELOG(LOG_INFO, "Platform backend: NATIVE DRM");
#elif defined(PLATFORM_ANDROID) #elif defined(PLATFORM_ANDROID)
TRACELOG(LOG_INFO, "Platform backend: ANDROID"); TRACELOG(LOG_INFO, "Platform backend: ANDROID");
#elif defined(PLATFORM_CUSTOM)
TRACELOG(LOG_INFO, PLATFORM_CUSTOM_BACKEND);
#else #else
// TODO: Include your custom platform backend! // TODO: Include your custom platform backend!
// i.e software rendering backend or console backend! // i.e software rendering backend or console backend!
@ -3046,7 +3054,7 @@ void InitTimer(void)
// However, it can also reduce overall system performance, because the thread scheduler switches tasks more often. // However, it can also reduce overall system performance, because the thread scheduler switches tasks more often.
// High resolutions can also prevent the CPU power management system from entering power-saving modes. // High resolutions can also prevent the CPU power management system from entering power-saving modes.
// Setting a higher resolution does not improve the accuracy of the high-resolution performance counter. // Setting a higher resolution does not improve the accuracy of the high-resolution performance counter.
#if defined(_WIN32) && defined(SUPPORT_WINMM_HIGHRES_TIMER) && !defined(SUPPORT_BUSY_WAIT_LOOP) && !defined(PLATFORM_DESKTOP_SDL) #if defined(_WIN32) && defined(SUPPORT_WINMM_HIGHRES_TIMER) && !defined(SUPPORT_BUSY_WAIT_LOOP) && !defined(PLATFORM_DESKTOP_SDL) && !defined(PLATFORM_CUSTOM_DISABLE_HI_RES_TIMER)
timeBeginPeriod(1); // Setup high-resolution timer to 1ms (granularity of 1-2 ms) timeBeginPeriod(1); // Setup high-resolution timer to 1ms (granularity of 1-2 ms)
#endif #endif

View File

@ -324,6 +324,10 @@
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Types and Structures Definition // Types and Structures Definition
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
#if defined(PLATFORM_CUSTOM)
#include "raylib_platform_custom.h"
#endif
#if (defined(__STDC__) && __STDC_VERSION__ >= 199901L) || (defined(_MSC_VER) && _MSC_VER >= 1800) #if (defined(__STDC__) && __STDC_VERSION__ >= 199901L) || (defined(_MSC_VER) && _MSC_VER >= 1800)
#include <stdbool.h> #include <stdbool.h>
#elif !defined(__cplusplus) && !defined(bool) && !defined(RL_BOOL_TYPE) #elif !defined(__cplusplus) && !defined(bool) && !defined(RL_BOOL_TYPE)
@ -818,7 +822,7 @@ RLAPI void rlLoadDrawQuad(void); // Load and draw a quad
#elif defined(GRAPHICS_API_OPENGL_ES2) #elif defined(GRAPHICS_API_OPENGL_ES2)
// NOTE: OpenGL ES 2.0 can be enabled on PLATFORM_DESKTOP, // NOTE: OpenGL ES 2.0 can be enabled on PLATFORM_DESKTOP,
// in that case, functions are loaded from a custom glad for OpenGL ES 2.0 // in that case, functions are loaded from a custom glad for OpenGL ES 2.0
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_DESKTOP_SDL) #if defined(PLATFORM_DESKTOP) || defined(PLATFORM_DESKTOP_SDL) || defined(PLATFORM_CUSTOM_ENABLE_OPENGL_ES2)
#define GLAD_GLES2_IMPLEMENTATION #define GLAD_GLES2_IMPLEMENTATION
#include "external/glad_gles2.h" #include "external/glad_gles2.h"
#else #else
@ -2281,7 +2285,7 @@ void rlLoadExtensions(void *loader)
#elif defined(GRAPHICS_API_OPENGL_ES2) #elif defined(GRAPHICS_API_OPENGL_ES2)
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_DESKTOP_SDL) #if defined(PLATFORM_DESKTOP) || defined(PLATFORM_DESKTOP_SDL) || defined(PLATFORM_CUSTOM_ENABLE_OPENGL_ES2)
// TODO: Support GLAD loader for OpenGL ES 3.0 // TODO: Support GLAD loader for OpenGL ES 3.0
if (gladLoadGLES2((GLADloadfunc)loader) == 0) TRACELOG(RL_LOG_WARNING, "GLAD: Cannot load OpenGL ES2.0 functions"); if (gladLoadGLES2((GLADloadfunc)loader) == 0) TRACELOG(RL_LOG_WARNING, "GLAD: Cannot load OpenGL ES2.0 functions");
else TRACELOG(RL_LOG_INFO, "GLAD: OpenGL ES 2.0 loaded successfully"); else TRACELOG(RL_LOG_INFO, "GLAD: OpenGL ES 2.0 loaded successfully");