2014-07-21 22:49:56 +00:00
|
|
|
---
|
|
|
|
-- tests/oven/test_objdirs.lua
|
|
|
|
-- Test the per-configuration object directory assignments.
|
2015-08-30 15:38:35 +00:00
|
|
|
-- Copyright (c) 2014-2015 Jason Perkins and the Premake project
|
2014-07-21 22:49:56 +00:00
|
|
|
---
|
|
|
|
|
2017-04-25 05:44:13 +00:00
|
|
|
local p = premake
|
2014-07-21 22:49:56 +00:00
|
|
|
local suite = test.declare("oven_objdirs")
|
2017-04-25 05:44:13 +00:00
|
|
|
local oven = p.oven
|
2014-07-21 22:49:56 +00:00
|
|
|
|
|
|
|
---
|
|
|
|
-- Setup
|
|
|
|
---
|
|
|
|
|
2015-08-30 15:38:35 +00:00
|
|
|
local wks, prj
|
|
|
|
|
2014-07-21 22:49:56 +00:00
|
|
|
function suite.setup()
|
2016-10-27 15:49:05 +00:00
|
|
|
wks = workspace("MyWorkspace")
|
|
|
|
configurations { "Debug", "Release" }
|
|
|
|
prj = project "MyProject"
|
2014-07-21 22:49:56 +00:00
|
|
|
end
|
|
|
|
|
2016-10-27 15:49:05 +00:00
|
|
|
local function prepare(buildcfg, platform)
|
|
|
|
cfg = test.getconfig(prj, buildcfg, platform)
|
2014-07-21 22:49:56 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
function suite.singleProject_noPlatforms()
|
2016-10-27 15:49:05 +00:00
|
|
|
prepare("Debug")
|
|
|
|
test.isequal(path.getabsolute("obj/Debug"), cfg.objdir)
|
2014-07-21 22:49:56 +00:00
|
|
|
|
2016-10-27 15:49:05 +00:00
|
|
|
prepare("Release")
|
|
|
|
test.isequal(path.getabsolute("obj/Release"), cfg.objdir)
|
2014-07-21 22:49:56 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function suite.multipleProjects_noPlatforms()
|
|
|
|
project "MyProject2"
|
2016-10-27 15:49:05 +00:00
|
|
|
prepare("Debug")
|
2014-07-21 22:49:56 +00:00
|
|
|
|
2015-08-28 20:16:14 +00:00
|
|
|
test.createproject(wks)
|
2016-10-27 15:49:05 +00:00
|
|
|
test.isequal(path.getabsolute("obj/Debug/MyProject"), cfg.objdir)
|
2014-07-21 22:49:56 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function suite.singleProject_withPlatforms()
|
2015-04-13 22:27:11 +00:00
|
|
|
platforms { "x86", "x86_64" }
|
2016-10-27 15:49:05 +00:00
|
|
|
prepare("Debug", "x86")
|
2014-07-21 22:49:56 +00:00
|
|
|
|
2016-10-27 15:49:05 +00:00
|
|
|
test.isequal(path.getabsolute("obj/x86/Debug"), cfg.objdir)
|
2014-07-21 22:49:56 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function suite.singleProject_uniqueByTokens_noPlatforms()
|
|
|
|
objdir "obj/%{cfg.buildcfg}"
|
2016-10-27 15:49:05 +00:00
|
|
|
prepare("Debug")
|
2014-07-21 22:49:56 +00:00
|
|
|
|
2016-10-27 15:49:05 +00:00
|
|
|
test.isequal(path.getabsolute("obj/Debug"), cfg.objdir)
|
2014-07-21 22:49:56 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function suite.singleProject_uniqueByTokens_withPlatforms()
|
2015-04-13 22:27:11 +00:00
|
|
|
platforms { "x86", "x86_64" }
|
2014-07-21 22:49:56 +00:00
|
|
|
objdir "obj/%{cfg.buildcfg}_%{cfg.platform}"
|
2016-10-27 15:49:05 +00:00
|
|
|
prepare("Debug", "x86")
|
2014-07-21 22:49:56 +00:00
|
|
|
|
2016-10-27 15:49:05 +00:00
|
|
|
test.isequal(path.getabsolute("obj/Debug_x86"), cfg.objdir)
|
2014-07-21 22:49:56 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function suite.allowOverlap_onPrefixCode()
|
2015-04-13 22:27:11 +00:00
|
|
|
platforms { "x86", "x86_64" }
|
2014-07-21 22:49:56 +00:00
|
|
|
objdir "!obj/%{cfg.buildcfg}"
|
2016-10-27 15:49:05 +00:00
|
|
|
prepare("Debug", "x86")
|
|
|
|
|
|
|
|
test.isequal(path.getabsolute("obj/Debug"), cfg.objdir)
|
|
|
|
end
|
|
|
|
|
|
|
|
function suite.allowOverlap_onPrefixCode_withEnvironmentVariable()
|
|
|
|
platforms { "x86", "x86_64" }
|
|
|
|
objdir "!$(SolutionDir)/%{cfg.buildcfg}"
|
|
|
|
prepare("Debug", "x86")
|
2014-07-21 22:49:56 +00:00
|
|
|
|
2016-10-27 15:49:05 +00:00
|
|
|
test.isequal("$(SolutionDir)/Debug", cfg.objdir)
|
2014-07-21 22:49:56 +00:00
|
|
|
end
|