From 91c9706016d018ab1d984b051d90cd7c39cad6bc Mon Sep 17 00:00:00 2001 From: SirLynix Date: Fri, 2 Feb 2024 23:39:07 +0100 Subject: [PATCH] Build: Fix OpenGL/Vulkan packages in static/embedded_renderer Build: Fix circular dependencies when compiling static Update xmake.lua --- xmake.lua | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/xmake.lua b/xmake.lua index 71af80de8..fbf1aaf87 100644 --- a/xmake.lua +++ b/xmake.lua @@ -186,6 +186,14 @@ local modules = { add_defines("NAZARA_RENDERER_EMBEDDEDBACKENDS") for name, module in table.orderpairs(rendererBackends) do if not module.Option or has_config(module.Option) then + if module.Deps then + module = table.clone(module, 1) -- shallow clone + module.Deps = table.remove_if(table.clone(module.Deps), function (idx, dep) return dep == "NazaraRenderer" end) + if #module.Deps == 0 then + module.Deps = nil + end + end + ModuleTargetConfig(name, module) end end @@ -519,6 +527,20 @@ function ModuleTargetConfig(name, module) remove_files("src/Nazara/" .. name .. "/Posix/**") end + if module.Deps then + add_deps(table.unpack(module.Deps)) + end + + if module.Packages then + add_packages(table.unpack(module.Packages)) + end + + if module.PublicPackages then + for _, pkg in ipairs(module.PublicPackages) do + add_packages(pkg, { public = true }) + end + end + if module.Custom then module.Custom() end @@ -545,20 +567,6 @@ for name, module in pairs(modules) do add_packages("fmt") -- fmt is a special package that is not public but required by all Nazara modules add_rpathdirs("$ORIGIN") - if module.Deps then - add_deps(table.unpack(module.Deps)) - end - - if module.Packages then - add_packages(table.unpack(module.Packages)) - end - - if module.PublicPackages then - for _, pkg in ipairs(module.PublicPackages) do - add_packages(pkg, { public = true }) - end - end - if has_config("usepch") then set_pcxxheader("include/Nazara/" .. name .. ".hpp") end