handle custom platform

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

View file

@ -11,7 +11,7 @@ endif()
# 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
# 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")
endif()

View file

@ -2,6 +2,11 @@
target_compile_definitions("raylib" PUBLIC "${PLATFORM_CPP}")
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)
if (${${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 ()
set(LIBS_PRIVATE ${GLESV2} ${EGL} ${DRM} ${GBM} atomic pthread m dl)
elseif ("${PLATFORM}" MATCHES "Custom")
set(PLATFORM_CPP "PLATFORM_CUSTOM")
endif ()
if (NOT ${OPENGL_VERSION} MATCHES "OFF")