improve shaderc (#1439)

* improve shaderc

* fix bgfx

* fix shaderc
pull/1440/head
Hoildkv 3 years ago committed by GitHub
parent b405a398e8
commit 71df5b3686
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      packages/b/bgfx/xmake.lua
  2. 18
      packages/s/shaderc/xmake.lua

@ -16,6 +16,7 @@ package("bgfx")
if is_plat("windows") then
add_syslinks("user32", "gdi32", "psapi")
add_includedirs("include", "include/compat/msvc")
add_cxxflags("/Zc:__cplusplus")
elseif is_plat("macosx") then
add_frameworks("Metal", "QuartzCore", "Cocoa", "IOKit")
elseif is_plat("linux") then
@ -30,6 +31,7 @@ package("bgfx")
for _, lib in ipairs({"bgfx", "bimg", "bx"}) do
package:add("links", lib .. suffix)
end
package:add("defines", "BX_CONFIG_DEBUG=" .. (package:debug() and "1" or "0"))
end)
on_install("windows", "macosx", "linux", function (package)

@ -4,10 +4,13 @@ package("shaderc")
set_description("A collection of tools, libraries, and tests for Vulkan shader compilation.")
set_license("Apache-2.0")
add_urls("https://github.com/google/shaderc.git")
add_versions("2021.11.22", "657c5ed2ba1714c0430895a274a94d6f2aeeab85")
add_urls("https://github.com/google/shaderc/archive/refs/tags/$(version).tar.gz",
"https://github.com/google/shaderc.git")
add_versions("v2022.2", "517d36937c406858164673db696dc1d9c7be7ef0960fbf2965bfef768f46b8c0")
add_configs("binaryonly", { description = "Only use binary program.", default = false, type = "boolean"})
if is_plat("windows") then
add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
end
add_deps("cmake", "python 3.x", {kind = "binary"})
@ -16,7 +19,7 @@ package("shaderc")
end
on_load(function (package)
if package:config("binaryonly") then
if package:is_binary() then
package:set("kind", "binary")
end
if package:config("shared") then
@ -27,7 +30,7 @@ package("shaderc")
end)
on_fetch(function (package, opt)
if opt.system and package:config("binaryonly") then
if opt.system and package:is_binary() then
return package:find_tool("glslc")
end
end)
@ -38,12 +41,15 @@ package("shaderc")
local configs = {"-DSHADERC_ENABLE_EXAMPLES=OFF", "-DSHADERC_SKIP_TESTS=ON", "-DSHADERC_ENABLE_COPYRIGHT_CHECK=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"))
if package:is_plat("windows") then
table.insert(configs, "-DSHADERC_ENABLE_SHARED_CRT=" .. (package:config("vs_runtime"):startswith("MT") and "OFF" or "ON"))
end
import("package.tools.cmake").install(package, configs)
end)
on_test(function (package)
os.vrun("glslc --version")
if not package:config("binaryonly") then
if not package:is_binary() then
assert(package:has_cfuncs("shaderc_compiler_initialize", {includes = "shaderc/shaderc.h"}))
end
end)

Loading…
Cancel
Save