Make baked cfg.objdir absolute, to be consistent with other path fields

This commit is contained in:
Jason Perkins 2012-06-20 18:16:46 -04:00
parent 6ad4ec1506
commit 4b6daf8424
5 changed files with 11 additions and 15 deletions

View File

@ -406,7 +406,7 @@
function cpp.targetconfig(cfg)
local targetinfo = config.gettargetinfo(cfg)
_p(' OBJDIR = %s', make.esc(cfg.objdir))
_p(' OBJDIR = %s', make.esc(project.getrelative(cfg.project, cfg.objdir)))
_p(' TARGETDIR = %s', make.esc(targetinfo.directory))
_p(' TARGET = $(TARGETDIR)/%s', make.esc(targetinfo.name))
end

View File

@ -143,7 +143,7 @@
local outdir = path.translate(config.gettargetinfo(cfg).directory)
_x(3,'OutputDirectory="%s"', outdir)
_x(3,'IntermediateDirectory="%s"', path.translate(cfg.objdir))
_x(3,'IntermediateDirectory="%s"', path.translate(project.getrelative(cfg.project, cfg.objdir)))
local cfgtype
if (cfg.kind == "SharedLib") then

View File

@ -190,7 +190,7 @@
_x(2,'<OutputFile>$(OutDir)%s</OutputFile>', target.name)
end
_x(2,'<IntDir>%s\\</IntDir>', path.translate(cfg.objdir))
_x(2,'<IntDir>%s\\</IntDir>', path.translate(project.getrelative(cfg.project, cfg.objdir)))
_x(2,'<TargetName>%s%s</TargetName>', target.prefix, target.basename)
_x(2,'<TargetExt>%s</TargetExt>', target.extension)

View File

@ -187,7 +187,7 @@
for cfg, dirs in pairs(configs) do
for _, dir in ipairs(dirs) do
if counts[dir] == 1 then
cfg.objdir = project.getrelative(cfg.project, dir)
cfg.objdir = dir
break
end
end

View File

@ -20,11 +20,12 @@
system "macosx"
end
local function prepare()
local function result()
local platforms = sln.platforms or {}
project("MyProject")
prj = premake.solution.getproject_ng(sln, "MyProject")
cfg = premake5.project.getconfig(prj, "Debug", platforms[1])
return premake5.project.getrelative(prj, cfg.objdir)
end
@ -34,8 +35,7 @@
function suite.directoryIsObj_onNoValueSet()
configurations { "Debug" }
prepare()
test.isequal("obj", cfg.objdir)
test.isequal("obj", result())
end
@ -47,8 +47,7 @@
function suite.directoryIncludesPlatform_onPlatformConflict()
configurations { "Debug" }
platforms { "x32", "x64" }
prepare()
test.isequal("obj/x32", cfg.objdir)
test.isequal("obj/x32", result())
end
@ -59,8 +58,7 @@
function suite.directoryIncludesBuildCfg_onBuildCfgConflict()
configurations { "Debug", "Release" }
prepare()
test.isequal("obj/Debug", cfg.objdir)
test.isequal("obj/Debug", result())
end
@ -72,8 +70,7 @@
function suite.directoryIncludesBuildCfg_onPlatformAndBuildCfgConflict()
configurations { "Debug", "Release" }
platforms { "x32", "x64" }
prepare()
test.isequal("obj/x32/Debug", cfg.objdir)
test.isequal("obj/x32/Debug", result())
end
@ -85,7 +82,6 @@
function suite.directoryIncludesBuildCfg_onProjectConflict()
configurations { "Debug", "Release" }
project "MyProject2"
prepare()
test.isequal("obj/Debug/MyProject", cfg.objdir)
test.isequal("obj/Debug/MyProject", result())
end