From dc1cec8bab97e09656479bded3265fb420a0b073 Mon Sep 17 00:00:00 2001 From: Alexandre Almeida Date: Fri, 1 Mar 2024 04:34:53 -0300 Subject: [PATCH 01/10] Remove GLFW mouse passthrough hack and increase GLFW version in CMake (#3852) --- cmake/GlfwImport.cmake | 4 ++-- src/platforms/rcore_desktop.c | 9 --------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/cmake/GlfwImport.cmake b/cmake/GlfwImport.cmake index 1c267aba..2395343c 100644 --- a/cmake/GlfwImport.cmake +++ b/cmake/GlfwImport.cmake @@ -1,8 +1,8 @@ if(USE_EXTERNAL_GLFW STREQUAL "ON") - find_package(glfw3 3.3.3 REQUIRED) + find_package(glfw3 3.4 REQUIRED) elseif(USE_EXTERNAL_GLFW STREQUAL "IF_POSSIBLE") - find_package(glfw3 3.3.3 QUIET) + find_package(glfw3 3.4 QUIET) endif() if (glfw3_FOUND) set(LIBS_PRIVATE ${LIBS_PRIVATE} glfw) diff --git a/src/platforms/rcore_desktop.c b/src/platforms/rcore_desktop.c index d4c02440..29c85156 100644 --- a/src/platforms/rcore_desktop.c +++ b/src/platforms/rcore_desktop.c @@ -84,15 +84,6 @@ #include "GLFW/glfw3native.h" // Required for: glfwGetCocoaWindow() #endif -//---------------------------------------------------------------------------------- -// Defines and Macros -//---------------------------------------------------------------------------------- -// TODO: HACK: Added flag if not provided by GLFW when using external library -// Latest GLFW release (GLFW 3.3.8) does not implement this flag, it was added for 3.4.0-dev -#if !defined(GLFW_MOUSE_PASSTHROUGH) - #define GLFW_MOUSE_PASSTHROUGH 0x0002000D -#endif - //---------------------------------------------------------------------------------- // Types and Structures Definition //---------------------------------------------------------------------------------- From 25caf14be8d0284aceaa0de28753b3012e71b7bb Mon Sep 17 00:00:00 2001 From: Caleb Barger <59521636+cabarger@users.noreply.github.com> Date: Fri, 1 Mar 2024 03:43:19 -0800 Subject: [PATCH 02/10] Fix fix-build-paths (#3849) --- src/build.zig | 53 +++++++++++++++++++++++++++++++-------------------- 1 file changed, 32 insertions(+), 21 deletions(-) diff --git a/src/build.zig b/src/build.zig index 5251f30f..ed9013ac 100644 --- a/src/build.zig +++ b/src/build.zig @@ -1,16 +1,18 @@ const std = @import("std"); const builtin = @import("builtin"); -// This has been tested to work with zig 0.11.0, zig 0.12.0-dev.2075+f5978181e and 0.12.0-dev.2990+31763d28c +// This has been tested with zig version(s): +// 0.11.0 +// 0.12.0-dev.2075+f5978181e +// 0.12.0-dev.2990+31763d28c // -// anytype is used here to preserve compatibility, in 0.12.0dev the std.zig.CrossTarget type +// Anytype is used here to preserve compatibility, in 0.12.0dev the std.zig.CrossTarget type // was reworked into std.Target.Query and std.Build.ResolvedTarget. Using anytype allows // us to accept both CrossTarget and ResolvedTarget and act accordingly in getOsTagVersioned. pub fn addRaylib(b: *std.Build, target: anytype, optimize: std.builtin.OptimizeMode, options: Options) !*std.Build.Step.Compile { var general_purpose_allocator = std.heap.GeneralPurposeAllocator(.{}){}; const gpa = general_purpose_allocator.allocator(); - // get the relative source path, because it is needed for addCSourceFilesVersioned - const relative = srcdir[b.build_root.path.?.len..]; + if (comptime builtin.zig_version.minor >= 12 and @TypeOf(target) != std.Build.ResolvedTarget) { @compileError("Expected 'std.Build.ResolvedTarget' for argument 2 'target' in 'addRaylib', found '" ++ @typeName(@TypeOf(target)) ++ "'"); } else if (comptime builtin.zig_version.minor == 11 and @TypeOf(target) != std.zig.CrossTarget) { @@ -53,33 +55,33 @@ pub fn addRaylib(b: *std.Build, target: anytype, optimize: std.builtin.OptimizeM } addCSourceFilesVersioned(raylib, &.{ - try join2(gpa, relative, "rcore.c"), - try join2(gpa, relative, "utils.c"), + try join2(gpa, srcdir, "rcore.c"), + try join2(gpa, srcdir, "utils.c"), }, raylib_flags_arr.items); if (options.raudio) { addCSourceFilesVersioned(raylib, &.{ - try join2(gpa, relative, "raudio.c"), + try join2(gpa, srcdir, "raudio.c"), }, raylib_flags_arr.items); } if (options.rmodels) { addCSourceFilesVersioned(raylib, &.{ - try join2(gpa, relative, "rmodels.c"), + try join2(gpa, srcdir, "rmodels.c"), }, raylib_flags_arr.items); } if (options.rshapes) { addCSourceFilesVersioned(raylib, &.{ - try join2(gpa, relative, "rshapes.c"), + try join2(gpa, srcdir, "rshapes.c"), }, raylib_flags_arr.items); } if (options.rtext) { addCSourceFilesVersioned(raylib, &.{ - try join2(gpa, relative, "rtext.c"), + try join2(gpa, srcdir, "rtext.c"), }, raylib_flags_arr.items); } if (options.rtextures) { addCSourceFilesVersioned(raylib, &.{ - try join2(gpa, relative, "rtextures.c"), + try join2(gpa, srcdir, "rtextures.c"), }, raylib_flags_arr.items); } @@ -96,7 +98,7 @@ pub fn addRaylib(b: *std.Build, target: anytype, optimize: std.builtin.OptimizeM switch (getOsTagVersioned(target)) { .windows => { addCSourceFilesVersioned(raylib, &.{ - try join2(gpa, relative, "rglfw.c"), + try join2(gpa, srcdir, "rglfw.c"), }, raylib_flags_arr.items); raylib.linkSystemLibrary("winmm"); raylib.linkSystemLibrary("gdi32"); @@ -107,7 +109,7 @@ pub fn addRaylib(b: *std.Build, target: anytype, optimize: std.builtin.OptimizeM .linux => { if (!options.platform_drm) { addCSourceFilesVersioned(raylib, &.{ - try join2(gpa, relative, "rglfw.c"), + try join2(gpa, srcdir, "rglfw.c"), }, raylib_flags_arr.items); raylib.linkSystemLibrary("GL"); raylib.linkSystemLibrary("rt"); @@ -137,7 +139,7 @@ pub fn addRaylib(b: *std.Build, target: anytype, optimize: std.builtin.OptimizeM }, .freebsd, .openbsd, .netbsd, .dragonfly => { addCSourceFilesVersioned(raylib, &.{ - try join2(gpa, relative, "rglfw.c"), + try join2(gpa, srcdir, "rglfw.c"), }, raylib_flags_arr.items); raylib.linkSystemLibrary("GL"); raylib.linkSystemLibrary("rt"); @@ -156,7 +158,7 @@ pub fn addRaylib(b: *std.Build, target: anytype, optimize: std.builtin.OptimizeM // On macos rglfw.c include Objective-C files. try raylib_flags_arr.append("-ObjC"); addCSourceFilesVersioned(raylib, &.{ - try join2(gpa, relative, "rglfw.c"), + try join2(gpa, srcdir, "rglfw.c"), }, raylib_flags_arr.items); raylib.linkFramework("Foundation"); raylib.linkFramework("CoreServices"); @@ -251,14 +253,23 @@ fn getOsTagVersioned(target: anytype) std.Target.Os.Tag { } } -fn addCSourceFilesVersioned(exe: *std.Build.Step.Compile, files: []const []const u8, flags: []const []const u8) void { +fn addCSourceFilesVersioned( + exe: *std.Build.Step.Compile, + files: []const []const u8, + flags: []const []const u8, +) void { + //- HACK(cabarger): I hate this so much!!! if (comptime builtin.zig_version.minor >= 12) { - exe.addCSourceFiles(.{ - .files = files, - .flags = flags, - }); - } else { + for (files) |file| { + exe.addCSourceFile(.{ + .file = .{ .path = file }, + .flags = flags, + }); + } + } else if (comptime builtin.zig_version.minor == 11) { exe.addCSourceFiles(files, flags); + } else { + @compileError("Expected zig version 11 or 12"); } } From c970afeccd824f545422b1d3505b571f3eadb901 Mon Sep 17 00:00:00 2001 From: Ray Date: Mon, 4 Mar 2024 19:58:49 +0100 Subject: [PATCH 03/10] Update linux.yml --- .github/workflows/linux.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 976b67bf..bb25cfb5 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -55,7 +55,7 @@ jobs: run: | sudo apt-get update -qq sudo apt-get install gcc-multilib - sudo apt-get install -y --no-install-recommends libglfw3 libglfw3-dev libx11-dev libxcursor-dev libxrandr-dev libxinerama-dev libxi-dev libxext-dev libxfixes-dev + sudo apt-get install -y --no-install-recommends libglfw3 libglfw3-dev libx11-dev libxcursor-dev libxrandr-dev libxinerama-dev libxi-dev libxext-dev libxfixes-dev libwayland-bin mkdir build cd build mkdir ${{ env.RELEASE_NAME }} From 6e9dcdb599eb8548f49f2ae1330d5a752ed80530 Mon Sep 17 00:00:00 2001 From: Ray Date: Mon, 4 Mar 2024 19:59:04 +0100 Subject: [PATCH 04/10] Update linux_examples.yml --- .github/workflows/linux_examples.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linux_examples.yml b/.github/workflows/linux_examples.yml index 2d26b5fa..065b9957 100644 --- a/.github/workflows/linux_examples.yml +++ b/.github/workflows/linux_examples.yml @@ -27,7 +27,7 @@ jobs: - name: Setup Environment run: | sudo apt-get update -qq - sudo apt-get install -y --no-install-recommends libglfw3 libglfw3-dev libx11-dev libxcursor-dev libxrandr-dev libxinerama-dev libxi-dev libxext-dev libxfixes-dev + sudo apt-get install -y --no-install-recommends libglfw3 libglfw3-dev libx11-dev libxcursor-dev libxrandr-dev libxinerama-dev libxi-dev libxext-dev libxfixes-dev libwayland-bin - name: Build Library run: | From 85a46e42bd12a0973a22b48785b6c878b5bc58d6 Mon Sep 17 00:00:00 2001 From: Alexandre Almeida Date: Mon, 4 Mar 2024 15:59:26 -0300 Subject: [PATCH 05/10] CMake: Remove USE_WAYLAND option (#3851) * CMake: Remove USE_WAYLAND option * Consistency fix * Fix oversight --- CMakeLists.txt | 6 ++++++ CMakeOptions.txt | 7 ++++--- cmake/GlfwImport.cmake | 1 - 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ce2de578..57719691 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,6 +39,12 @@ include(CMakeOptions.txt) # Enforces a few environment and compiler configurations include(BuildOptions) +if (UNIX AND NOT APPLE) + if (NOT GLFW_BUILD_WAYLAND AND NOT GLFW_BUILD_X11) + MESSAGE(FATAL_ERROR "Cannot disable both Wayland and X11") + endif() +endif() + # Main sources directory (the second parameter sets the output directory name to raylib) add_subdirectory(src raylib) diff --git a/CMakeOptions.txt b/CMakeOptions.txt index 68468c07..2c58cd5c 100644 --- a/CMakeOptions.txt +++ b/CMakeOptions.txt @@ -20,9 +20,10 @@ option(MACOS_FATLIB "Build fat library for both i386 and x86_64 on macOS" OFF) cmake_dependent_option(USE_AUDIO "Build raylib with audio module" ON CUSTOMIZE_BUILD ON) enum_option(USE_EXTERNAL_GLFW "OFF;IF_POSSIBLE;ON" "Link raylib against system GLFW instead of embedded one") -if(UNIX AND NOT APPLE) - option(USE_WAYLAND "Use Wayland for window creation" OFF) -endif() + +# GLFW build options +option(GLFW_BUILD_WAYLAND "Build the bundled GLFW with Wayland support" ON) +option(GLFW_BUILD_X11 "Build the bundled GLFW with X11 support" ON) option(INCLUDE_EVERYTHING "Include everything disabled by default (for CI usage" OFF) set(OFF ${INCLUDE_EVERYTHING} CACHE INTERNAL "Replace any OFF by default with \${OFF} to have it covered by this option") diff --git a/cmake/GlfwImport.cmake b/cmake/GlfwImport.cmake index 2395343c..4a5ef8c6 100644 --- a/cmake/GlfwImport.cmake +++ b/cmake/GlfwImport.cmake @@ -16,7 +16,6 @@ if(NOT glfw3_FOUND AND NOT USE_EXTERNAL_GLFW STREQUAL "ON" AND "${PLATFORM}" MAT 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_BUILD_WAYLAND ${USE_WAYLAND} CACHE BOOL "" FORCE) set(GLFW_LIBRARY_TYPE "OBJECT" CACHE STRING "" FORCE) From 7584b6aa0bb190c1aa4615d42949fe79fc89b103 Mon Sep 17 00:00:00 2001 From: Ray Date: Mon, 4 Mar 2024 20:08:59 +0100 Subject: [PATCH 06/10] Update cmake.yml --- .github/workflows/cmake.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 82e3459b..c286220b 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -86,7 +86,7 @@ jobs: run: | sudo apt-get update -qq sudo apt-get install gcc-multilib - sudo apt-get install -y --no-install-recommends libglfw3 libglfw3-dev libx11-dev libxcursor-dev libxrandr-dev libxinerama-dev libxi-dev libxext-dev libxfixes-dev + sudo apt-get install -y --no-install-recommends libglfw3 libglfw3-dev libx11-dev libxcursor-dev libxrandr-dev libxinerama-dev libxi-dev libxext-dev libxfixes-dev libwayland-bin - name: Configure CMake # Use a bash shell so we can use the same syntax for environment variable # access regardless of the host operating system From 36dabe485c3b6c64c41a028f147c56a5634ad428 Mon Sep 17 00:00:00 2001 From: Ray Date: Tue, 5 Mar 2024 13:59:36 +0100 Subject: [PATCH 07/10] Update cmake.yml --- .github/workflows/cmake.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index c286220b..90c62d77 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -86,7 +86,7 @@ jobs: run: | sudo apt-get update -qq sudo apt-get install gcc-multilib - sudo apt-get install -y --no-install-recommends libglfw3 libglfw3-dev libx11-dev libxcursor-dev libxrandr-dev libxinerama-dev libxi-dev libxext-dev libxfixes-dev libwayland-bin + sudo apt-get install -y --no-install-recommends libglfw3 libglfw3-dev libx11-dev libxcursor-dev libxrandr-dev libxinerama-dev libxi-dev libxext-dev libxfixes-dev libwayland-dev libwayland-bin libwayland-client - name: Configure CMake # Use a bash shell so we can use the same syntax for environment variable # access regardless of the host operating system From 2114e48393d815298d5ea1b5a415d9651f2ec656 Mon Sep 17 00:00:00 2001 From: Ray Date: Tue, 5 Mar 2024 14:00:56 +0100 Subject: [PATCH 08/10] Update cmake.yml --- .github/workflows/cmake.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 90c62d77..611902f3 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -86,7 +86,7 @@ jobs: run: | sudo apt-get update -qq sudo apt-get install gcc-multilib - sudo apt-get install -y --no-install-recommends libglfw3 libglfw3-dev libx11-dev libxcursor-dev libxrandr-dev libxinerama-dev libxi-dev libxext-dev libxfixes-dev libwayland-dev libwayland-bin libwayland-client + sudo apt-get install -y --no-install-recommends libglfw3 libglfw3-dev libx11-dev libxcursor-dev libxrandr-dev libxinerama-dev libxi-dev libxext-dev libxfixes-dev libwayland-dev libwayland-bin - name: Configure CMake # Use a bash shell so we can use the same syntax for environment variable # access regardless of the host operating system From 38bdcafea1ec41f14dbeb6468a7270c7f653800b Mon Sep 17 00:00:00 2001 From: Ray Date: Tue, 5 Mar 2024 14:02:57 +0100 Subject: [PATCH 09/10] Update cmake.yml --- .github/workflows/cmake.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 611902f3..8a0eb0b8 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -86,7 +86,7 @@ jobs: run: | sudo apt-get update -qq sudo apt-get install gcc-multilib - sudo apt-get install -y --no-install-recommends libglfw3 libglfw3-dev libx11-dev libxcursor-dev libxrandr-dev libxinerama-dev libxi-dev libxext-dev libxfixes-dev libwayland-dev libwayland-bin + sudo apt-get install -y --no-install-recommends libglfw3 libglfw3-dev libx11-dev libxcursor-dev libxrandr-dev libxinerama-dev libxi-dev libxext-dev libxfixes-dev libwayland-dev libwayland-bin libxkbcommon - name: Configure CMake # Use a bash shell so we can use the same syntax for environment variable # access regardless of the host operating system From c7b362d19dd32b00a0fce90bc9abe8afd3d4b754 Mon Sep 17 00:00:00 2001 From: Ray Date: Tue, 5 Mar 2024 14:04:32 +0100 Subject: [PATCH 10/10] Update cmake.yml --- .github/workflows/cmake.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 8a0eb0b8..58ca7d5f 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -86,7 +86,7 @@ jobs: run: | sudo apt-get update -qq sudo apt-get install gcc-multilib - sudo apt-get install -y --no-install-recommends libglfw3 libglfw3-dev libx11-dev libxcursor-dev libxrandr-dev libxinerama-dev libxi-dev libxext-dev libxfixes-dev libwayland-dev libwayland-bin libxkbcommon + sudo apt-get install -y --no-install-recommends libglfw3 libglfw3-dev libx11-dev libxcursor-dev libxrandr-dev libxinerama-dev libxi-dev libxext-dev libxfixes-dev libwayland-dev libwayland-bin libxkbcommon-dev - name: Configure CMake # Use a bash shell so we can use the same syntax for environment variable # access regardless of the host operating system