summaryrefslogtreecommitdiff
path: root/xmake.lua
diff options
context:
space:
mode:
authoromnisci3nce <17525998+omnisci3nce@users.noreply.github.com>2024-03-27 21:05:04 +1100
committeromnisci3nce <17525998+omnisci3nce@users.noreply.github.com>2024-03-27 21:05:04 +1100
commit80cdd4f2b1c2a3355926b59a85e14100b3daa7b7 (patch)
tree0c7787806aeb5613462e4e966fccd9f4de1c57b7 /xmake.lua
parent90248a622203da205916ac89a1ac144d363cf37d (diff)
simple shaders for testing
Diffstat (limited to 'xmake.lua')
-rw-r--r--xmake.lua17
1 files changed, 14 insertions, 3 deletions
diff --git a/xmake.lua b/xmake.lua
index 32e5ba4..5457ccb 100644
--- a/xmake.lua
+++ b/xmake.lua
@@ -63,7 +63,7 @@ local core_sources = {
"src/systems/*.c",
}
-rule("compile_glsl_shaders")
+rule("compile_glsl_vert_shaders")
set_extensions(".vert")
on_buildcmd_file(function (target, batchcmds, sourcefile, opt)
local targetfile = path.join(target:targetdir(), path.basename(sourcefile) .. ".vert.spv")
@@ -72,6 +72,15 @@ rule("compile_glsl_shaders")
batchcmds:vrunv('glslc', {sourcefile, "-o", targetfile})
batchcmds:add_depfiles(sourcefile)
end)
+rule("compile_glsl_frag_shaders")
+ set_extensions(".frag")
+ on_buildcmd_file(function (target, batchcmds, sourcefile, opt)
+ local targetfile = path.join(target:targetdir(), path.basename(sourcefile) .. ".frag.spv")
+
+ print("Compiling shader: %s", sourcefile)
+ batchcmds:vrunv('glslc', {sourcefile, "-o", targetfile})
+ batchcmds:add_depfiles(sourcefile)
+end)
-- TODO: Metal shaders compilation
-- common configuration for both static and shared libraries
@@ -94,9 +103,11 @@ target("core_config")
add_includedirs("src/std/", {public = true})
add_includedirs("src/std/containers", {public = true})
add_includedirs("src/systems/", {public = true})
- add_rules("compile_glsl_shaders")
+ add_rules("compile_glsl_vert_shaders")
+ add_rules("compile_glsl_frag_shaders")
add_files("src/empty.c") -- for some reason we need this on Mac so it doesnt call 'ar' with no files and error
- add_files("assets/shaders/*.vert")
+ add_files("assets/shaders/triangle.vert")
+ add_files("assets/shaders/triangle.frag")
-- add_files("assets/shaders/*.frag")
set_default(false) -- prevents standalone building of this target