diff --git a/packages/s/spirv-cross/xmake.lua b/packages/s/spirv-cross/xmake.lua new file mode 100644 index 000000000..7502f3778 --- /dev/null +++ b/packages/s/spirv-cross/xmake.lua @@ -0,0 +1,27 @@ +package("spirv-cross") + + set_homepage("https://github.com/KhronosGroup/SPIRV-Cross/") + set_description("SPIRV-Cross is a practical tool and library for performing reflection on SPIR-V and disassembling SPIR-V back to high level languages.") + set_license("Apache-2.0") + + add_urls("https://github.com/KhronosGroup/SPIRV-Cross/archive/$(version).tar.gz", {version = function (version) return version:gsub("%.", "-") end}) + add_versions("2020.09.17", "a3351742fe1fae9a15e91abbfb5314d96f5f77927ed07f55124d6df830ac97a7") + + add_deps("cmake") + add_links("spirv-cross-c", "spirv-cross-cpp", "spirv-cross-reflect", "spirv-cross-msl", "spirv-cross-util", "spirv-cross-hlsl", "spirv-cross-glsl", "spirv-cross-core") + + on_install("windows", "linux", "macosx", function (package) + local configs = {"-DSPIRV_CROSS_ENABLE_TESTS=OFF"} + if package:config("shared") then + table.insert(configs, "-DSPIRV_CROSS_SHARED=ON") + else + table.insert(configs, "-DSPIRV_CROSS_SHARED=OFF") + end + import("package.tools.cmake").install(package, configs) + package:addenv("PATH", "bin") + end) + + on_test(function (package) + os.vrun("spirv-cross --help") + assert(package:has_cfuncs("spvc_get_version", {includes = "spirv_cross/spirv_cross_c.h"})) + end) diff --git a/packages/s/spirv-reflect/xmake.lua b/packages/s/spirv-reflect/xmake.lua new file mode 100644 index 000000000..15edd8439 --- /dev/null +++ b/packages/s/spirv-reflect/xmake.lua @@ -0,0 +1,28 @@ +package("spirv-reflect") + + set_homepage("https://github.com/KhronosGroup/SPIRV-Reflect") + set_description("SPIRV-Reflect is a lightweight library that provides a C/C++ reflection API for SPIR-V shader bytecode in Vulkan applications.") + set_license("Apache-2.0") + + add_urls("https://github.com/KhronosGroup/SPIRV-Reflect.git") + add_versions("1.2.154+1", "5de48fe8d3ef434e846d64ed758adc5d26335ae5") + + add_deps("spirv-headers") + + on_install("windows", "linux", "macosx", function (package) + io.gsub("spirv_reflect.h", "#include \"%.%/include%/spirv%/unified1%/spirv.h\"", "#include \"spirv/unified1/spirv.h\"") + io.writefile("xmake.lua", [[ + add_rules("mode.debug", "mode.release") + add_requires("spirv-headers") + target("spirv-reflect") + set_kind("static") + add_packages("spirv-headers") + add_files("spirv_reflect.c") + add_headerfiles("spirv_reflect.h") + ]]) + import("package.tools.xmake").install(package) + end) + + on_test(function (package) + assert(package:has_cfuncs("spvReflectGetCodeSize", {includes = "spirv_reflect.h"})) + end) diff --git a/packages/v/vulkan-headers/xmake.lua b/packages/v/vulkan-headers/xmake.lua new file mode 100644 index 000000000..a3f3b036f --- /dev/null +++ b/packages/v/vulkan-headers/xmake.lua @@ -0,0 +1,22 @@ +package("vulkan-headers") + + set_homepage("https://github.com/KhronosGroup/Vulkan-Headers/") + set_description("Vulkan Header files and API registry") + set_license("Apache-2.0") + + add_urls("https://github.com/KhronosGroup/Vulkan-Headers/archive/sdk-$(version).tar.gz", {version = function (version) return version:gsub("%+", ".") end}) + add_versions("1.2.154+0", "a0528ade4dd3bd826b960ba4ccabc62e92ecedc3c70331b291e0a7671b3520f9") + + add_deps("cmake") + + on_install("windows", "linux", "macosx", function (package) + import("package.tools.cmake").install(package) + end) + + on_test(function (package) + assert(package:check_csnippets({test = [[ + void test() { + int version = VK_HEADER_VERSION; + } + ]]}, {includes = "vulkan/vulkan.h"})) + end)