diff --git a/src/tools/dotnet.lua b/src/tools/dotnet.lua index d16f54fa08..d6424c5154 100644 --- a/src/tools/dotnet.lua +++ b/src/tools/dotnet.lua @@ -255,6 +255,17 @@ end +-- +-- Returns the relative path to passed value for the given project. +-- This can be overriden by actions to allow for more customized relative +-- path behaviors. +-- + +function dotnet.getrelative(cfg, value) + return project.getrelative(cfg.project, value) +end + + -- -- Returns a list of compiler flags, based on the supplied configuration. @@ -286,7 +297,7 @@ table.insert(flags, '/noconfig') if cfg.project.icon then - local fn = project.getrelative(cfg.project, cfg.project.icon) + local fn = dotnet.getrelative(cfg.project, cfg.project.icon) table.insert(flags, string.format('/win32icon:"%s"', fn)) end diff --git a/src/tools/gcc.lua b/src/tools/gcc.lua index e4aa12c2bb..6997a901d4 100644 --- a/src/tools/gcc.lua +++ b/src/tools/gcc.lua @@ -274,6 +274,15 @@ return result end +-- +-- Returns the relative path to passed value for the given project. +-- This can be overriden by actions to allow for more customized relative +-- path behaviors. +-- + + function gcc.getrelative(cfg, value) + return project.getrelative(cfg.project, value) + end -- -- Returns a list of forced include files, decorated for the compiler @@ -289,7 +298,7 @@ local result = {} table.foreachi(cfg.forceincludes, function(value) - local fn = project.getrelative(cfg.project, value) + local fn = gcc.getrelative(cfg.project, value) table.insert(result, string.format('-include %s', p.quoted(fn))) end) @@ -322,24 +331,24 @@ function gcc.getincludedirs(cfg, dirs, extdirs, frameworkdirs, includedirsafter) local result = {} for _, dir in ipairs(dirs) do - dir = project.getrelative(cfg.project, dir) + dir = gcc.getrelative(cfg.project, dir) table.insert(result, '-I' .. p.quoted(dir)) end if table.contains(os.getSystemTags(cfg.system), "darwin") then for _, dir in ipairs(frameworkdirs or {}) do - dir = project.getrelative(cfg.project, dir) + dir = gcc.getrelative(cfg.project, dir) table.insert(result, '-F' .. p.quoted(dir)) end end for _, dir in ipairs(extdirs or {}) do - dir = project.getrelative(cfg.project, dir) + dir = gcc.getrelative(cfg.project, dir) table.insert(result, '-isystem ' .. p.quoted(dir)) end for _, dir in ipairs(includedirsafter or {}) do - dir = project.getrelative(cfg.project, dir) + dir = gcc.getrelative(cfg.project, dir) table.insert(result, '-idirafter ' .. p.quoted(dir)) end @@ -370,18 +379,18 @@ -- test locally in the project folder first (this is the most likely location) local testname = path.join(cfg.project.basedir, pch) if os.isfile(testname) then - return project.getrelative(cfg.project, testname) + return gcc.getrelative(cfg.project, testname) else -- else scan in all include dirs. for _, incdir in ipairs(cfg.includedirs) do testname = path.join(incdir, pch) if os.isfile(testname) then - return project.getrelative(cfg.project, testname) + return gcc.getrelative(cfg.project, testname) end end end - return project.getrelative(cfg.project, path.getabsolute(pch)) + return gcc.getrelative(cfg.project, path.getabsolute(pch)) end -- @@ -535,14 +544,14 @@ if table.contains(os.getSystemTags(cfg.system), "darwin") then for _, dir in ipairs(cfg.frameworkdirs) do - dir = project.getrelative(cfg.project, dir) + dir = gcc.getrelative(cfg.project, dir) table.insert(flags, '-F' .. p.quoted(dir)) end end if cfg.flags.RelativeLinks then for _, dir in ipairs(config.getlinks(cfg, "siblings", "directory")) do - local libFlag = "-L" .. p.project.getrelative(cfg.project, dir) + local libFlag = "-L" .. gcc.getrelative(cfg.project, dir) if not table.contains(flags, libFlag) then table.insert(flags, libFlag) end diff --git a/src/tools/msc.lua b/src/tools/msc.lua index e8349929bb..98a2ed4f28 100644 --- a/src/tools/msc.lua +++ b/src/tools/msc.lua @@ -266,6 +266,17 @@ end +-- +-- Returns the relative path to passed value for the given project. +-- This can be overriden by actions to allow for more customized relative +-- path behaviors. +-- + + function msc.getrelative(cfg, value) + return project.getrelative(cfg.project, value) + end + + -- -- Returns a list of forced include files, decorated for the compiler -- command line. @@ -280,7 +291,7 @@ local result = {} table.foreachi(cfg.forceincludes, function(value) - local fn = project.getrelative(cfg.project, value) + local fn = msc.getrelative(cfg.project, value) table.insert(result, "/FI" .. p.quoted(fn)) end) @@ -298,12 +309,12 @@ function msc.getincludedirs(cfg, dirs, extdirs, frameworkdirs, includedirsafter) local result = {} for _, dir in ipairs(dirs) do - dir = project.getrelative(cfg.project, dir) + dir = msc.getrelative(cfg.project, dir) table.insert(result, '-I' .. p.quoted(dir)) end for _, dir in ipairs(extdirs or {}) do - dir = project.getrelative(cfg.project, dir) + dir = msc.getrelative(cfg.project, dir) if isVersionGreaterOrEqualTo(cfg.toolset, "msc-v142") then table.insert(result, '/external:I' .. p.quoted(dir)) else @@ -312,7 +323,7 @@ end for _, dir in ipairs(includedirsafter or {}) do - dir = project.getrelative(cfg.project, dir) + dir = msc.getrelative(cfg.project, dir) if isVersionGreaterOrEqualTo(cfg.toolset, "msc-v142") then table.insert(result, '/external:I' .. p.quoted(dir)) else @@ -394,7 +405,7 @@ local flags = {} local dirs = table.join(cfg.libdirs, cfg.syslibdirs) for i, dir in ipairs(dirs) do - dir = project.getrelative(cfg.project, dir) + dir = msc.getrelative(cfg.project, dir) table.insert(flags, '/LIBPATH:"' .. dir .. '"') end return flags