zengine-old/test/littleVulkanEngine/xmake/tasks.lua

37 lines
1.1 KiB
Lua
Raw Normal View History

2023-07-05 09:27:55 +08:00
task("shader")
-- Set the run script
on_run(function ()
-- Import parameter option module
import("core.project.config")
-- Loading configuration
config.load()
-- Get the GLSLC binary path
glslc_path = config.get("glslc_path")
if config.get("glslc_path") == "" then
glslc_path = "/usr/bin/glslc"
config.set("glslc_path", glslc_path)
config.save()
end
if os.exists(glslc_path) then
os.execv(glslc_path, { "shaders/simple_shader.vert", "-o", "shaders/simple_shader.vert.spv" })
os.execv(glslc_path, { "shaders/simple_shader.frag", "-o", "shaders/simple_shader.frag.spv" })
cprint("${green}Shader built successfully!${clear}")
else
os.raise(format("${red} GLSLC path doesn't exists: %s", glslc_path))
end
end)
set_menu{
-- Settings menu usage
usage = "xmake shader",
-- Setup menu description
description = "Build shaders",
-- Setup menu options
{}
}
task_end()