Fix compiling stages for Wayland (#38)

This commit is contained in:
Jeffery Myers
2025-11-20 15:40:22 -08:00
committed by GitHub

View File

@@ -103,19 +103,13 @@ function platform_defines()
filter {"system:macosx"} filter {"system:macosx"}
disablewarnings {"deprecated-declarations"} disablewarnings {"deprecated-declarations"}
filter {"system:linux"} filter {"system:linux", "options:wayland=off"}
defines {"_GLFW_X11"} defines {"_GLFW_X11"}
defines {"_GNU_SOURCE"}
-- This is necessary, otherwise compilation will fail since
-- there is no CLOCK_MONOTOMIC. raylib claims to have a workaround
-- to compile under c99 without -D_GNU_SOURCE, but it didn't seem
-- to work. raylib's Makefile also adds this flag, probably why it went
-- unnoticed for so long.
-- It compiles under c11 without -D_GNU_SOURCE, because c11 requires
-- to have CLOCK_MONOTOMIC
-- See: https://github.com/raysan5/raylib/issues/2729
filter{} filter {"system:linux", "options:wayland=on"}
defines {"_GLFW_WAYLAND"}
filter {}
end end
-- if you don't want to download raylib, then set this to false, and set the raylib dir to where you want raylib to be pulled from, must be full sources. -- if you don't want to download raylib, then set this to false, and set the raylib dir to where you want raylib to be pulled from, must be full sources.
@@ -231,7 +225,13 @@ if (downloadRaylib) then
libdirs {"../bin/%{cfg.buildcfg}"} libdirs {"../bin/%{cfg.buildcfg}"}
filter "system:linux" filter "system:linux"
links {"pthread", "m", "dl", "rt", "X11"} links {"pthread", "m", "dl", "rt"}
filter {"system:linux", "options:wayland=off"}
links {"X11"}
filter {"system:linux", "options:wayland=on"}
links {"wayland-client", "wayland-cursor", "wayland-egl", "xkbcommon"}
filter "system:macosx" filter "system:macosx"
links {"OpenGL.framework", "Cocoa.framework", "IOKit.framework", "CoreFoundation.framework", "CoreAudio.framework", "CoreVideo.framework", "AudioToolbox.framework"} links {"OpenGL.framework", "Cocoa.framework", "IOKit.framework", "CoreFoundation.framework", "CoreAudio.framework", "CoreVideo.framework", "AudioToolbox.framework"}
@@ -249,9 +249,36 @@ if (downloadRaylib) then
language "C" language "C"
targetdir "../bin/%{cfg.buildcfg}" targetdir "../bin/%{cfg.buildcfg}"
filter {"options:wayland=on"} filter {"options:wayland=on"}
defines {"GLFW_LINUX_ENABLE_WAYLAND=TRUE" } defines {"GLFW_LINUX_ENABLE_WAYLAND=TRUE" }
filter {"options:wayland=on", "system:linux"}
prebuildcommands {
"@echo Generating Wayland protocols...",
-- Core Wayland & Shell
"@wayland-scanner client-header ../" .. raylib_dir .. "/src/external/glfw/deps/wayland/wayland.xml ../" .. raylib_dir .. "/src/wayland-client-protocol.h",
"@wayland-scanner client-header ../" .. raylib_dir .. "/src/external/glfw/deps/wayland/xdg-shell.xml ../" .. raylib_dir .. "/src/xdg-shell-client-protocol.h",
"@wayland-scanner client-header ../" .. raylib_dir .. "/src/external/glfw/deps/wayland/xdg-decoration-unstable-v1.xml ../" .. raylib_dir .. "/src/xdg-decoration-unstable-v1-client-protocol.h",
-- Viewporter
"@wayland-scanner client-header ../" .. raylib_dir .. "/src/external/glfw/deps/wayland/viewporter.xml ../" .. raylib_dir .. "/src/viewporter-client-protocol.h",
-- Relative Pointer
"@wayland-scanner client-header ../" .. raylib_dir .. "/src/external/glfw/deps/wayland/relative-pointer-unstable-v1.xml ../" .. raylib_dir .. "/src/relative-pointer-unstable-v1-client-protocol.h",
-- Pointer Constraints
"@wayland-scanner client-header ../" .. raylib_dir .. "/src/external/glfw/deps/wayland/pointer-constraints-unstable-v1.xml ../" .. raylib_dir .. "/src/pointer-constraints-unstable-v1-client-protocol.h",
-- Fractional Scale
"@wayland-scanner client-header ../" .. raylib_dir .. "/src/external/glfw/deps/wayland/fractional-scale-v1.xml ../" .. raylib_dir .. "/src/fractional-scale-v1-client-protocol.h",
-- XDG Activation
"@wayland-scanner client-header ../" .. raylib_dir .. "/src/external/glfw/deps/wayland/xdg-activation-v1.xml ../" .. raylib_dir .. "/src/xdg-activation-v1-client-protocol.h",
-- Idle Inhibit
"@wayland-scanner client-header ../" .. raylib_dir .. "/src/external/glfw/deps/wayland/idle-inhibit-unstable-v1.xml ../" .. raylib_dir .. "/src/idle-inhibit-unstable-v1-client-protocol.h",
}
filter {}
filter "action:vs*" filter "action:vs*"
defines{"_WINSOCK_DEPRECATED_NO_WARNINGS", "_CRT_SECURE_NO_WARNINGS"} defines{"_WINSOCK_DEPRECATED_NO_WARNINGS", "_CRT_SECURE_NO_WARNINGS"}
characterset ("Unicode") characterset ("Unicode")