Bias project-level objdir to default "obj"; gives better behavior from clean

This commit is contained in:
starkos 2009-07-15 14:38:28 +00:00
parent 6b59a3b23f
commit f66fbf53f3
3 changed files with 30 additions and 10 deletions

View File

@ -327,7 +327,12 @@
--
-- Computes a unique objects directory for every configuration.
-- Computes a unique objects directory for every configuration, using the
-- following choices:
-- [1] -> the objects directory as set in the project of config
-- [2] -> [1] + the platform name
-- [3] -> [2] + the configuration name
-- [4] -> [3] + the project name
--
local function builduniquedirs()
@ -349,13 +354,12 @@
dirs[4] = path.join(dirs[3], cfg.project.name)
cfg_dirs[cfg] = dirs
for v = 1, num_variations do
-- configurations other than the root should bias toward a more
-- description path, including the platform or config name
local start = iif(cfg.name, 2, 1)
for v = start, num_variations do
local d = dirs[v]
if hit_counts[d] then
hit_counts[d] = hit_counts[d] + 1
else
hit_counts[d] = 1
end
hit_counts[d] = (hit_counts[d] or 0) + 1
end
end
@ -369,12 +373,12 @@
for _, cfg in pairs(prj.__configs) do
local dir
for v = 1, num_variations do
local start = iif(cfg.name, 2, 1)
for v = start, num_variations do
dir = cfg_dirs[cfg][v]
if hit_counts[dir] == 1 then break end
end
cfg.objectsdir = path.getrelative(cfg.location, dir)
end
end
end

View File

@ -113,6 +113,7 @@
language "C++"
kind "ConsoleApp"
prepare()
test.contains(removed, "obj")
test.contains(removed, "obj/Debug")
test.contains(removed, "obj/Release")
end
@ -160,7 +161,6 @@
language "C++"
kind "ConsoleApp"
prepare()
for _,v in ipairs(removed) do if v:startswith("obj/") then print(v) end end
test.contains(removed, "obj/Debug")
test.contains(removed, "obj/Release")
test.contains(removed, "obj/x32/Debug")

View File

@ -52,69 +52,85 @@
end
--
-- Tests
--
function T.configs.SolutionFields()
prepare()
test.isequal("Debug:Release", table.concat(cfg.configurations,":"))
end
function T.configs.ProjectFields()
prepare()
test.isequal("C", cfg.language)
end
function T.configs.ProjectWideSettings()
prepare()
test.isequal("SOLUTION:PROJECT:NATIVE", table.concat(prj.defines,":"))
end
function T.configs.BuildCfgSettings()
prepare()
test.isequal("SOLUTION:SOLUTION_DEBUG:PROJECT:DEBUG:NATIVE", table.concat(cfg.defines,":"))
end
function T.configs.PlatformSettings()
prepare()
local cfg = premake.getconfig(prj, "Debug", "x32")
test.isequal("SOLUTION:SOLUTION_DEBUG:PROJECT:DEBUG:X86_32", table.concat(cfg.defines,":"))
end
function T.configs.SetsConfigName()
prepare()
local cfg = premake.getconfig(prj, "Debug", "x32")
test.isequal("Debug", cfg.name)
end
function T.configs.SetsPlatformName()
prepare()
local cfg = premake.getconfig(prj, "Debug", "x32")
test.isequal("x32", cfg.platform)
end
function T.configs.SetsPlatformNativeName()
test.isequal("Native", cfg.platform)
end
function T.configs.SetsShortName()
prepare()
local cfg = premake.getconfig(prj, "Debug", "x32")
test.isequal("debug32", cfg.shortname)
end
function T.configs.SetsNativeShortName()
prepare()
test.isequal("debug", cfg.shortname)
end
function T.configs.SetsLongName()
prepare()
local cfg = premake.getconfig(prj, "Debug", "x32")
test.isequal("Debug|x32", cfg.longname)
end
function T.configs.SetsNativeLongName()
prepare()
test.isequal("Debug", cfg.longname)
end
function T.configs.SetsProject()
prepare()