diff --git a/Dependencies/dxcompiler/dxcompiler.lua b/Dependencies/dxcompiler/dxcompiler.lua index 7bfbf76..d350fd9 100644 --- a/Dependencies/dxcompiler/dxcompiler.lua +++ b/Dependencies/dxcompiler/dxcompiler.lua @@ -1,7 +1,7 @@ local dep = Solution.Util.CreateDepTable("dxcompiler", {}) Solution.Util.CreateDep(dep.Name, dep.Dependencies, function() - local cachedData = Solution.Util.GetDepCache(dep, "cache") + local cachedData = Solution.Util.GetDepCache(dep.Name, "cache") local libPath, lib if cachedData then @@ -9,7 +9,8 @@ Solution.Util.CreateDep(dep.Name, dep.Dependencies, function() else libPath = iif(os.istarget("windows"), dep.Path .. "/lib/windows", dep.Path .. "/lib/linux") lib = iif(os.istarget("windows"), libPath .. "/dxcompiler.lib", libPath .. "/dxcompiler") - Solution.Util.SetDepCache(dep, "cache", { libPaths = libPath, libs = lib }) + Solution.Util.SetDepCache(dep.Name, "cache", { libPaths = libPath, libs = lib }) + print(Solution.Util.GetDepCache(dep.Name, "cache")) end Solution.Util.SetLibDirs(libPath) diff --git a/Dependencies/glfw/glfw.lua b/Dependencies/glfw/glfw.lua index 9ed91bc..9aee41e 100644 --- a/Dependencies/glfw/glfw.lua +++ b/Dependencies/glfw/glfw.lua @@ -102,8 +102,8 @@ Solution.Util.CreateStaticLib(dep.Name, Solution.Projects.Current.BinDir, dep.De Solution.Util.SetIncludes(dep.Path) end) -local function populateDepCache(dep) - local cachedData = Solution.Util.GetDepCache(dep, "cache") +local function populateDepCache(depName) + local cachedData = Solution.Util.GetDepCache(depName, "cache") if not cachedData then local def = { "GLFW_INCLUDE_VULKAN", "_CRT_SECURE_NO_WARNINGS" } @@ -129,20 +129,17 @@ local function populateDepCache(dep) Solution.Util.MergeIntoTable(link, { "pthread" }) end cachedData = { defines = def, links = link } - Solution.Util.SetDepCache(dep, "cache", cachedData) + Solution.Util.SetDepCache(depName, "cache", cachedData) end return cachedData end Solution.Util.CreateDep(dep.NameLow, dep.Dependencies, function() - -- get our own internal dependency table, and not the parent one - local depTable = Solution.Util.GetDepTable(dep.NameLow) - -- get our own local cache - local cachedData = Solution.Util.GetDepCache(depTable, "cache") + local cachedData = Solution.Util.GetDepCache(dep.NameLow, "cache") if not cachedData then - cachedData = populateDepCache(depTable) + cachedData = populateDepCache(dep.NameLow) end local defines, links = cachedData.defines, cachedData.links diff --git a/Dependencies/vulkan/vulkan.lua b/Dependencies/vulkan/vulkan.lua index ce5b07f..e520710 100644 --- a/Dependencies/vulkan/vulkan.lua +++ b/Dependencies/vulkan/vulkan.lua @@ -24,14 +24,14 @@ end local dep = Solution.Util.CreateDepTable("vulkan", {}) Solution.Util.CreateDep(dep.Name, dep.Dependencies, function() - local cachedData = Solution.Util.GetDepCache(dep, "cache") + local cachedData = Solution.Util.GetDepCache(dep.Name, "cache") local includeDirs, libs if cachedData then includeDirs, libs = cachedData.includes, cachedData.libs else includeDirs, libs = getVulkanInfo() - Solution.Util.SetDepCache(dep, "cache", { includes = includeDirs, libs = libs }) + Solution.Util.SetDepCache(dep.Name, "cache", { includes = includeDirs, libs = libs }) end Solution.Util.SetIncludes(includeDirs) diff --git a/Premake/ProjectUtil.lua b/Premake/ProjectUtil.lua index d491589..2de7063 100644 --- a/Premake/ProjectUtil.lua +++ b/Premake/ProjectUtil.lua @@ -88,7 +88,7 @@ Solution.Util.CreateModuleTable = function(name, dependencies) end Solution.Util.CreateDepTable = function(name, dependencies) - local dependency = { Name = name, Cache = {} } + local dependency = { Name = name } dependency.NameLow = string.lower(dependency.Name) dependency.Path = path.getabsolute(dependency.NameLow .. "/", Solution.Projects.Current.DependencyDir) @@ -108,12 +108,14 @@ Solution.Util.GetDepTable = function(depName) end -- Cache a value inside the dep table -Solution.Util.SetDepCache = function(dep, key, data) +Solution.Util.SetDepCache = function(depName, key, data) + local dep = Solution.Util.GetDepTable(depName) dep.Cache[key] = data end -- Retrieve a cached value from the dep table, or return nil if not cached -Solution.Util.GetDepCache = function(dep, key) +Solution.Util.GetDepCache = function(depName, key) + local dep = Solution.Util.GetDepTable(depName) if dep.Cache[key] then return dep.Cache[key] end