From 85a074b0eff79e6ded906f9d30dc359674da1704 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Tue, 4 Oct 2016 22:48:59 -0700 Subject: [PATCH] Cleanup. --- scripts/bgfx.lua | 12 +++++++++++- scripts/shaderc.lua | 10 ++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/scripts/bgfx.lua b/scripts/bgfx.lua index ce38efb72..a3716b976 100644 --- a/scripts/bgfx.lua +++ b/scripts/bgfx.lua @@ -3,13 +3,23 @@ -- License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause -- +function filesexist(_srcPath, _dstPath, _files) + for _, file in ipairs(_files) do + file = path.getrelative(_srcPath, file) + local filePath = path.join(_dstPath, file) + if not os.isfile(filePath) then return false end + end + + return true +end + function overridefiles(_srcPath, _dstPath, _files) local remove = {} local add = {} for _, file in ipairs(_files) do file = path.getrelative(_srcPath, file) - local filePath = path.join(BGFX_DIR, "../bgfx-ext", file) + local filePath = path.join(_dstPath, file) if not os.isfile(filePath) then return end table.insert(remove, path.join(_srcPath, file)) diff --git a/scripts/shaderc.lua b/scripts/shaderc.lua index f6aae1a6e..052286f09 100644 --- a/scripts/shaderc.lua +++ b/scripts/shaderc.lua @@ -118,8 +118,14 @@ project "shaderc" path.join(BGFX_DIR, "tools/shaderc/shaderc_pssl.cpp"), }) - overridefiles(BGFX_DIR, path.join(BGFX_DIR, "../bgfx-ext"), { + if filesexist(BGFX_DIR, path.join(BGFX_DIR, "../bgfx-ext"), { + path.join(BGFX_DIR, "scripts/shaderc.lua"), }) then + + removefiles { path.join(BGFX_DIR, "tools/shaderc/shaderc_spirv.cpp"), - }) + } + + dofile(path.join(BGFX_DIR, "../bgfx-ext/scripts/shaderc.lua") ) + end strip()