Merge branch 'ssurtees/fixedEmptyProjectBug' of https://github.com/LORgames/premake-core into LORgames-ssurtees/fixedEmptyProjectBug

# Conflicts:
#	tests/actions/vstudio/vc2010/test_platform_toolset.lua
This commit is contained in:
Jason Perkins 2015-09-16 18:35:25 -04:00
commit d623e47d2a
3 changed files with 40 additions and 21 deletions

View File

@ -145,6 +145,7 @@
if cfg.kind == p.UTILITY then
return {
m.configurationType,
m.platformToolset,
}
else
return {
@ -349,7 +350,7 @@
end
function m.resourceCompile(cfg)
if cfg.system ~= p.XBOX360 and config.hasResourceFiles(cfg) then
if cfg.system ~= p.XBOX360 and p.config.hasFile(cfg, path.isresourcefile) then
local contents = p.capture(function ()
p.push()
p.callArray(m.elements.resourceCompile, cfg)
@ -1560,12 +1561,12 @@
version = action.vstudio.platformToolset
end
if version then
-- should only be written if there is a C/C++ file in the config
for i = 1, #cfg.files do
if path.iscppfile(cfg.files[i]) then
if cfg.kind == p.NONE or cfg.kind == p.MAKEFILE then
if p.config.hasFile(cfg, path.iscppfile) then
m.element("PlatformToolset", nil, version)
break
end
else
m.element("PlatformToolset", nil, version)
end
end
end

View File

@ -359,14 +359,15 @@
--
-- Determine if a configuration contains one or more resource files.
--
---
-- Returns true if any of the files in the provided container pass the
-- provided test function.
---
function config.hasResourceFiles(self)
function config.hasFile(self, testfn)
local files = self.files
for i = 1, #files do
if path.isresourcefile(files[i]) then
if testfn(files[i]) then
return true
end
end

View File

@ -56,17 +56,6 @@
end
--
-- Element should only be written if C++ files are present.
--
function suite.empty_onNoRelevantSources()
removefiles "hello.cpp"
prepare()
test.isemptycapture()
end
--
-- Check for overrides from project scripts.
--
@ -102,3 +91,31 @@
<PlatformToolset>LLVM-vs2014_xp</PlatformToolset>
]]
end
--
-- Check if platform toolset element is being emitted correctly.
--
function suite.output_onConsoleAppAndNoCpp()
kind "ConsoleApp"
removefiles "hello.cpp"
prepare()
test.capture [[
<PlatformToolset>v110</PlatformToolset>
]]
end
function suite.skipped_onNoMakefileAndNoCpp()
kind "Makefile"
removefiles "hello.cpp"
prepare()
test.isemptycapture()
end
function suite.output_onNoMakefileAndCpp()
kind "Makefile"
prepare()
test.capture [[
<PlatformToolset>v110</PlatformToolset>
]]
end