Branimir Karadžić 9 years ago
parent
commit
85a074b0ef
2 changed files with 19 additions and 3 deletions
  1. 11 1
      scripts/bgfx.lua
  2. 8 2
      scripts/shaderc.lua

+ 11 - 1
scripts/bgfx.lua

@@ -3,13 +3,23 @@
 -- License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause
 -- 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)
 function overridefiles(_srcPath, _dstPath, _files)
 
 
 	local remove = {}
 	local remove = {}
 	local add = {}
 	local add = {}
 	for _, file in ipairs(_files) do
 	for _, file in ipairs(_files) do
 		file = path.getrelative(_srcPath, file)
 		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
 		if not os.isfile(filePath) then return end
 
 
 		table.insert(remove, path.join(_srcPath, file))
 		table.insert(remove, path.join(_srcPath, file))

+ 8 - 2
scripts/shaderc.lua

@@ -118,8 +118,14 @@ project "shaderc"
 			path.join(BGFX_DIR, "tools/shaderc/shaderc_pssl.cpp"),
 			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"),
 			path.join(BGFX_DIR, "tools/shaderc/shaderc_spirv.cpp"),
-	})
+		}
+
+		dofile(path.join(BGFX_DIR, "../bgfx-ext/scripts/shaderc.lua") )
+	end
 
 
 	strip()
 	strip()