-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathembedded_files.lua
More file actions
53 lines (39 loc) · 1.46 KB
/
embedded_files.lua
File metadata and controls
53 lines (39 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
--
-- Zidar - Build system
-- Copyright (c) 2025-2026 Milos Tosic, Rudji Games. All rights reserved.
-- License: https://github.com/RudjiGames/zidar/blob/master/LICENSE
--
function shaderConfigure( _platform, _configuration, _projectName )
if _shaderFiles == nil then
return
end
local SHADER_PREBUILD_LUA_PATH = '"' .. RG_ROOT_DIR .. "/zidar/embedded_shader_prebuild.lua" .. '"'
flatten( _shaderFiles )
local LUAEXE = "lua "
local shaderc = RG_ROOT_DIR .. "/tools/bgfx/shaderc"
if os.is("windows") then
shaderc = RG_ROOT_DIR .. "/tools/bgfx/shaderc.exe"
LUAEXE = "lua.exe "
end
local function starts_with(str, start) return str:sub(1, #start) == start end
-- Set up shader pre-build steps
for _,file in ipairs( _shaderFiles ) do
local scFileBase = path.getname(file)
if scFileBase ~= "varying.def" then
local srcFile = path.getabsolute(file)
local commandSuffix = srcFile .. ' ' .. shaderc .. ' ' .. RG_ROOT_DIR .. "/3rd/bgfx/src/ ".. RG_ROOT_DIR .. "/3rd/bgfx/examples/common/"
-- vertex shader
if starts_with(scFileBase, "vs_") then
prebuildcommands { LUAEXE .. SHADER_PREBUILD_LUA_PATH .. ' -vs ' .. commandSuffix }
end
if starts_with(scFileBase, "fs_") then
prebuildcommands { LUAEXE .. SHADER_PREBUILD_LUA_PATH .. ' -fs ' .. commandSuffix }
end
if starts_with(scFileBase, "cs_") then
prebuildcommands { LUAEXE .. SHADER_PREBUILD_LUA_PATH .. ' -cs ' .. commandSuffix }
end
end
end
configuration {}
return {}
end