* add bgfx

* fix bullet3

* disable shared library on windows
pull/453/head
Hoildkv 4 years ago committed by GitHub
parent bd92567553
commit f5df9fb8d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      .github/workflows/archlinux.yml
  2. 111
      packages/b/bgfx/xmake.lua
  3. 10
      packages/b/bullet3/xmake.lua
  4. 4
      packages/l/libx11/xmake.lua

@ -20,6 +20,7 @@ jobs:
- name: Installation
run: |
pacman -Sy --noconfirm --needed git base-devel perl make unzip
pacman -Sy --noconfirm --needed mesa
- uses: actions/checkout@v1
- uses: xmake-io/github-action-setup-xmake@v1
with:

@ -0,0 +1,111 @@
package("bgfx")
set_homepage("https://bkaradzic.github.io/bgfx/")
set_description("Cross-platform, graphics API agnostic, “Bring Your Own Engine/Framework” style rendering library")
set_license("BSD-2-Clause")
add_urls("https://github.com/bkaradzic/bgfx.git")
add_versions("7816", "5ecddbf4d51e2dda2a56ae8cafef4810e3a45d87")
add_resources("7816", "bx", "https://github.com/bkaradzic/bx.git", "51f25ba638b9cb35eb2ac078f842a4bed0746d56")
add_resources("7816", "bimg", "https://github.com/bkaradzic/bimg.git", "8355d36befc90c1db82fca8e54f38bfb7eeb3530")
if is_plat("windows") then
add_syslinks("user32", "gdi32", "psapi")
elseif is_plat("macosx") then
add_frameworks("Metal", "QuartzCore", "Cocoa")
elseif is_plat("linux") then
add_deps("libx11")
add_syslinks("GL", "pthread", "dl")
end
on_load("windows", "macosx", "linux", function (package)
local suffix = package:debug() and "Debug" or "Release"
for _, lib in ipairs({"bgfx", "bimg", "bx"}) do
package:add("links", lib .. suffix)
end
end)
on_install("windows", "macosx", "linux", function (package)
local bxdir = package:resourcefile("bx")
local bimgdir = package:resourcefile("bimg")
local genie = path.join(bxdir, "tools", "bin")
if is_host("windows") then
genie = path.join(genie, "windows", "genie.exe")
elseif is_host("macosx") then
genie = path.join(genie, "darwin", "genie")
elseif is_host("linux") then
genie = path.join(genie, "linux", "genie")
end
local args = {"--with-tools"}
os.trycp(path.join("include", "bgfx"), package:installdir("include"))
os.trycp(path.join(bxdir, "include", "*"), package:installdir("include"))
os.trycp(path.join(bimgdir, "include", "*"), package:installdir("include"))
local mode = package:debug() and "Debug" or "Release"
if package:is_plat("windows") then
import("package.tools.msbuild")
import("core.tool.toolchain")
local msvc = toolchain.load("msvc")
table.insert(args, "vs" .. msvc:config("vs"))
local envs = msbuild.buildenvs(package)
envs.BX_DIR = bxdir
envs.BIMG_DIR = bimgdir
os.vrunv(genie, args, {envs = envs})
local configs = {}
table.insert(configs, "/p:Configuration=" .. mode)
table.insert(configs, "/p:Platform=" .. (package:is_arch("x64") and "x64" or "Win32"))
table.insert(configs, "bgfx.sln")
os.cd(format(".build/projects/vs%s", msvc:config("vs")))
msbuild.build(package, configs)
os.trycp("../../win*_vs*/bin/*.lib|*example*", package:installdir("lib"))
os.trycp("../../win*_vs*/bin/*.exe", package:installdir("bin"))
else
import("package.tools.make")
local configs
local target
if package:is_plat("macosx") then
target = (package:is_arch("x86_64") and "osx-x64" or "osx-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"
configs = {"-C",
".build/projects/gmake-linux",
"config=" .. mode:lower() .. (package:is_arch("x86_64") and "64" or "32")}
end
table.insert(args, "gmake")
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
os.trycp(".build/" .. target .. "/bin/*.a|*example*", package:installdir("lib"))
os.trycp(".build/" .. target .. "/bin/*|.build/*.*", package:installdir("bin"))
elseif package:is_plat("linux") then
os.trycp(".build/" .. target .. "/bin/*.a|*example*", package:installdir("lib"))
os.trycp(".build/" .. target .. "/bin/*|.build/*.*", package:installdir("bin"))
end
end
package:addenv("PATH", "bin")
end)
on_test(function (package)
assert(package:check_cxxsnippets({test = [[
void test() {
bgfx::init();
}
]]}, {configs = {languages = "c++14"}, includes = "bgfx/bgfx.h"}))
end)

@ -2,6 +2,7 @@ package("bullet3")
set_homepage("http://bulletphysics.org")
set_description("Bullet Physics SDK.")
set_license("zlib")
set_urls("https://github.com/bulletphysics/bullet3/archive/$(version).zip",
"https://github.com/bulletphysics/bullet3.git")
@ -18,12 +19,17 @@ package("bullet3")
add_includedirs("include", "include/bullet")
on_install("macosx", "linux", "windows", function (package)
if package:is_plat("windows") and package:config("shared") then
raise("shared library is not available on windows.")
end
local configs = {"-DBUILD_CPU_DEMOS=OFF", "-DBUILD_OPENGL3_DEMOS=OFF", "-DBUILD_BULLET2_DEMOS=OFF", "-DBUILD_UNIT_TESTS=OFF"}
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
table.insert(configs, "-DUSE_DOUBLE_PRECISION=" .. (package:config("double_precision") and "ON" or "OFF"))
table.insert(configs, "-DBUILD_EXTRAS=" .. (package:config("extras") and "ON" or "OFF"))
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
table.insert(configs, "-DUSE_MSVC_RUNTIME_LIBRARY_DLL=" .. (package:config("vs_runtime"):startswith("MD") and "ON" or "OFF"))
if package:is_plat("windows") then
table.insert(configs, "-DUSE_MSVC_RUNTIME_LIBRARY_DLL=" .. (package:config("vs_runtime"):startswith("MD") and "ON" or "OFF"))
end
import("package.tools.cmake").install(package, configs, {buildir = "build"})
os.cp("src/**.h", package:installdir("include", "bullet"), {rootdir = "src"})

@ -7,6 +7,10 @@ package("libx11")
add_versions("1.6.9", "9cc7e8d000d6193fa5af580d50d689380b8287052270f5bb26a5fb6b58b2bed1")
add_versions("1.7.0", "36c8f93b6595437c8cfbc9f08618bcb3041cbd303e140a0013f88e4c2977cb54")
if is_plat("linux") then
add_extsources("apt::libx11-dev")
end
if is_plat("macosx", "linux") then
add_deps("pkg-config", "util-macros", "xtrans", "libxcb", "xorgproto")
end

Loading…
Cancel
Save