minifb: support more platforms (#5590)

* minifb: support more platforms

* fix iphoneos syslinks

* libxkbcommon: support bsd

* disable bsd

* add check
pull/4570/merge
star9029 4 weeks ago committed by GitHub
parent 4723e3ec53
commit 01dc4fa052
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 20
      packages/l/libxkbcommon/xmake.lua
  2. 59
      packages/m/minifb/xmake.lua

@ -1,11 +1,11 @@
package("libxkbcommon")
set_homepage("https://xkbcommon.org/")
set_description("keymap handling library for toolkits and window systems")
set_license("MIT")
add_urls("https://github.com/xkbcommon/libxkbcommon/archive/xkbcommon-$(version).tar.gz",
"https://github.com/xkbcommon.git")
add_urls("https://github.com/xkbcommon/libxkbcommon/archive/refs/tags/xkbcommon-$(version).tar.gz",
"https://github.com/xkbcommon/libxkbcommon.git")
add_versions("1.0.3", "5d10a57ab65daad7d975926166770eca1d2c899131ab96c23845df1c42da5c31")
if is_plat("linux") then
@ -14,19 +14,25 @@ package("libxkbcommon")
add_configs("x11", {description = "Enable backend to X11 (default is false).", default = false, type = "boolean"})
add_configs("wayland", {description = "Enable backend to X11 (default is true).", default = true, type = "boolean"})
on_load("linux", function (package)
on_load(function (package)
if package:config("x11") then
package:add("deps", "libxcb", "xcb-proto", "libxml2")
package:add("extsources", "pacman::libxkbcommon-x11")
if package:is_plat("linux") then
package:add("extsources", "pacman::libxkbcommon-x11")
end
end
if package:config("wayland") then
package:add("deps", "wayland")
package:add("extsources", "pacman::libxkbcommon")
if package:is_plat("linux") then
package:add("extsources", "pacman::libxkbcommon")
end
end
end)
add_deps("meson")
add_deps("meson", "ninja")
on_install("linux", function (package)
package:addenv("PATH", "bin")
local configs = {

@ -4,38 +4,57 @@ package("minifb")
set_license("MIT")
add_urls("https://github.com/emoon/minifb.git")
add_versions("2022.11.12", "5312cb7ca07115c918148131d296864b8d67e2d7")
add_versions("2023.09.21", "2ce2449b1bc8d7c6d20c31b86244f1e540f2e788")
add_deps("cmake")
add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
if is_plat("windows") then
add_configs("vs_runtime", {description = "Set vs compiler runtime.", default = "MD", readonly = true})
end
if is_plat("macosx") then
add_frameworks("CoreFoundation", "Foundation", "AppKit", "MetalKit", "Metal")
elseif is_plat("linux") then
add_frameworks("Cocoa", "QuartzCore", "Metal", "MetalKit")
elseif is_plat("iphoneos") then
add_frameworks("UIKit", "QuartzCore", "Metal", "MetalKit")
elseif is_plat("linux", "bsd") then
add_deps("libx11", "libxkbcommon")
add_deps("glx", "opengl", {optional = true})
elseif is_plat("windows") then
elseif is_plat("windows", "mingw") then
add_syslinks("gdi32", "opengl32", "user32", "winmm")
end
on_install("macosx", "linux", "windows", function (package)
if on_check then
on_check("windows|arm64", function (package)
local vs_toolset = package:toolchain("msvc"):config("vs_toolset")
if vs_toolset then
local vs_toolset_ver = import("core.base.semver").new(vs_toolset)
local minor = vs_toolset_ver:minor()
assert(minor and minor >= 30, "package(minifb) require vs_toolset >= 14.3")
end
end)
end
on_install("!android and !cross and !bsd", function (package)
if package:is_plat("windows") then
io.replace("CMakeLists.txt", "add_definitions(-D_DEBUG)", "", {plain = true}) -- fix M[D|T]d
end
io.replace("CMakeLists.txt", "STATIC", "", {plain = true})
io.replace("CMakeLists.txt", 'set(CMAKE_C_FLAGS "")', "", {plain = true})
io.replace("CMakeLists.txt", 'set(CMAKE_CXX_FLAGS "")', "", {plain = true})
local configs = {"-DMINIFB_BUILD_EXAMPLES=OFF"}
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
local packagedeps
if package:is_plat("linux") then
packagedeps = {"libx11", "libxkbcommon", "glx", "opengl"}
io.replace("CMakeLists.txt", 'set(CMAKE_C_FLAGS "")', "", {plain = true})
io.replace("CMakeLists.txt", 'set(CMAKE_CXX_FLAGS "")', "", {plain = true})
if package:config("shared") and package:is_plat("windows") then
table.insert(configs, "-DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON")
end
local opt = {}
if package:is_plat("linux", "bsd") then
opt.packagedeps = {"libx11", "libxkbcommon", "glx", "opengl"}
end
import("package.tools.cmake").install(package, configs, opt)
if package:is_plat("windows") and package:is_debug() then
local dir = package:installdir(package:config("shared") and "bin" or "lib")
os.trycp(path.join(package:buildir(), "minifb.pdb"), dir)
end
import("package.tools.cmake").install(package, configs, {buildir = "build", packagedeps = packagedeps})
os.cp("include", package:installdir())
os.trycp("build/*.a", package:installdir("lib"))
os.trycp("build/*.lib", package:installdir("lib"))
end)
on_test(function (package)

Loading…
Cancel
Save