From 4f283a0789b896f4b71ec1cffca959dd0902a5e1 Mon Sep 17 00:00:00 2001 From: mooff Date: Thu, 22 Feb 2024 22:05:41 +0000 Subject: [PATCH 1/4] Add CMake PLATFORM option for Desktop SDL (#3809) --- CMakeOptions.txt | 2 +- cmake/LibraryConfigurations.cmake | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeOptions.txt b/CMakeOptions.txt index db0a1a102..68468c07a 100644 --- a/CMakeOptions.txt +++ b/CMakeOptions.txt @@ -2,7 +2,7 @@ include(CMakeDependentOption) include(EnumOption) -enum_option(PLATFORM "Desktop;Web;Android;Raspberry Pi;DRM" "Platform to build for.") +enum_option(PLATFORM "Desktop;Web;Android;Raspberry Pi;DRM;SDL" "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?") diff --git a/cmake/LibraryConfigurations.cmake b/cmake/LibraryConfigurations.cmake index d4bf45a08..18b4f196a 100644 --- a/cmake/LibraryConfigurations.cmake +++ b/cmake/LibraryConfigurations.cmake @@ -91,6 +91,11 @@ elseif ("${PLATFORM}" MATCHES "DRM") endif () set(LIBS_PRIVATE ${GLESV2} ${EGL} ${DRM} ${GBM} atomic pthread m dl) +elseif ("${PLATFORM}" MATCHES "SDL") + find_package(SDL2 REQUIRED) + set(PLATFORM_CPP "PLATFORM_DESKTOP_SDL") + set(LIBS_PRIVATE SDL2::SDL2) + endif () if (NOT ${OPENGL_VERSION} MATCHES "OFF") From 31c6a340abd1a3530591341ca4d05481004612e4 Mon Sep 17 00:00:00 2001 From: Peter0x44 Date: Thu, 22 Feb 2024 22:06:22 +0000 Subject: [PATCH 2/4] Remove all uses of deps/mingw (#3805) The purpose of this directory in GLFW is to provide some headers that "mingw.org" doesn't. Raylib has long been unable to build with mingw.org due to using certain symbols that aren't exposed in their headers. (_ftelli64 and _access, among others.). Mingw-w64 already has the necessary headers included, and doesn't need any of these external implementations. For some reason, this also causes the following error when building with Visual Studio's clang: clang -c rglfw.c -Wall -D_GNU_SOURCE -DPLATFORM_DESKTOP -DGRAPHICS_API_OPENGL_33 -Wno-missing-braces -Werror=pointer-arith -fno-strict-aliasing -std=c99 -O1 -Werror=implicit-function-declaration -I. -Iexternal/glfw/include -Iexternal/glfw/deps/mingw In file included from rglfw.c:61: In file included from ./external/glfw/src/init.c:30: In file included from ./external/glfw/src/internal.h:331: In file included from ./external/glfw/src/platform.h:31: In file included from ./external/glfw/src/win32_platform.h:70: external/glfw/deps/mingw\xinput.h:227:26: error: a parameter list without types is only allowed in a function definition 227 | void WINAPI XInputEnable(WINBOOL); | If the last -Iexternal/glfw/deps/mingw is removed, the build works fine. So, this workaround causes other problems, while not actually helping raylib. https://github.com/glfw/glfw/blob/0bb605cd797e4d63709495f4074ec59362064ab4/src/CMakeLists.txt#L272-L279 GLFW's CMakeLists.txt first checks if either dinput.h or xinput.h are provided by the toolchain, before telling the compiler to search for headers in that directory. For EVERY compiler that can build raylib, this is true. In summary: This directory causes issues when building with some compilers, and every toolchain that needs this workaround can't build raylib anyway. --- examples/build.zig | 1 - src/Makefile | 4 ++-- src/build.zig | 1 - 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/examples/build.zig b/examples/build.zig index deb381d53..e56ac0d54 100644 --- a/examples/build.zig +++ b/examples/build.zig @@ -55,7 +55,6 @@ fn add_module(comptime module: []const u8, b: *std.Build, target: anytype, optim exe.linkSystemLibrary("winmm"); exe.linkSystemLibrary("gdi32"); exe.linkSystemLibrary("opengl32"); - exe.addIncludePath(.{ .path = "external/glfw/deps/mingw" }); exe.defineCMacro("PLATFORM_DESKTOP", null); }, diff --git a/src/Makefile b/src/Makefile index f38257b0d..2d426b163 100644 --- a/src/Makefile +++ b/src/Makefile @@ -438,7 +438,7 @@ INCLUDE_PATHS = -I. # Define additional directories containing required header files ifeq ($(PLATFORM),PLATFORM_DESKTOP) - INCLUDE_PATHS += -Iexternal/glfw/include -Iexternal/glfw/deps/mingw + INCLUDE_PATHS += -Iexternal/glfw/include ifeq ($(PLATFORM_OS),BSD) INCLUDE_PATHS += -I/usr/local/include endif @@ -447,7 +447,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP_SDL) INCLUDE_PATHS += -I$(SDL_INCLUDE_PATH) endif ifeq ($(PLATFORM),PLATFORM_WEB) - INCLUDE_PATHS += -Iexternal/glfw/include -Iexternal/glfw/deps/mingw + INCLUDE_PATHS += -Iexternal/glfw/include endif ifeq ($(PLATFORM),PLATFORM_DRM) INCLUDE_PATHS += -I/usr/include/libdrm diff --git a/src/build.zig b/src/build.zig index 827788efc..32b31f1aa 100644 --- a/src/build.zig +++ b/src/build.zig @@ -97,7 +97,6 @@ pub fn addRaylib(b: *std.Build, target: anytype, optimize: std.builtin.OptimizeM raylib.linkSystemLibrary("winmm"); raylib.linkSystemLibrary("gdi32"); raylib.linkSystemLibrary("opengl32"); - raylib.addIncludePath(.{ .path = "external/glfw/deps/mingw" }); raylib.defineCMacro("PLATFORM_DESKTOP", null); }, From 23616153d4ed5d76f0965d016e56735edb5b23ed Mon Sep 17 00:00:00 2001 From: Ray Date: Thu, 22 Feb 2024 23:25:05 +0100 Subject: [PATCH 3/4] Update Makefile --- examples/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/Makefile b/examples/Makefile index c5bc8b74b..8362b8c8e 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -71,8 +71,8 @@ USE_EXTERNAL_GLFW ?= FALSE # PLATFORM_DESKTOP_SDL: It requires SDL library to be provided externally # WARNING: Library is not included in raylib, it MUST be configured by users -SDL_INCLUDE_PATH ?= $(RAYLIB_SRC_PATH)/external/SDL2-2.28.4/include -SDL_LIBRARY_PATH ?= $(RAYLIB_SRC_PATH)/external/SDL2-2.28.4/lib/x64 +SDL_INCLUDE_PATH ?= $(RAYLIB_SRC_PATH)/external/SDL2/include +SDL_LIBRARY_PATH ?= $(RAYLIB_SRC_PATH)/external/SDL2/lib # Use Wayland display server protocol on Linux desktop (by default it uses X11 windowing system) # NOTE: This variable is only used for PLATFORM_OS: LINUX From bda919033dfdd2d0d75b606f3fa29d21f0408ffb Mon Sep 17 00:00:00 2001 From: Abhishek Rathore <59042344+Logicless-Coder@users.noreply.github.com> Date: Fri, 23 Feb 2024 23:47:33 +0530 Subject: [PATCH 4/4] Fixed typo in a comment (#3816) (#3817) Fixed a grammatical error by removing "are" to change `... but some are have multiple purposes ...` to `... but some have multiple purposes ...` in `textures/textures_image_generation` --- examples/textures/textures_image_generation.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/textures/textures_image_generation.c b/examples/textures/textures_image_generation.c index abde401f7..97e43f007 100644 --- a/examples/textures/textures_image_generation.c +++ b/examples/textures/textures_image_generation.c @@ -13,7 +13,7 @@ #include "raylib.h" -#define NUM_TEXTURES 9 // Currently we have 8 generation algorithms but some are have multiple purposes (Linear and Square Gradients) +#define NUM_TEXTURES 9 // Currently we have 8 generation algorithms but some have multiple purposes (Linear and Square Gradients) //------------------------------------------------------------------------------------ // Program main entry point