2012-01-11 21:30:59 +00:00
|
|
|
--
|
2015-08-30 15:38:35 +00:00
|
|
|
-- tests/workspace/test_objdirs.lua
|
|
|
|
-- Test the workspace unique objects directory building.
|
|
|
|
-- Copyright (c) 2012-2015 Jason Perkins and the Premake project
|
2012-01-11 21:30:59 +00:00
|
|
|
--
|
|
|
|
|
2015-08-30 15:38:35 +00:00
|
|
|
local suite = test.declare("workspace_objdir")
|
2012-01-11 21:30:59 +00:00
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Setup and teardown
|
|
|
|
--
|
|
|
|
|
2015-08-28 20:16:14 +00:00
|
|
|
local wks
|
2012-01-11 21:30:59 +00:00
|
|
|
|
|
|
|
function suite.setup()
|
2015-10-14 12:04:22 +00:00
|
|
|
premake.action.set("test")
|
2015-08-30 15:38:35 +00:00
|
|
|
wks = workspace("MyWorkspace")
|
2012-01-11 21:30:59 +00:00
|
|
|
system "macosx"
|
|
|
|
end
|
|
|
|
|
2012-06-20 22:16:46 +00:00
|
|
|
local function result()
|
2015-08-28 20:16:14 +00:00
|
|
|
local platforms = wks.platforms or {}
|
2013-11-14 13:52:55 +00:00
|
|
|
local prj = project("MyProject")
|
|
|
|
local cfg = test.getconfig(prj, "Debug", platforms[1])
|
|
|
|
return premake.project.getrelative(cfg.project, cfg.objdir)
|
2012-01-11 21:30:59 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Objects directory should "obj" by default.
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.directoryIsObj_onNoValueSet()
|
|
|
|
configurations { "Debug" }
|
2012-06-20 22:16:46 +00:00
|
|
|
test.isequal("obj", result())
|
2012-01-11 21:30:59 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- If a conflict occurs between platforms, the platform names should
|
|
|
|
-- be used to make unique.
|
|
|
|
--
|
|
|
|
|
2012-04-24 20:57:02 +00:00
|
|
|
function suite.directoryIncludesPlatform_onPlatformConflict()
|
2012-01-11 21:30:59 +00:00
|
|
|
configurations { "Debug" }
|
2015-04-13 22:27:11 +00:00
|
|
|
platforms { "x86", "x86_64" }
|
|
|
|
test.isequal("obj/x86", result())
|
2012-01-11 21:30:59 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- If a conflict occurs between build configurations, the build
|
|
|
|
-- configuration names should be used to make unique.
|
|
|
|
--
|
|
|
|
|
2012-04-24 20:57:02 +00:00
|
|
|
function suite.directoryIncludesBuildCfg_onBuildCfgConflict()
|
2012-01-11 21:30:59 +00:00
|
|
|
configurations { "Debug", "Release" }
|
2012-06-20 22:16:46 +00:00
|
|
|
test.isequal("obj/Debug", result())
|
2012-01-11 21:30:59 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- If a conflict occurs between both build configurations and platforms,
|
|
|
|
-- both should be used to make unique.
|
|
|
|
--
|
|
|
|
|
2012-04-24 20:57:02 +00:00
|
|
|
function suite.directoryIncludesBuildCfg_onPlatformAndBuildCfgConflict()
|
2012-01-11 21:30:59 +00:00
|
|
|
configurations { "Debug", "Release" }
|
2015-04-13 22:27:11 +00:00
|
|
|
platforms { "x86", "x86_64" }
|
|
|
|
test.isequal("obj/x86/Debug", result())
|
2012-01-11 21:30:59 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- If a conflict occurs between projects, the project name should be
|
|
|
|
-- used to make unique.
|
|
|
|
--
|
|
|
|
|
2012-04-24 20:57:02 +00:00
|
|
|
function suite.directoryIncludesBuildCfg_onProjectConflict()
|
2012-01-11 21:30:59 +00:00
|
|
|
configurations { "Debug", "Release" }
|
|
|
|
project "MyProject2"
|
2012-06-20 22:16:46 +00:00
|
|
|
test.isequal("obj/Debug/MyProject", result())
|
2012-01-11 21:30:59 +00:00
|
|
|
end
|
|
|
|
|