From 034ffda88738855538c5369b0d531d94c1b647b0 Mon Sep 17 00:00:00 2001 From: Thomas Anderson <5776225+CrackedPixel@users.noreply.github.com> Date: Mon, 13 Apr 2026 11:55:45 -0500 Subject: [PATCH] [cmake] update cmake for PLATFORM_MEMORY (#5749) * update cmake for PLATFORM_MEMORY * remove opengl example for memory platform * update for winmm and cross compile --- CMakeOptions.txt | 2 +- cmake/LibraryConfigurations.cmake | 10 ++++++++++ examples/CMakeLists.txt | 3 +++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CMakeOptions.txt b/CMakeOptions.txt index 0a453917d..55375116e 100644 --- a/CMakeOptions.txt +++ b/CMakeOptions.txt @@ -6,7 +6,7 @@ if(EMSCRIPTEN) # When configuring web builds with "emcmake cmake -B build -S .", set PLATFORM to Web by default SET(PLATFORM Web CACHE STRING "Platform to build for.") endif() -enum_option(PLATFORM "Desktop;Web;WebRGFW;Android;Raspberry Pi;DRM;SDL;RGFW" "Platform to build for.") +enum_option(PLATFORM "Desktop;Web;WebRGFW;Android;Raspberry Pi;DRM;SDL;RGFW;Memory" "Platform to build for.") enum_option(OPENGL_VERSION "OFF;4.3;3.3;2.1;1.1;ES 2.0;ES 3.0;Software" "Force a specific OpenGL Version?") diff --git a/cmake/LibraryConfigurations.cmake b/cmake/LibraryConfigurations.cmake index 4a8eb7d55..18680491d 100644 --- a/cmake/LibraryConfigurations.cmake +++ b/cmake/LibraryConfigurations.cmake @@ -156,6 +156,7 @@ elseif ("${PLATFORM}" STREQUAL "SDL") add_compile_definitions(USING_SDL2_PACKAGE) endif() endif() + elseif ("${PLATFORM}" STREQUAL "RGFW") set(PLATFORM_CPP "PLATFORM_DESKTOP_RGFW") @@ -181,6 +182,15 @@ elseif ("${PLATFORM}" STREQUAL "WebRGFW") set(PLATFORM_CPP "PLATFORM_WEB_RGFW") set(GRAPHICS "GRAPHICS_API_OPENGL_ES2") set(CMAKE_STATIC_LIBRARY_SUFFIX ".a") + +elseif ("${PLATFORM}" STREQUAL "Memory") + set(PLATFORM_CPP "PLATFORM_MEMORY") + set(GRAPHICS "GRAPHICS_API_OPENGL_SOFTWARE") + set(OPENGL_VERSION "Software") + + if(WIN32 OR CMAKE_C_COMPILER MATCHES "mingw|mingw32|mingw64") + set(LIBS_PRIVATE winmm) + endif() endif () if (NOT ${OPENGL_VERSION} MATCHES "OFF") diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 6554d1327..ee5469eaa 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -105,6 +105,9 @@ elseif ("${PLATFORM}" STREQUAL "DRM") list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/rlgl_standalone.c) list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/raylib_opengl_interop.c) +elseif ("${PLATFORM}" MATCHES "Memory") + list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/raylib_opengl_interop.c) + elseif ("${OPENGL_VERSION}" STREQUAL "Software") list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/rlgl_standalone.c) list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/raylib_opengl_interop.c)