package An official xmake package repository
https://xrepo.xmake.io/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
2.2 KiB
43 lines
2.2 KiB
package("glslang") |
|
|
|
set_homepage("https://github.com/KhronosGroup/glslang/") |
|
set_description("Khronos-reference front end for GLSL/ESSL, partial front end for HLSL, and a SPIR-V generator.") |
|
set_license("Apache-2.0") |
|
|
|
add_urls("https://github.com/KhronosGroup/glslang.git") |
|
add_versions("1.2.154+1", "bacaef3237c515e40d1a24722be48c0a0b30f75f") |
|
add_versions("1.2.162+0", "c594de23cdd790d64ad5f9c8b059baae0ee2941d") |
|
add_versions("1.2.189+1", "2fb89a0072ae7316af1c856f22663fde4928128a") |
|
|
|
add_deps("cmake", "python 3.x", {kind = "binary"}) |
|
add_deps("spirv-tools") |
|
if is_plat("linux") then |
|
add_syslinks("pthread") |
|
end |
|
|
|
on_install("linux", "windows", "macosx", function (package) |
|
package:addenv("PATH", "bin") |
|
io.replace("CMakeLists.txt", "ENABLE_OPT OFF", "ENABLE_OPT ON") |
|
io.replace("StandAlone/CMakeLists.txt", "target_link_libraries(glslangValidator ${LIBRARIES})", [[ |
|
target_link_libraries(glslangValidator ${LIBRARIES} SPIRV-Tools-opt SPIRV-Tools-link SPIRV-Tools-reduce SPIRV-Tools) |
|
]], {plain = true}) |
|
io.replace("SPIRV/CMakeLists.txt", "target_link_libraries(SPIRV PRIVATE MachineIndependent SPIRV-Tools-opt)", [[ |
|
target_link_libraries(SPIRV PRIVATE MachineIndependent SPIRV-Tools-opt SPIRV-Tools-link SPIRV-Tools-reduce SPIRV-Tools) |
|
]], {plain = true}) |
|
local configs = {"-DENABLE_CTEST=OFF", "-DBUILD_EXTERNAL=OFF"} |
|
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release")) |
|
if package:is_plat("windows") then |
|
table.insert(configs, "-DBUILD_SHARED_LIBS=OFF") |
|
else |
|
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF")) |
|
end |
|
import("package.tools.cmake").install(package, configs, {packagedeps = {"spirv-tools"}}) |
|
package:add("links", "glslang", "MachineIndependent", "GenericCodeGen", "OGLCompiler", "OSDependent", "HLSL", "SPIRV", "SPVRemapper") |
|
end) |
|
|
|
on_test(function (package) |
|
os.vrun("glslangValidator --version") |
|
assert(package:has_cxxfuncs("ShInitialize", {configs = {languages = "c++11"}, includes = "glslang/Public/ShaderLang.h"})) |
|
end) |
|
|
|
|
|
|