|
@@ -13,8 +13,11 @@ package("glfw")
|
|
|
add_versions("3.3.7", "fd21a5f65bcc0fc3c76e0f8865776e852de09ef6fbc3620e09ce96d2b2807e04")
|
|
|
add_versions("3.3.8", "f30f42e05f11e5fc62483e513b0488d5bceeab7d9c5da0ffe2252ad81816c713")
|
|
|
add_versions("3.3.9", "a7e7faef424fcb5f83d8faecf9d697a338da7f7a906fc1afbc0e1879ef31bd53")
|
|
|
+ add_versions("3.4", "c038d34200234d071fae9345bc455e4a8f2f544ab60150765d7704e08f3dac01")
|
|
|
|
|
|
add_configs("glfw_include", {description = "Choose submodules enabled in glfw", default = "none", type = "string", values = {"none", "vulkan", "glu", "glext", "es2", "es3"}})
|
|
|
+ add_configs("x11", {description = "Build support for X11", default = is_plat("linux"), type = "boolean"})
|
|
|
+ add_configs("wayland", {description = "Build support for Wayland", default = false, type = "boolean"})
|
|
|
|
|
|
if is_plat("linux") then
|
|
|
add_extsources("apt::libglfw3-dev", "pacman::glfw-x11")
|
|
@@ -29,14 +32,17 @@ package("glfw")
|
|
|
elseif is_plat("mingw") then
|
|
|
add_syslinks("gdi32")
|
|
|
elseif is_plat("linux") then
|
|
|
- -- TODO: add wayland support
|
|
|
- add_deps("libx11", "libxrandr", "libxrender", "libxinerama", "libxfixes", "libxcursor", "libxi", "libxext")
|
|
|
add_syslinks("dl", "pthread")
|
|
|
- add_defines("_GLFW_X11")
|
|
|
end
|
|
|
|
|
|
on_load(function (package)
|
|
|
package:add("defines", "GLFW_INCLUDE_" .. package:config("glfw_include"):upper())
|
|
|
+ if package:config("x11") then
|
|
|
+ package:add("deps", "libx11", "libxrandr", "libxrender", "libxinerama", "libxfixes", "libxcursor", "libxi", "libxext")
|
|
|
+ end
|
|
|
+ if package:config("wayland") then
|
|
|
+ package:add("deps", "wayland")
|
|
|
+ end
|
|
|
end)
|
|
|
|
|
|
on_install("macosx", "windows", "linux", "mingw", function (package)
|
|
@@ -46,8 +52,10 @@ package("glfw")
|
|
|
if package:is_plat("windows") then
|
|
|
table.insert(configs, "-DUSE_MSVC_RUNTIME_LIBRARY_DLL=" .. (package:config("vs_runtime"):startswith("MT") and "OFF" or "ON"))
|
|
|
end
|
|
|
+ table.insert(configs, "-DGLFW_BUILD_X11=" .. (package:config("x11") and "ON" or "OFF"))
|
|
|
+ table.insert(configs, "-DGLFW_BUILD_WAYLAND=" .. (package:config("wayland") and "ON" or "OFF"))
|
|
|
if package:is_plat("linux") then
|
|
|
- import("package.tools.cmake").install(package, configs, {packagedeps = {"libxrender", "libxfixes", "libxext", "libx11"}})
|
|
|
+ import("package.tools.cmake").install(package, configs, {packagedeps = {"libxrender", "libxfixes", "libxext", "libx11", "wayland"}})
|
|
|
else
|
|
|
import("package.tools.cmake").install(package, configs)
|
|
|
end
|