Update directx shader compiler (#1872)

* update directx shader compiler

* add linux support

* fix windows install

* fix clang build

* fix typo

* fix typo

* pass compiling on linux

* fix cmake deps

* fix typo

* add cmake dep

* add ninjia

* add go binding patch for v1.7.22.12

* remove build shared flags

* add configs
pull/1884/head
L-Sun 2 years ago committed by GitHub
parent 498baa7cf8
commit 191d73161e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 22
      packages/d/directxshadercompiler/patches/disable_go_bindings.patch
  2. 46
      packages/d/directxshadercompiler/xmake.lua

@ -0,0 +1,22 @@
diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake
index f58d48253..10733561e 100644
--- a/cmake/config-ix.cmake
+++ b/cmake/config-ix.cmake
@@ -519,7 +519,7 @@ else()
find_program(GO_EXECUTABLE NAMES go DOC "go executable")
if(GO_EXECUTABLE STREQUAL "GO_EXECUTABLE-NOTFOUND")
message(STATUS "Go bindings disabled.")
- else()
+ elseif(EXISTS ${CMAKE_SOURCE_DIR}/bindings/go/conftest.go)
execute_process(COMMAND ${GO_EXECUTABLE} run ${CMAKE_SOURCE_DIR}/bindings/go/conftest.go
RESULT_VARIABLE GO_CONFTEST)
if(GO_CONFTEST STREQUAL "0")
@@ -528,6 +528,8 @@ else()
else()
message(STATUS "Go bindings disabled, need at least Go 1.2.")
endif()
+ else()
+ message(STATUS "Missing ${CMAKE_SOURCE_DIR}/bindings/go/conftest.go, Go bindings disabled.")
endif()
endif()

@ -6,11 +6,25 @@ package("directxshadercompiler")
local date = {["1.5.2010"] = "2020_10-22", local date = {["1.5.2010"] = "2020_10-22",
["1.6.2104"] = "2021_04-20", ["1.6.2104"] = "2021_04-20",
["1.6.2106"] = "2021_07_01"} ["1.6.2106"] = "2021_07_01",
add_urls("https://github.com/microsoft/DirectXShaderCompiler/releases/download/v$(version).zip", {version = function (version) return version .. "/dxc_" .. date[tostring(version)] end}) ["1.7.2212"] = "2022_12_16"}
add_versions("1.5.2010", "b691f63778f470ebeb94874426779b2f60685fc8711adf1b1f9f01535d9b67f8") if is_plat("windows") then
add_versions("1.6.2104", "ee5e96d58134957443ded04be132e2e19240c534d7602e3ab8fd5adc5156014a") add_urls("https://github.com/microsoft/DirectXShaderCompiler/releases/download/v$(version).zip", {version = function (version) return version .. "/dxc_" .. date[tostring(version)] end})
add_versions("1.6.2106", "053b2d90c227cae84e7ce636bc4f7c25acd224c31c11a324885acbf5dd8b7aac") add_versions("1.5.2010", "b691f63778f470ebeb94874426779b2f60685fc8711adf1b1f9f01535d9b67f8")
add_versions("1.6.2104", "ee5e96d58134957443ded04be132e2e19240c534d7602e3ab8fd5adc5156014a")
add_versions("1.6.2106", "053b2d90c227cae84e7ce636bc4f7c25acd224c31c11a324885acbf5dd8b7aac")
add_versions("1.7.2212", "ed77c7775fcf1e117bec8b5bb4de6735af101b733d3920dda083496dceef130f")
elseif is_plat("linux") and is_arch("x86_64") then
add_urls("https://github.com/microsoft/DirectXShaderCompiler.git")
add_versions("v1.7.2212", "f2643f8699299ab4e77421952e9c24f7483b46896d9f4cc6b4790b22c90d2ff0")
add_patches("v1.7.2212", path.join(os.scriptdir(), "patches", "disable_go_bindings.patch"), "2337f4f94d4c27c3caf0e6b0f00efd1bee719f79c0bb3b0d7e74c2859546c73a")
add_extsources("pacman::directx-shader-compiler")
add_deps("cmake", "ninja")
end
add_configs("shared", {description = "Using shared binaries.", default = true, type = "boolean", readonly = true})
on_install("windows|x64", function (package) on_install("windows|x64", function (package)
os.cp("bin/x64/*", package:installdir("bin")) os.cp("bin/x64/*", package:installdir("bin"))
@ -19,7 +33,27 @@ package("directxshadercompiler")
package:addenv("PATH", "bin") package:addenv("PATH", "bin")
end) end)
on_install("linux|x86_64", function (package)
local configs = {
"-C ../cmake/caches/PredefinedParams.cmake"
}
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
import("package.tools.cmake").build(package, configs, {cmake_generator = "Ninja", buildir = "build"})
if package:has_tool("cxx", "clang") then
package:add("cxxflags", "-fms-extensions")
end
os.cp("build/bin/dxc", package:installdir("bin"))
os.cp("include/dxc", package:installdir("include"))
os.cp("build/lib/libdxcompiler.so*", package:installdir("lib"))
package:addenv("PATH", "bin")
end)
on_test(function (package) on_test(function (package)
os.vrun("dxc -help") os.vrun("dxc -help")
assert(package:has_cxxfuncs("DxcCreateInstance", {includes = {"windows.h", "dxcapi.h"}})) if package:is_plat("windows") then
assert(package:has_cxxfuncs("DxcCreateInstance", {includes = {"windows.h", "dxcapi.h"}}))
elseif package:is_plat("linux") then
assert(package:has_cxxfuncs("DxcCreateInstance", {includes = {"dxc/dxcapi.h"}}))
end
end) end)

Loading…
Cancel
Save