From 4ecc701ad207c2ed87f69cc92715173aa7a44df4 Mon Sep 17 00:00:00 2001 From: Lynix Date: Mon, 16 May 2016 20:02:59 +0200 Subject: [PATCH] Build: Copy all dependency modules to the example directory Former-commit-id: e6c2cb47433d84c17e7277125180469f2b3f0d37 --- build/scripts/common.lua | 53 +++++++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 23 deletions(-) diff --git a/build/scripts/common.lua b/build/scripts/common.lua index a0957966d..ec95c2641 100644 --- a/build/scripts/common.lua +++ b/build/scripts/common.lua @@ -190,25 +190,7 @@ function NazaraBuild:Execute() -- Copy the module binaries to the example folder if (os.is("windows")) then - configuration({}) - postbuildcommands({[[xcopy "%{path.translate(cfg.linktarget.relpath):sub(1, -5) .. ".dll"}" "..\..\..\examples\bin\" /E /Y]]}) - - for k,v in pairs(table.join(moduleTable.Libraries, moduleTable.DynLib)) do - local paths = {} - table.insert(paths, {"x32", "../extlibs/lib/common/x86/" .. v .. ".dll"}) - table.insert(paths, {"x32", "../extlibs/lib/common/x86/lib" .. v .. ".dll"}) - table.insert(paths, {"x64", "../extlibs/lib/common/x64/" .. v .. ".dll"}) - table.insert(paths, {"x64", "../extlibs/lib/common/x64/lib" .. v .. ".dll"}) - - for k,v in pairs(paths) do - local config = v[1] - local path = v[2] - if (os.isfile(path)) then - configuration(config) - postbuildcommands({[[xcopy "%{path.translate(cfg.linktarget.relpath:sub(1, -#cfg.linktarget.name - 1) .. "../../]] .. path .. [[")}" "..\..\..\examples\bin\" /E /Y]]}) - end - end - end + self:MakeCopyAfterBuild(moduleTable) end configuration({"vs*", "x32"}) @@ -323,10 +305,7 @@ function NazaraBuild:Execute() -- Copy the module binaries to the example folder if (toolTable.CopyTargetToExampleDir) then - if (os.is("windows")) then - configuration({}) - postbuildcommands({[[xcopy "%{path.translate(cfg.linktarget.relpath):sub(1, -5) .. ".dll"}" "..\..\..\examples\bin\" /E /Y]]}) - end + self:MakeCopyAfterBuild(toolTable) end configuration({"vs*", "x32"}) @@ -867,6 +846,34 @@ function NazaraBuild:Process(infoTable) end end +function NazaraBuild:MakeCopyAfterBuild(infoTable) + if (os.is("windows")) then + configuration({}) + postbuildcommands({[[xcopy "%{path.translate(cfg.linktarget.relpath):sub(1, -5) .. ".dll"}" "..\..\..\examples\bin\" /E /Y]]}) + + for k,v in pairs(table.join(infoTable.Libraries, infoTable.DynLib)) do + local paths = {} + table.insert(paths, {"x32", "../extlibs/lib/common/x86/" .. v .. ".dll"}) + table.insert(paths, {"x32", "../extlibs/lib/common/x86/lib" .. v .. ".dll"}) + table.insert(paths, {"x64", "../extlibs/lib/common/x64/" .. v .. ".dll"}) + table.insert(paths, {"x64", "../extlibs/lib/common/x64/lib" .. v .. ".dll"}) + + for k,v in pairs(paths) do + local config = v[1] + local path = v[2] + if (os.isfile(path)) then + if (infoTable.Kind == "plugin") then + path = "../../" .. path + end + + configuration(config) + postbuildcommands({[[xcopy "%{path.translate(cfg.linktarget.relpath:sub(1, -#cfg.linktarget.name - 1) .. "../../]] .. path .. [[")}" "..\..\..\examples\bin\" /E /Y]]}) + end + end + end + end +end + function NazaraBuild:SetupInfoTable(infoTable) infoTable.ConfigurationLibraries = {} infoTable.ConfigurationLibraries.DebugStatic = {}