add bgfx build for ios and update to latest version (#4346)

Co-authored-by: yao <yao@hanabit.art>
pull/4347/head
Yao 7 months ago committed by GitHub
parent cc3c9277c4
commit 3ff1475831
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 28
      packages/b/bgfx/xmake.lua

@ -8,13 +8,16 @@ package("bgfx")
add_versions("7816", "5ecddbf4d51e2dda2a56ae8cafef4810e3a45d87")
add_versions("8203", "484a5f0c25b53584a6b7fce0702a6bb580072d81")
add_versions("8674", "f42134876038027667ef7e47c9a612dca1051ef2")
add_versions("8752", "61c770b0f5f57cf10547107974099e604358bf69")
add_resources("7816", "bx", "https://github.com/bkaradzic/bx.git", "51f25ba638b9cb35eb2ac078f842a4bed0746d56")
add_resources("8203", "bx", "https://github.com/bkaradzic/bx.git", "b9501348c596b68e5e655a8308df5c55f61ecd80")
add_resources("8674", "bx", "https://github.com/bkaradzic/bx.git", "67dfdf34f642a4a807b75eb600f82f4f04027963")
add_resources("8752", "bx", "https://github.com/bkaradzic/bx.git", "0ec634e8fdf8c810f9911c686a8158088ae25379")
add_resources("7816", "bimg", "https://github.com/bkaradzic/bimg.git", "8355d36befc90c1db82fca8e54f38bfb7eeb3530")
add_resources("8203", "bimg", "https://github.com/bkaradzic/bimg.git", "663f724186e26caf46494e389ed82409106205fb")
add_resources("8674", "bimg", "https://github.com/bkaradzic/bimg.git", "964a5b85483cdf59a30dc006e9bd8bbdde6cb2be")
add_resources("8752", "bimg", "https://github.com/bkaradzic/bimg.git", "61a7e9ebe7e33c821cf80b0542dcf23088446f5b")
if is_plat("windows") then
add_syslinks("user32", "gdi32", "psapi")
@ -22,6 +25,8 @@ package("bgfx")
add_cxxflags("/Zc:__cplusplus")
elseif is_plat("macosx") then
add_frameworks("Metal", "QuartzCore", "Cocoa", "IOKit")
elseif is_plat("iphoneos") then
add_frameworks("OpenGLES", "CoreGraphics", "Metal", "QuartzCore", "UIKit")
elseif is_plat("linux") then
add_deps("libx11")
add_syslinks("GL", "pthread", "dl")
@ -29,7 +34,7 @@ package("bgfx")
add_deps("genie")
on_load("windows", "macosx", "linux", function (package)
on_load("windows", "macosx", "linux", "iphoneos", function (package)
local suffix = package:debug() and "Debug" or "Release"
for _, lib in ipairs({"bgfx", "bimg", "bx"}) do
package:add("links", lib .. suffix)
@ -37,12 +42,14 @@ package("bgfx")
package:add("defines", "BX_CONFIG_DEBUG=" .. (package:debug() and "1" or "0"))
end)
on_install("windows|native", "macosx", "linux", function (package)
on_install("windows|native", "macosx", "linux", "iphoneos", function (package)
local bxdir = package:resourcefile("bx")
local bimgdir = package:resourcefile("bimg")
local genie = is_host("windows") and "genie.exe" or "genie"
local args = {"--with-tools"}
local args = {}
if is_plat("windows|native", "macosx", "linux") then
args = {"--with-tools"}
end
if package:config("shared") then
table.insert(args, "--with-shared-lib")
end
@ -85,6 +92,12 @@ package("bgfx")
configs = {"-C",
".build/projects/gmake-" .. target,
"config=" .. mode:lower()}
elseif package:is_plat("iphoneos") then
target = "ios-arm64"
table.insert(args, "--gcc=" .. target)
configs = {"-C",
".build/projects/gmake-" .. target,
"config=" .. mode:lower()}
elseif package:is_plat("linux") then
table.insert(args, "--gcc=linux-gcc")
target = "linux" .. (package:is_arch("x86_64") and "64" or "32") .. "_gcc"
@ -92,15 +105,16 @@ package("bgfx")
".build/projects/gmake-linux",
"config=" .. mode:lower() .. (package:is_arch("x86_64") and "64" or "32")}
end
table.insert(args, "gmake")
table.insert(args, "gmake")
table.insert(args, "-j" .. os.cpuinfo("ncpu"))
local envs = make.buildenvs(package)
envs.BX_DIR = bxdir
envs.BIMG_DIR = bimgdir
os.vrunv(genie, args, {envs = envs})
make.build(package, configs)
if package:is_plat("macosx") then
if package:is_plat("macosx", "iphoneos") then
os.trycp(".build/" .. target .. "/bin/*.a|*example*", package:installdir("lib"))
os.trycp(".build/" .. target .. "/bin/*.dylib", package:installdir("lib"))
os.trycp(".build/" .. target .. "/bin/*|*.*", package:installdir("bin"))
@ -118,5 +132,5 @@ package("bgfx")
void test() {
bgfx::init();
}
]]}, {configs = {languages = "c++14"}, includes = "bgfx/bgfx.h"}))
]]}, {configs = {languages = "c++17"}, includes = "bgfx/bgfx.h"}))
end)

Loading…
Cancel
Save