Merge basic support for custom Visual Studio rule files

This commit is contained in:
Jason Perkins 2014-06-30 15:18:59 -04:00
commit 57667cc16a
18 changed files with 1260 additions and 674 deletions

View File

@ -136,6 +136,19 @@
tokens = true,
}
api.register {
name = "customRule",
scope = "config",
kind = "string",
}
api.register {
name = "customRules",
scope = "project",
kind = "list:file",
tokens = true,
}
api.register {
name = "debugargs",
scope = "config",

View File

@ -41,7 +41,7 @@
m.assemblyReferences,
m.files,
m.projectReferences,
m.import,
m.importExtensionTargets,
}
end
@ -65,7 +65,7 @@
defaultTargets = string.format(' DefaultTargets="%s"', target)
end
_p('<Project%s ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">', defaultTargets)
p.push('<Project%s ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">', defaultTargets)
end
@ -237,14 +237,14 @@
function m.itemDefinitionGroup(cfg)
if not vstudio.isMakefile(cfg) then
_p(1,'<ItemDefinitionGroup %s>', m.condition(cfg))
p.push('<ItemDefinitionGroup %s>', m.condition(cfg))
p.callArray(m.elements.itemDefinitionGroup, cfg)
_p(1,'</ItemDefinitionGroup>')
p.pop('</ItemDefinitionGroup>')
else
if cfg == project.getfirstconfig(cfg.project) then
_p(1,'<ItemDefinitionGroup>')
_p(1,'</ItemDefinitionGroup>')
p.w('<ItemDefinitionGroup>')
p.w('</ItemDefinitionGroup>')
end
end
end
@ -294,9 +294,9 @@
end
function m.clCompile(cfg)
_p(2,'<ClCompile>')
p.push('<ClCompile>')
p.callArray(m.elements.clCompile, cfg)
_p(2,'</ClCompile>')
p.pop('</ClCompile>')
end
@ -314,9 +314,9 @@
function m.resourceCompile(cfg)
if cfg.system ~= premake.XBOX360 then
_p(2,'<ResourceCompile>')
p.push('<ResourceCompile>')
p.callArray(m.elements.resourceCompile, cfg)
_p(2,'</ResourceCompile>')
p.pop('</ResourceCompile>')
end
end
@ -408,9 +408,9 @@
return
end
_p(2,'<Manifest>')
m.element(3, "AdditionalManifestFiles", nil, "%s %%(AdditionalManifestFiles)", table.concat(manifests, " "))
_p(2,'</Manifest>')
p.push('<Manifest>')
m.element("AdditionalManifestFiles", nil, "%s %%(AdditionalManifestFiles)", table.concat(manifests, " "))
p.pop('</Manifest>')
end
@ -472,101 +472,93 @@
end
--
---
-- Write out the list of source code files, and any associated configuration.
--
---
m.elements.fileGroups = {
"ClInclude",
"ClCompile",
"None",
"ResourceCompile",
"CustomBuild",
"CustomRule"
}
m.elements.files = function(prj, groups)
local calls = {}
for i, group in ipairs(m.elements.fileGroups) do
calls[i] = m[group .. "Files"]
end
return calls
end
function m.files(prj)
m.simplefilesgroup(prj, "ClInclude")
m.compilerfilesgroup(prj)
m.simplefilesgroup(prj, "None")
m.simplefilesgroup(prj, "ResourceCompile")
m.customBuildFilesGroup(prj)
-- Categorize the source files in groups by build rule; each will
-- be written to a separate item group by one of the handlers
local groups = m.categorizeSources(prj)
p.callArray(m.elements.files, prj, groups)
end
function m.simplefilesgroup(prj, group)
local files = m.getfilegroup(prj, group)
function m.ClCompileFiles(prj, group)
local files = group.ClCompile or {}
if #files > 0 then
_p(1,'<ItemGroup>')
p.push('<ItemGroup>')
for _, file in ipairs(files) do
-- Capture the contents of the <ClCompile> element, if any, so
-- I know which form to use.
local contents = p.capture(function ()
if group == "ResourceCompile" then
for cfg in project.eachconfig(prj) do
local condition = m.condition(cfg)
local filecfg = fileconfig.getconfig(file, cfg)
if cfg.system == premake.WINDOWS then
m.excludedFromBuild(cfg, filecfg)
end
end
end
end)
if #contents > 0 then
_x(2,'<%s Include=\"%s\">', group, path.translate(file.relpath))
_p("%s", contents)
_p(2,'</%s>', group)
else
_x(2,'<%s Include=\"%s\" />', group, path.translate(file.relpath))
end
end
_p(1,'</ItemGroup>')
end
end
function m.compilerfilesgroup(prj)
local files = m.getfilegroup(prj, "ClCompile")
if #files > 0 then
_p(1,'<ItemGroup>')
for _, file in ipairs(files) do
-- Capture the contents of the <ClCompile> element, if any, so
-- I know which form to use.
local contents = p.capture(function ()
p.push()
for cfg in project.eachconfig(prj) do
local condition = m.condition(cfg)
local filecfg = fileconfig.getconfig(file, cfg)
m.excludedFromBuild(cfg, filecfg)
if filecfg then
m.objectFileName(filecfg)
m.clCompilePreprocessorDefinitions(filecfg, condition)
m.optimization(filecfg, condition)
m.forceIncludes(filecfg, condition)
m.precompiledHeader(cfg, filecfg, condition)
m.enableEnhancedInstructionSet(filecfg, condition)
m.additionalCompileOptions(filecfg, condition)
local fcfg = fileconfig.getconfig(file, cfg)
m.excludedFromBuild(cfg, fcfg)
if fcfg then
local condition = m.condition(cfg)
m.objectFileName(fcfg)
m.clCompilePreprocessorDefinitions(fcfg, condition)
m.optimization(fcfg, condition)
m.forceIncludes(fcfg, condition)
m.precompiledHeader(cfg, fcfg, condition)
m.enableEnhancedInstructionSet(fcfg, condition)
m.additionalCompileOptions(fcfg, condition)
end
end
p.pop()
end)
if #contents > 0 then
_x(2,'<ClCompile Include=\"%s\">', path.translate(file.relpath))
_p("%s", contents)
_p(2,'</ClCompile>')
p.push('<ClCompile Include=\"%s\">', path.translate(file.relpath))
p.outln(contents)
p.pop('</ClCompile>')
else
_x(2,'<ClCompile Include=\"%s\" />', path.translate(file.relpath))
p.x('<ClCompile Include=\"%s\" />', path.translate(file.relpath))
end
end
_p(1,'</ItemGroup>')
p.pop('</ItemGroup>')
end
end
function m.customBuildFilesGroup(prj)
local files = m.getfilegroup(prj, "CustomBuild")
function m.ClIncludeFiles(prj, groups)
local files = groups.ClInclude or {}
if #files > 0 then
_p(1,'<ItemGroup>')
p.push('<ItemGroup>')
for i, file in ipairs(files) do
p.x('<ClInclude Include=\"%s\" />', path.translate(file.relpath))
end
p.pop('</ItemGroup>')
end
end
function m.CustomBuildFiles(prj, groups)
local files = groups.CustomBuild or {}
if #files > 0 then
p.push('<ItemGroup>')
for _, file in ipairs(files) do
_x(2,'<CustomBuild Include=\"%s\">', path.translate(file.relpath))
_p(3,'<FileType>Document</FileType>')
p.push('<CustomBuild Include=\"%s\">', path.translate(file.relpath))
p.w('<FileType>Document</FileType>')
for cfg in project.eachconfig(prj) do
local condition = m.condition(cfg)
@ -575,77 +567,171 @@
m.excludedFromBuild(cfg, filecfg)
local commands = table.concat(filecfg.buildcommands,'\r\n')
_p(3,'<Command %s>%s</Command>', condition, premake.esc(commands))
m.element("Command", condition, '%s', commands)
local outputs = project.getrelative(prj, filecfg.buildoutputs)
m.element(3, "Outputs", condition, '%s', table.concat(outputs, " "))
m.element("Outputs", condition, '%s', table.concat(outputs, " "))
if filecfg.buildmessage then
m.element(3, "Message", condition, '%s', premake.esc(filecfg.buildmessage))
m.element("Message", condition, '%s', filecfg.buildmessage)
end
end
end
_p(2,'</CustomBuild>')
p.pop('</CustomBuild>')
end
_p(1,'</ItemGroup>')
p.pop('</ItemGroup>')
end
end
function m.getfilegroup(prj, group)
-- check for a cached copy before creating
local groups = prj.vc2010_file_groups
if not groups then
groups = {
ClCompile = {},
ClInclude = {},
None = {},
ResourceCompile = {},
CustomBuild = {},
}
prj.vc2010_file_groups = groups
function m.CustomRuleFiles(prj, groups)
local vars = p.api.getCustomVars()
local tr = project.getsourcetree(prj)
tree.traverse(tr, {
onleaf = function(node)
-- if any configuration of this file uses a custom build rule,
-- then they all must be marked as custom build
local hasbuildrule = false
for cfg in project.eachconfig(prj) do
local filecfg = fileconfig.getconfig(node, cfg)
if fileconfig.hasCustomBuildRule(filecfg) then
hasbuildrule = true
break
-- Look for rules that aren't in the built-in rule list
for rule, files in pairs(groups) do
if not table.contains(m.elements.fileGroups, rule) and #files > 0 then
p.push('<ItemGroup>')
for _, file in ipairs(files) do
-- Capture any rule variables that have been set
local contents = p.capture(function()
p.push()
for _, var in ipairs(vars) do
for cfg in project.eachconfig(prj) do
local condition = m.condition(cfg)
local fcfg = fileconfig.getconfig(file, cfg)
if fcfg and fcfg[var] then
local key = p.api.getCustomVarKey(var)
local value = fcfg[var]
if type(value) == "table" then
local fmt = p.api.getCustomListFormat(var)
value = table.concat(value, fmt[1])
end
if #value > 0 then
m.element(key, condition, '%s', value)
-- p.x('<%s %s>%s</%s>', key, m.condition(fcfg.config), value, key)
end
end
end
end
end
p.pop()
end)
if hasbuildrule then
table.insert(groups.CustomBuild, node)
elseif path.iscppfile(node.name) then
table.insert(groups.ClCompile, node)
elseif path.iscppheader(node.name) then
table.insert(groups.ClInclude, node)
elseif path.isresourcefile(node.name) then
table.insert(groups.ResourceCompile, node)
if #contents > 0 then
p.push('<%s Include=\"%s\">', rule, path.translate(file.relpath))
p.outln(contents)
p.pop('</%s>', rule)
else
table.insert(groups.None, node)
p.x('<%s Include=\"%s\" />', rule, path.translate(file.relpath))
end
end
})
p.pop('</ItemGroup>')
end
end
end
-- sort by relative to path; otherwise VS will reorder the files
for group, files in pairs(groups) do
table.sort(files, function (a, b)
return a.relpath < b.relpath
function m.NoneFiles(prj, groups)
local files = groups.None or {}
if #files > 0 then
p.push('<ItemGroup>')
for i, file in ipairs(files) do
p.x('<None Include=\"%s\" />', path.translate(file.relpath))
end
p.pop('</ItemGroup>')
end
end
function m.ResourceCompileFiles(prj, groups)
local files = groups.ResourceCompile or {}
if #files > 0 then
p.push('<ItemGroup>')
for i, file in ipairs(files) do
local contents = p.capture(function ()
p.push()
for cfg in project.eachconfig(prj) do
local condition = m.condition(cfg)
local filecfg = fileconfig.getconfig(file, cfg)
if cfg.system == premake.WINDOWS then
m.excludedFromBuild(cfg, filecfg)
end
end
p.pop()
end)
if #contents > 0 then
p.push('<ResourceCompile Include=\"%s\">', path.translate(file.relpath))
p.outln(contents)
p.pop('</ResourceCompile>')
else
p.x('<ResourceCompile Include=\"%s\" />', path.translate(file.relpath))
end
end
p.pop('</ItemGroup>')
end
end
function m.categorize(prj, file)
-- If any configuration for this file uses a custom build step or a
-- custom, externally defined rule, that's the category to use
for cfg in project.eachconfig(prj) do
local fcfg = fileconfig.getconfig(file, cfg)
if fileconfig.hasCustomBuildRule(fcfg) then
return "CustomBuild"
elseif fcfg and fcfg.customRule then
return fcfg.customRule
end
end
return groups[group]
-- Otherwise use the file extension to deduce a category
if path.iscppfile(file.name) then
return "ClCompile"
elseif path.iscppheader(file.name) then
return "ClInclude"
elseif path.isresourcefile(file.name) then
return "ResourceCompile"
else
return "None"
end
end
function m.categorizeSources(prj)
local groups = prj._vc2010_sources
if groups then
return groups
end
groups = {}
prj._vc2010_sources = groups
local tr = project.getsourcetree(prj)
tree.traverse(tr, {
onleaf = function(node)
local cat = m.categorize(prj, node)
groups[cat] = groups[cat] or {}
table.insert(groups[cat], node)
end
})
-- sort by relative-to path; otherwise VS will reorder the files
for group, files in pairs(groups) do
table.sort(files, function (a, b)
return a.relpath < b.relpath
end)
end
return groups
end
--
-- Generate the list of project dependencies.
--
@ -696,7 +782,7 @@
if #includedirs > 0 then
local dirs = project.getrelative(cfg.project, includedirs)
dirs = path.translate(table.concat(dirs, ";"))
_x(3,'<AdditionalIncludeDirectories>%s;%%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>', dirs)
p.x('<AdditionalIncludeDirectories>%s;%%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>', dirs)
end
end
@ -713,7 +799,7 @@
if #cfg.usingdirs > 0 then
local dirs = project.getrelative(cfg.project, cfg.usingdirs)
dirs = path.translate(table.concat(dirs, ";"))
_x(3,'<AdditionalUsingDirectories>%s;%%(AdditionalUsingDirectories)</AdditionalUsingDirectories>', dirs)
p.x('<AdditionalUsingDirectories>%s;%%(AdditionalUsingDirectories)</AdditionalUsingDirectories>', dirs)
end
end
@ -721,7 +807,7 @@
function m.additionalCompileOptions(cfg, condition)
if #cfg.buildoptions > 0 then
local opts = table.concat(cfg.buildoptions, " ")
m.element(3, "AdditionalOptions", condition, '%s %%(AdditionalOptions)', opts)
m.element("AdditionalOptions", condition, '%s %%(AdditionalOptions)', opts)
end
end
@ -736,7 +822,7 @@
function m.basicRuntimeChecks(cfg)
if cfg.flags.NoRuntimeChecks then
_p(3,'<BasicRuntimeChecks>Default</BasicRuntimeChecks>')
p.w('<BasicRuntimeChecks>Default</BasicRuntimeChecks>')
end
end
@ -798,7 +884,7 @@
function m.culture(cfg)
local value = vstudio.cultureForLocale(cfg.locale)
if value then
_p(3,'<Culture>0x%04x</Culture>', value)
p.w('<Culture>0x%04x</Culture>', value)
end
end
@ -819,7 +905,7 @@
end
end
if value then
_p(3,'<DebugInformationFormat>%s</DebugInformationFormat>', value)
p.w('<DebugInformationFormat>%s</DebugInformationFormat>', value)
end
end
@ -848,7 +934,7 @@
end
if value then
m.element(3, 'EnableEnhancedInstructionSet', condition, value)
m.element('EnableEnhancedInstructionSet', condition, value)
end
end
@ -866,23 +952,23 @@
function m.exceptionHandling(cfg)
if cfg.flags.NoExceptions then
_p(3,'<ExceptionHandling>false</ExceptionHandling>')
p.w('<ExceptionHandling>false</ExceptionHandling>')
elseif cfg.flags.SEH then
_p(3,'<ExceptionHandling>Async</ExceptionHandling>')
p.w('<ExceptionHandling>Async</ExceptionHandling>')
end
end
function m.excludedFromBuild(cfg, filecfg)
if not filecfg or filecfg.flags.ExcludeFromBuild then
_p(3,'<ExcludedFromBuild %s>true</ExcludedFromBuild>', m.condition(cfg))
m.element("ExcludedFromBuild", m.condition(cfg), "true")
end
end
function m.floatingPointModel(cfg)
if cfg.floatingpoint then
_p(3,'<FloatingPointModel>%s</FloatingPointModel>', cfg.floatingpoint)
p.w('<FloatingPointModel>%s</FloatingPointModel>', cfg.floatingpoint)
end
end
@ -890,18 +976,18 @@
function m.forceIncludes(cfg, condition)
if #cfg.forceincludes > 0 then
local includes = path.translate(project.getrelative(cfg.project, cfg.forceincludes))
m.element(3, "ForcedIncludeFiles", condition, table.concat(includes, ';'))
m.element("ForcedIncludeFiles", condition, table.concat(includes, ';'))
end
if #cfg.forceusings > 0 then
local usings = path.translate(project.getrelative(cfg.project, cfg.forceusings))
_x(3,'<ForcedUsingFiles>%s</ForcedUsingFiles>', table.concat(usings, ';'))
m.element("ForcedUsingFiles", condition, table.concat(usings, ';'))
end
end
function m.functionLevelLinking(cfg)
if config.isOptimizedBuild(cfg) then
_p(3,'<FunctionLevelLinking>true</FunctionLevelLinking>')
p.w('<FunctionLevelLinking>true</FunctionLevelLinking>')
end
end
@ -951,10 +1037,15 @@
end
function m.import(prj)
_p(1,'<Import Project="$(VCTargetsPath)\\Microsoft.Cpp.targets" />')
_p(1,'<ImportGroup Label="ExtensionTargets">')
_p(1,'</ImportGroup>')
function m.importExtensionTargets(prj)
p.w('<Import Project="$(VCTargetsPath)\\Microsoft.Cpp.targets" />')
p.push('<ImportGroup Label="ExtensionTargets">')
table.foreachi(prj.customRules, function(value)
value = path.translate(project.getrelative(prj, value))
value = path.appendExtension(value, ".targets")
p.x('<Import Project="%s" />', value)
end)
p.pop('</ImportGroup>')
end
@ -966,9 +1057,14 @@
function m.importExtensionSettings(prj)
_p(1,'<Import Project="$(VCTargetsPath)\\Microsoft.Cpp.props" />')
_p(1,'<ImportGroup Label="ExtensionSettings">')
_p(1,'</ImportGroup>')
p.w('<Import Project="$(VCTargetsPath)\\Microsoft.Cpp.props" />')
p.push('<ImportGroup Label="ExtensionSettings">')
table.foreachi(prj.customRules, function(value)
value = path.translate(project.getrelative(prj, value))
value = path.appendExtension(value, ".props")
p.x('<Import Project="%s" />', value)
end)
p.pop('</ImportGroup>')
end
@ -988,7 +1084,7 @@
function m.intrinsicFunctions(cfg)
if config.isOptimizedBuild(cfg) then
_p(3,'<IntrinsicFunctions>true</IntrinsicFunctions>')
p.w('<IntrinsicFunctions>true</IntrinsicFunctions>')
end
end
@ -1051,7 +1147,7 @@
cfg.flags.MultiProcessorCompile or
cfg.debugformat == premake.C7
then
_p(3,'<MinimalRebuild>false</MinimalRebuild>')
p.w('<MinimalRebuild>false</MinimalRebuild>')
end
end
@ -1066,7 +1162,7 @@
function m.multiProcessorCompilation(cfg)
if cfg.flags.MultiProcessorCompile then
_p(3,'<MultiProcessorCompilation>true</MultiProcessorCompilation>')
p.w('<MultiProcessorCompilation>true</MultiProcessorCompilation>')
end
end
@ -1091,9 +1187,10 @@
end
function m.objectFileName(filecfg)
if filecfg.objname ~= filecfg.basename then
_p(3,'<ObjectFileName %s>$(IntDir)\\%s.obj</ObjectFileName>', m.condition(filecfg.config), filecfg.objname)
function m.objectFileName(fcfg)
if fcfg.objname ~= fcfg.basename then
p.w('<ObjectFileName %s>$(IntDir)\\%s.obj</ObjectFileName>', m.condition(fcfg.config), fcfg.objname)
end
end
@ -1101,7 +1198,7 @@
function m.omitDefaultLib(cfg)
if cfg.flags.OmitDefaultLibrary then
_p(3,'<OmitDefaultLibName>true</OmitDefaultLibName>')
p.w('<OmitDefaultLibName>true</OmitDefaultLibName>')
end
end
@ -1109,7 +1206,7 @@
function m.omitFramePointers(cfg)
if cfg.flags.NoFramePointer then
_p(3,'<OmitFramePointers>true</OmitFramePointers>')
p.w('<OmitFramePointers>true</OmitFramePointers>')
end
end
@ -1126,7 +1223,7 @@
local map = { Off="Disabled", On="Full", Debug="Disabled", Full="Full", Size="MinSpace", Speed="MaxSpeed" }
local value = map[cfg.optimize]
if value or not condition then
m.element(3, 'Optimization', condition, value or "Disabled")
m.element('Optimization', condition, value or "Disabled")
end
end
@ -1147,16 +1244,16 @@
function m.precompiledHeader(cfg, filecfg, condition)
if filecfg then
if cfg.pchsource == filecfg.abspath and not cfg.flags.NoPCH then
m.element(3, 'PrecompiledHeader', condition, 'Create')
m.element('PrecompiledHeader', condition, 'Create')
elseif filecfg.flags.NoPCH then
m.element(3, 'PrecompiledHeader', condition, 'NotUsing')
m.element('PrecompiledHeader', condition, 'NotUsing')
end
else
if not cfg.flags.NoPCH and cfg.pchheader then
_p(3,'<PrecompiledHeader>Use</PrecompiledHeader>')
_x(3,'<PrecompiledHeaderFile>%s</PrecompiledHeaderFile>', cfg.pchheader)
p.w('<PrecompiledHeader>Use</PrecompiledHeader>')
p.x('<PrecompiledHeaderFile>%s</PrecompiledHeaderFile>', cfg.pchheader)
else
_p(3,'<PrecompiledHeader>NotUsing</PrecompiledHeader>')
p.w('<PrecompiledHeader>NotUsing</PrecompiledHeader>')
end
end
end
@ -1169,7 +1266,7 @@
defines = defines:gsub('"', '\\"')
end
defines = premake.esc(defines) .. ";%%(PreprocessorDefinitions)"
m.element(3, 'PreprocessorDefinitions', condition, defines)
m.element('PreprocessorDefinitions', condition, defines)
end
end
@ -1177,7 +1274,7 @@
function m.programDataBaseFileName(cfg)
if cfg.flags.Symbols and cfg.debugformat ~= "c7" then
local filename = cfg.buildtarget.basename
_p(3,'<ProgramDataBaseFileName>$(OutDir)%s.pdb</ProgramDataBaseFileName>', filename)
p.w('<ProgramDataBaseFileName>$(OutDir)%s.pdb</ProgramDataBaseFileName>', filename)
end
end
@ -1242,7 +1339,7 @@
}
local runtime = runtimes[config.getruntime(cfg)]
if runtime then
_p(3,'<RuntimeLibrary>%s</RuntimeLibrary>', runtime)
p.w('<RuntimeLibrary>%s</RuntimeLibrary>', runtime)
end
end
@ -1256,13 +1353,13 @@
function m.bufferSecurityCheck(cfg)
if cfg.flags.NoBufferSecurityCheck then
_p(3,'<BufferSecurityCheck>false</BufferSecurityCheck>')
p.w('<BufferSecurityCheck>false</BufferSecurityCheck>')
end
end
function m.stringPooling(cfg)
if config.isOptimizedBuild(cfg) then
_p(3,'<StringPooling>true</StringPooling>')
p.w('<StringPooling>true</StringPooling>')
end
end
@ -1303,14 +1400,14 @@
local map = { On = "true", Off = "false" }
local value = map[cfg.nativewchar]
if value then
_p(3,'<TreatWChar_tAsBuiltInType>%s</TreatWChar_tAsBuiltInType>', value)
p.w('<TreatWChar_tAsBuiltInType>%s</TreatWChar_tAsBuiltInType>', value)
end
end
function m.treatWarningAsError(cfg)
if cfg.flags.FatalLinkWarnings and cfg.warnings ~= "Off" then
_p(3,'<TreatWarningAsError>true</TreatWarningAsError>')
p.w('<TreatWarningAsError>true</TreatWarningAsError>')
end
end
@ -1343,7 +1440,7 @@
function m.warningLevel(cfg)
local map = { Off = "TurnOffAllWarnings", Extra = "Level4" }
m.element(3, "WarningLevel", nil, "%s", map[cfg.warnings] or "Level3")
m.element("WarningLevel", nil, "%s", map[cfg.warnings] or "Level3")
end
@ -1384,7 +1481,7 @@
-- Optional additional arguments to satisfy any tokens in the value.
--
function m.element(depth, name, condition, value, ...)
function m.element(name, condition, value, ...)
if select('#',...) == 0 then
value = premake.esc(value)
end
@ -1396,5 +1493,5 @@
format = string.format('<%s>%s</%s>', name, value, name)
end
_x(depth, format, ...)
p.x(format, ...)
end

View File

@ -5,55 +5,76 @@
--
local p = premake
local vc2010 = p.vstudio.vc2010
local project = p.project
local tree = p.tree
local m = p.vstudio.vc2010
--
-- Generate a Visual Studio 201x C++ project, with support for the new platforms API.
--
function vc2010.generateFilters(prj)
vc2010.xmlDeclaration()
vc2010.project()
vc2010.filters_uniqueidentifiers(prj)
vc2010.filters_filegroup(prj, "None")
vc2010.filters_filegroup(prj, "ClInclude")
vc2010.filters_filegroup(prj, "ClCompile")
vc2010.filters_filegroup(prj, "ResourceCompile")
vc2010.filters_filegroup(prj, "CustomBuild")
function m.generateFilters(prj)
m.xmlDeclaration()
m.project()
m.uniqueIdentifiers(prj)
m.filterGroups(prj)
p.out('</Project>')
end
m.elements.filterGroups = {
"None",
"ClInclude",
"ClCompile",
"ResourceCompile",
"CustomBuild",
"CustomRule"
}
m.elements.filters = function(prj, groups)
local calls = {}
for i, group in ipairs(m.elements.filterGroups) do
calls[i] = m[group .. "Filters"]
end
return calls
end
function m.filterGroups(prj)
-- Categorize the source files in groups by build rule; each will
-- be written to a separate item group by one of the handlers
local groups = m.categorizeSources(prj)
p.callArray(m.elements.filters, prj, groups)
end
--
-- The first portion of the filters file assigns unique IDs to each
-- directory or virtual group. Would be cool if we could automatically
-- map vpaths like "**.h" to an <Extensions>h</Extensions> element.
--
function vc2010.filters_uniqueidentifiers(prj)
local opened = false
function m.uniqueIdentifiers(prj)
local tr = project.getsourcetree(prj)
tree.traverse(tr, {
onbranch = function(node, depth)
if not opened then
_p(1,'<ItemGroup>')
opened = true
local contents = p.capture(function()
p.push()
tree.traverse(tr, {
onbranch = function(node, depth)
p.push('<Filter Include="%s">', path.translate(node.path))
p.w('<UniqueIdentifier>{%s}</UniqueIdentifier>', os.uuid(node.path))
p.pop('</Filter>')
end
}, false)
p.pop()
end)
_x(2, '<Filter Include="%s">', path.translate(node.path))
_p(3, '<UniqueIdentifier>{%s}</UniqueIdentifier>', os.uuid(node.path))
_p(2, '</Filter>')
end
}, false)
if opened then
_p(1,'</ItemGroup>')
if #contents > 0 then
p.push('<ItemGroup>')
p.outln(contents)
p.pop('</ItemGroup>')
end
end
@ -64,20 +85,48 @@
-- "ResourceCompile", or "None".
--
function vc2010.filters_filegroup(prj, group)
local files = vc2010.getfilegroup(prj, group)
if #files > 0 then
_p(1,'<ItemGroup>')
for _, file in ipairs(files) do
if file.parent.path then
_p(2,'<%s Include=\"%s\">', group, path.translate(file.relpath))
_p(3,'<Filter>%s</Filter>', path.translate(file.parent.path))
_p(2,'</%s>', group)
else
_p(2,'<%s Include=\"%s\" />', group, path.translate(file.relpath))
end
function m.ClCompileFilters(prj, groups)
m.filterGroup(prj, groups, "ClCompile")
end
function m.ClIncludeFilters(prj, groups)
m.filterGroup(prj, groups, "ClInclude")
end
function m.CustomBuildFilters(prj, groups)
m.filterGroup(prj, groups, "CustomBuild")
end
function m.CustomRuleFilters(prj, groups)
for group, files in pairs(groups) do
if not table.contains(m.elements.filterGroups, group) then
m.filterGroup(prj, groups, group)
end
_p(1,'</ItemGroup>')
end
end
function m.NoneFilters(prj, groups)
m.filterGroup(prj, groups, "None")
end
function m.ResourceCompileFilters(prj, groups)
m.filterGroup(prj, groups, "ResourceCompile")
end
function m.filterGroup(prj, groups, group)
local files = groups[group] or {}
if #files > 0 then
p.push('<ItemGroup>')
for _, file in ipairs(files) do
if file.parent.path then
p.push('<%s Include=\"%s\">', group, path.translate(file.relpath))
p.w('<Filter>%s</Filter>', path.translate(file.parent.path))
p.pop('</%s>', group)
else
p.w('<%s Include=\"%s\" />', group, path.translate(file.relpath))
end
end
p.pop('</ItemGroup>')
end
end

View File

@ -125,6 +125,8 @@
return api.remove(field, value)
end
end
return field
end
@ -426,6 +428,26 @@
---
-- Reset the API system, clearing out any temporary or cached values.
-- Used by the automated testing framework to clear state between
-- individual test runs.
---
function api.reset()
-- Remove all custom variables
local vars = api.getCustomVars()
for i, var in ipairs(vars) do
local f = premake.field.get(var)
api.unregister(f)
end
-- Remove all custom list variable formats
api._customVarFormats = {}
end
--
-- Arrays are integer indexed tables; unlike lists, a new array value
-- will replace the old one, rather than merging both.
@ -925,3 +947,81 @@
function newoption(opt)
premake.option.add(opt)
end
-----------------------------------------------------------------------------
--
-- The custom*() functions act as wrappers that define new ad-hoc fields
-- on the fly, to support arbitrary custom rule variables. These should be
-- considered experimental and temporary for now as a more complete rule-
-- generating solution will certainly be needed, but I will do my best to
-- deprecate them cleanly when that time comes.
--
-----------------------------------------------------------------------------
api._customVarFormats = {}
function api.getCustomVars()
local vars = {}
for f in premake.field.each() do
if f.name:startswith("_custom_") then
table.insert(vars, f.name)
end
end
return vars
end
function api.getCustomVarKey(var)
return var:sub(9)
end
function api.getCustomListFormat(var)
local key = api.getCustomVarKey(var)
return api._customVarFormats[key] or { " " }
end
function api.setCustomVar(name, kind, value)
local fieldName = "_custom_" .. name
local field = premake.field.get(fieldName)
if not field then
api.register {
name = fieldName,
scope = "config",
kind = kind
}
end
_G[fieldName](value)
end
function customVar(value)
if type(value) ~= "table" or #value ~= 2 then
error { msg="invalid value for customVar()" }
end
api.setCustomVar(value[1], "string", value[2])
end
function customList(value)
if type(value) ~= "table" or #value < 2 then
error { msg="invalid value for customList()" }
end
local name = value[1]
table.remove(value, 1)
api.setCustomVar(name, "list:string", value)
end
function customListFormat(value)
if type(value) ~= "table" or #value < 2 then
error { msg="invalid value for customListFormat()" }
end
local name = value[1]
table.remove(value, 1)
api._customVarFormats[name] = value
end

View File

@ -102,6 +102,20 @@
---
-- Returns an iterator for the list of register fields.
---
function field.each()
local index
return function ()
index = next(field._list, index)
return field._list[index]
end
end
---
-- Register a new kind of data for field storage.
--

View File

@ -1,7 +1,7 @@
--
-- path.lua
-- Path manipulation functions.
-- Copyright (c) 2002-2013 Jason Perkins and the Premake project
-- Copyright (c) 2002-2014 Jason Perkins and the Premake project
--
@ -10,7 +10,7 @@
-- isn't already present, and adjusts quotes as necessary.
--
function path.appendextension(p, ext)
function path.appendExtension(p, ext)
-- if the extension is nil or empty, do nothing
if not ext or ext == "" then
return p
@ -36,6 +36,9 @@
return p
end
path.appendextension = path.appendExtension
--
-- Retrieve the filename portion of a path, without any extension.

View File

@ -29,6 +29,6 @@
vectorextensions "avx"
vc2010.enableEnhancedInstructionSet(test.getconfig(prj, "Debug"))
test.capture [[
<EnableEnhancedInstructionSet>AdvancedVectorExtensions</EnableEnhancedInstructionSet>
<EnableEnhancedInstructionSet>AdvancedVectorExtensions</EnableEnhancedInstructionSet>
]]
end

View File

@ -32,11 +32,11 @@
function suite.defaultSettings()
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
</ClCompile>
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
</ClCompile>
]]
end
@ -53,9 +53,9 @@
pchheader "include/afxwin.h"
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>include/afxwin.h</PrecompiledHeaderFile>
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>include/afxwin.h</PrecompiledHeaderFile>
]]
end
@ -69,8 +69,8 @@
flags "NoPCH"
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
]]
end
@ -83,9 +83,9 @@
warnings "Extra"
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level4</WarningLevel>
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level4</WarningLevel>
]]
end
@ -97,9 +97,9 @@
warnings "Off"
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>TurnOffAllWarnings</WarningLevel>
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>TurnOffAllWarnings</WarningLevel>
]]
end
@ -113,9 +113,9 @@
warnings "Off"
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>TurnOffAllWarnings</WarningLevel>
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>TurnOffAllWarnings</WarningLevel>
]]
end
@ -127,14 +127,14 @@
optimize "On"
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Full</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<MinimalRebuild>false</MinimalRebuild>
<StringPooling>true</StringPooling>
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Full</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<MinimalRebuild>false</MinimalRebuild>
<StringPooling>true</StringPooling>
]]
end
@ -142,14 +142,14 @@
optimize "Size"
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>MinSpace</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<MinimalRebuild>false</MinimalRebuild>
<StringPooling>true</StringPooling>
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>MinSpace</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<MinimalRebuild>false</MinimalRebuild>
<StringPooling>true</StringPooling>
]]
end
@ -157,14 +157,14 @@
optimize "Speed"
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<MinimalRebuild>false</MinimalRebuild>
<StringPooling>true</StringPooling>
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<MinimalRebuild>false</MinimalRebuild>
<StringPooling>true</StringPooling>
]]
end
@ -172,14 +172,14 @@
optimize "Full"
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Full</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<MinimalRebuild>false</MinimalRebuild>
<StringPooling>true</StringPooling>
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Full</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<MinimalRebuild>false</MinimalRebuild>
<StringPooling>true</StringPooling>
]]
end
@ -187,11 +187,11 @@
optimize "Off"
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
</ClCompile>
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
</ClCompile>
]]
end
@ -199,11 +199,11 @@
optimize "Debug"
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
</ClCompile>
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
</ClCompile>
]]
end
@ -211,11 +211,11 @@
flags "NoFramePointer"
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<OmitFramePointers>true</OmitFramePointers>
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<OmitFramePointers>true</OmitFramePointers>
]]
end
@ -228,10 +228,10 @@
defines { "DEBUG", "_DEBUG" }
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<PreprocessorDefinitions>DEBUG;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<PreprocessorDefinitions>DEBUG;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
]]
end
@ -244,11 +244,11 @@
buildoptions { "/xyz", "/abc" }
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<AdditionalOptions>/xyz /abc %(AdditionalOptions)</AdditionalOptions>
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<AdditionalOptions>/xyz /abc %(AdditionalOptions)</AdditionalOptions>
]]
end
@ -261,10 +261,10 @@
includedirs { "include/lua", "include/zlib" }
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<AdditionalIncludeDirectories>include\lua;include\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<AdditionalIncludeDirectories>include\lua;include\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
]]
end
@ -277,10 +277,10 @@
usingdirs { "include/lua", "include/zlib" }
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<AdditionalUsingDirectories>include\lua;include\zlib;%(AdditionalUsingDirectories)</AdditionalUsingDirectories>
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<AdditionalUsingDirectories>include\lua;include\zlib;%(AdditionalUsingDirectories)</AdditionalUsingDirectories>
]]
end
@ -292,11 +292,11 @@
flags "NoMinimalRebuild"
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<MinimalRebuild>false</MinimalRebuild>
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<MinimalRebuild>false</MinimalRebuild>
]]
end
@ -308,11 +308,11 @@
debugformat "C7"
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<MinimalRebuild>false</MinimalRebuild>
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<MinimalRebuild>false</MinimalRebuild>
]]
end
@ -325,11 +325,11 @@
flags { "StaticRuntime" }
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
]]
end
@ -337,13 +337,13 @@
flags { "StaticRuntime", "Symbols" }
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<ProgramDataBaseFileName>$(OutDir)MyProject.pdb</ProgramDataBaseFileName>
<Optimization>Disabled</Optimization>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<ProgramDataBaseFileName>$(OutDir)MyProject.pdb</ProgramDataBaseFileName>
<Optimization>Disabled</Optimization>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
]]
end
@ -356,10 +356,10 @@
flags { "FatalWarnings" }
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<TreatWarningAsError>true</TreatWarningAsError>
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<TreatWarningAsError>true</TreatWarningAsError>
]]
end
@ -372,13 +372,13 @@
flags "Symbols"
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<ProgramDataBaseFileName>$(OutDir)MyProject.pdb</ProgramDataBaseFileName>
<Optimization>Disabled</Optimization>
</ClCompile>
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<ProgramDataBaseFileName>$(OutDir)MyProject.pdb</ProgramDataBaseFileName>
<Optimization>Disabled</Optimization>
</ClCompile>
]]
end
@ -392,11 +392,11 @@
debugformat "c7"
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>OldStyle</DebugInformationFormat>
<Optimization>Disabled</Optimization>
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>OldStyle</DebugInformationFormat>
<Optimization>Disabled</Optimization>
]]
end
@ -409,11 +409,11 @@
vectorextensions "SSE"
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
]]
end
@ -421,11 +421,11 @@
vectorextensions "SSE2"
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
]]
end
@ -433,11 +433,11 @@
flags "FloatFast"
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<FloatingPointModel>Fast</FloatingPointModel>
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<FloatingPointModel>Fast</FloatingPointModel>
]]
end
@ -445,11 +445,11 @@
flags "FloatStrict"
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<FloatingPointModel>Strict</FloatingPointModel>
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<FloatingPointModel>Strict</FloatingPointModel>
]]
end
@ -462,11 +462,11 @@
flags "NativeWChar"
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
]]
end
@ -474,11 +474,11 @@
flags "NoNativeWChar"
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<TreatWChar_tAsBuiltInType>false</TreatWChar_tAsBuiltInType>
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<TreatWChar_tAsBuiltInType>false</TreatWChar_tAsBuiltInType>
]]
end
@ -491,11 +491,11 @@
flags "NoExceptions"
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<ExceptionHandling>false</ExceptionHandling>
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<ExceptionHandling>false</ExceptionHandling>
]]
end
@ -503,11 +503,11 @@
flags "SEH"
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<ExceptionHandling>Async</ExceptionHandling>
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<ExceptionHandling>Async</ExceptionHandling>
]]
end
@ -515,11 +515,11 @@
flags "NoRTTI"
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<RuntimeTypeInfo>false</RuntimeTypeInfo>
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<RuntimeTypeInfo>false</RuntimeTypeInfo>
]]
end
@ -527,11 +527,11 @@
flags "NoBufferSecurityCheck"
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<BufferSecurityCheck>false</BufferSecurityCheck>
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<BufferSecurityCheck>false</BufferSecurityCheck>
]]
end
@ -545,10 +545,10 @@
architecture "x32"
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
]]
end
@ -562,10 +562,10 @@
architecture "x64"
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
]]
end
@ -578,10 +578,10 @@
flags { "Symbols", "NoEditAndContinue" }
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
]]
end
@ -595,10 +595,10 @@
optimize "On"
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
]]
end
@ -611,10 +611,10 @@
flags { "Symbols", "Managed" }
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
]]
end
@ -627,10 +627,10 @@
forceincludes { "stdafx.h", "include/sys.h" }
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<ForcedIncludeFiles>stdafx.h;include\sys.h</ForcedIncludeFiles>
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<ForcedIncludeFiles>stdafx.h;include\sys.h</ForcedIncludeFiles>
]]
end
@ -638,10 +638,10 @@
forceusings { "stdafx.h", "include/sys.h" }
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<ForcedUsingFiles>stdafx.h;include\sys.h</ForcedUsingFiles>
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<ForcedUsingFiles>stdafx.h;include\sys.h</ForcedUsingFiles>
]]
end
@ -654,10 +654,10 @@
flags { "NoRuntimeChecks" }
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
]]
end
@ -670,12 +670,12 @@
flags { "MultiProcessorCompile" }
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<MinimalRebuild>false</MinimalRebuild>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<MinimalRebuild>false</MinimalRebuild>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
]]
end
@ -690,13 +690,13 @@
flags { "Symbols", "ReleaseRuntime", "StaticRuntime" }
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<ProgramDataBaseFileName>$(OutDir)MyProject.pdb</ProgramDataBaseFileName>
<Optimization>Disabled</Optimization>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<ProgramDataBaseFileName>$(OutDir)MyProject.pdb</ProgramDataBaseFileName>
<Optimization>Disabled</Optimization>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
]]
end
@ -709,10 +709,10 @@
flags { "OmitDefaultLibrary" }
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<OmitDefaultLibName>true</OmitDefaultLibName>
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<OmitDefaultLibName>true</OmitDefaultLibName>
]]
end

View File

@ -0,0 +1,75 @@
--
-- tests/actions/vstudio/vc2010/test_extension_settings.lua
-- Check the import extension settings block of a VS 2010 project.
-- Copyright (c) 2014 Jason Perkins and the Premake project
--
local suite = test.declare("vs2010_import_settings")
local vc2010 = premake.vstudio.vc2010
local project = premake.project
--
-- Setup
--
local sln
function suite.setup()
sln = test.createsolution()
end
local function prepare()
local prj = test.getproject(sln)
vc2010.importExtensionSettings(prj)
end
--
-- Writes an empty element when no custom rules are specified.
--
function suite.structureIsCorrect_onDefaultValues()
prepare()
test.capture [[
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
]]
end
--
-- Writes entries for each project scoped custom rules path.
--
function suite.addsImport_onEachRulesFile()
customRules "MyRules"
customRules "MyOtherRules"
prepare()
test.capture [[
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
<Import Project="MyRules.props" />
<Import Project="MyOtherRules.props" />
</ImportGroup>
]]
end
--
-- Rule files use a project relative path.
--
function suite.usesProjectRelativePaths()
customRules "path/to/MyRules"
location "build"
prepare()
test.capture [[
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
<Import Project="..\path\to\MyRules.props" />
</ImportGroup>
]]
end

View File

@ -0,0 +1,75 @@
--
-- tests/actions/vstudio/vc2010/test_extension_targets.lua
-- Check the import extension targets block of a VS 2010 project.
-- Copyright (c) 2014 Jason Perkins and the Premake project
--
local suite = test.declare("vs2010_import_targets")
local vc2010 = premake.vstudio.vc2010
local project = premake.project
--
-- Setup
--
local sln
function suite.setup()
sln = test.createsolution()
end
local function prepare()
local prj = test.getproject(sln)
vc2010.importExtensionTargets(prj)
end
--
-- Writes an empty element when no custom rules are specified.
--
function suite.structureIsCorrect_onDefaultValues()
prepare()
test.capture [[
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
]]
end
--
-- Writes entries for each project scoped custom rules path.
--
function suite.addsImport_onEachRulesFile()
customRules "MyRules"
customRules "MyOtherRules"
prepare()
test.capture [[
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="MyRules.targets" />
<Import Project="MyOtherRules.targets" />
</ImportGroup>
]]
end
--
-- Rule files use a project relative path.
--
function suite.usesProjectRelativePaths()
customRules "path/to/MyRules"
location "build"
prepare()
test.capture [[
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\path\to\MyRules.targets" />
</ImportGroup>
]]
end

View File

@ -33,9 +33,9 @@
files { "include/hello.h" }
prepare()
test.capture [[
<ItemGroup>
<ClInclude Include="include\hello.h" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="include\hello.h" />
</ItemGroup>
]]
end
@ -43,9 +43,9 @@
files { "hello.c" }
prepare()
test.capture [[
<ItemGroup>
<ClCompile Include="hello.c" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="hello.c" />
</ItemGroup>
]]
end
@ -53,9 +53,9 @@
files { "resources/hello.rc" }
prepare()
test.capture [[
<ItemGroup>
<ResourceCompile Include="resources\hello.rc" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="resources\hello.rc" />
</ItemGroup>
]]
end
@ -63,12 +63,17 @@
files { "docs/hello.txt" }
prepare()
test.capture [[
<ItemGroup>
<None Include="docs\hello.txt" />
</ItemGroup>
<ItemGroup>
<None Include="docs\hello.txt" />
</ItemGroup>
]]
end
--
-- Check handling of files with custom build rules.
--
function suite.customBuild_onBuildRule()
files { "hello.cg" }
filter "files:**.cg"
@ -76,19 +81,18 @@
buildoutputs { "$(InputName).obj" }
prepare()
test.capture [[
<ItemGroup>
<CustomBuild Include="hello.cg">
<FileType>Document</FileType>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">cgc $(InputFile)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(InputName).obj</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">cgc $(InputFile)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(InputName).obj</Outputs>
</CustomBuild>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="hello.cg">
<FileType>Document</FileType>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">cgc $(InputFile)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(InputName).obj</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">cgc $(InputFile)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(InputName).obj</Outputs>
</CustomBuild>
</ItemGroup>
]]
end
function suite.customBuild_onBuildRuleWithMessage()
files { "hello.cg" }
filter "files:**.cg"
@ -97,17 +101,17 @@
buildoutputs { "$(InputName).obj" }
prepare()
test.capture [[
<ItemGroup>
<CustomBuild Include="hello.cg">
<FileType>Document</FileType>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">cgc $(InputFile)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(InputName).obj</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Compiling shader $(InputFile)</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">cgc $(InputFile)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(InputName).obj</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Compiling shader $(InputFile)</Message>
</CustomBuild>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="hello.cg">
<FileType>Document</FileType>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">cgc $(InputFile)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(InputName).obj</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Compiling shader $(InputFile)</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">cgc $(InputFile)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(InputName).obj</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Compiling shader $(InputFile)</Message>
</CustomBuild>
</ItemGroup>
]]
end
@ -122,12 +126,12 @@
pchsource "afxwin.cpp"
prepare()
test.capture [[
<ItemGroup>
<ClCompile Include="afxwin.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClCompile Include="afxwin.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
</ClCompile>
</ItemGroup>
]]
end
@ -142,11 +146,11 @@
removefiles { "hello.cpp" }
prepare()
test.capture [[
<ItemGroup>
<ClCompile Include="hello.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClCompile Include="hello.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
</ClCompile>
</ItemGroup>
]]
end
@ -156,12 +160,12 @@
flags { "ExcludeFromBuild" }
prepare()
test.capture [[
<ItemGroup>
<ClCompile Include="hello.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClCompile Include="hello.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</ClCompile>
</ItemGroup>
]]
end
@ -171,11 +175,11 @@
removefiles { "hello.rc" }
prepare()
test.capture [[
<ItemGroup>
<ResourceCompile Include="hello.rc">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="hello.rc">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
</ResourceCompile>
</ItemGroup>
]]
end
@ -185,12 +189,12 @@
flags { "ExcludeFromBuild" }
prepare()
test.capture [[
<ItemGroup>
<ResourceCompile Include="hello.rc">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="hello.rc">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</ResourceCompile>
</ItemGroup>
]]
end
@ -201,9 +205,9 @@
flags { "ExcludeFromBuild" }
prepare()
test.capture [[
<ItemGroup>
<ResourceCompile Include="hello.rc" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="hello.rc" />
</ItemGroup>
]]
end
@ -216,13 +220,13 @@
removefiles { "hello.cg" }
prepare()
test.capture [[
<ItemGroup>
<CustomBuild Include="hello.cg">
<FileType>Document</FileType>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">cgc $(InputFile)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(InputName).obj</Outputs>
</CustomBuild>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="hello.cg">
<FileType>Document</FileType>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">cgc $(InputFile)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(InputName).obj</Outputs>
</CustomBuild>
</ItemGroup>
]]
end
@ -234,17 +238,17 @@
flags { "ExcludeFromBuild" }
prepare()
test.capture [[
<ItemGroup>
<CustomBuild Include="hello.cg">
<FileType>Document</FileType>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">cgc $(InputFile)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(InputName).obj</Outputs>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">cgc $(InputFile)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(InputName).obj</Outputs>
</CustomBuild>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="hello.cg">
<FileType>Document</FileType>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">cgc $(InputFile)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(InputName).obj</Outputs>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">cgc $(InputFile)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(InputName).obj</Outputs>
</CustomBuild>
</ItemGroup>
]]
end
@ -257,14 +261,14 @@
flags { "ExcludeFromBuild" }
prepare()
test.capture [[
<ItemGroup>
<CustomBuild Include="hello.cg">
<FileType>Document</FileType>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">cgc $(InputFile)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(InputName).obj</Outputs>
</CustomBuild>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="hello.cg">
<FileType>Document</FileType>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">cgc $(InputFile)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(InputName).obj</Outputs>
</CustomBuild>
</ItemGroup>
]]
end
@ -278,13 +282,13 @@
files { "hello.cpp", "greetings/hello.cpp" }
prepare()
test.capture [[
<ItemGroup>
<ClCompile Include="greetings\hello.cpp" />
<ClCompile Include="hello.cpp">
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)\hello1.obj</ObjectFileName>
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)\hello1.obj</ObjectFileName>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClCompile Include="greetings\hello.cpp" />
<ClCompile Include="hello.cpp">
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)\hello1.obj</ObjectFileName>
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)\hello1.obj</ObjectFileName>
</ClCompile>
</ItemGroup>
]]
end
@ -300,12 +304,12 @@
prepare()
test.capture [[
<ItemGroup>
<ClCompile Include="hello.cpp">
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\include\force1.h;..\include\force2.h</ForcedIncludeFiles>
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\include\force1.h;..\include\force2.h</ForcedIncludeFiles>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClCompile Include="hello.cpp">
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\include\force1.h;..\include\force2.h</ForcedIncludeFiles>
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\include\force1.h;..\include\force2.h</ForcedIncludeFiles>
</ClCompile>
</ItemGroup>
]]
end
@ -321,12 +325,12 @@
prepare()
test.capture [[
<ItemGroup>
<ClCompile Include="hello.cpp">
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">/Xc %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">/Xc %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClCompile Include="hello.cpp">
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">/Xc %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">/Xc %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
</ItemGroup>
]]
end
@ -341,9 +345,9 @@
optimize "On"
prepare()
test.capture [[
<ItemGroup>
<ClCompile Include="hello.cpp">
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Full</Optimization>
<ItemGroup>
<ClCompile Include="hello.cpp">
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Full</Optimization>
]]
end
@ -354,9 +358,9 @@
optimize "Size"
prepare()
test.capture [[
<ItemGroup>
<ClCompile Include="hello.cpp">
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">MinSpace</Optimization>
<ItemGroup>
<ClCompile Include="hello.cpp">
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">MinSpace</Optimization>
]]
end
@ -366,9 +370,9 @@
optimize "Speed"
prepare()
test.capture [[
<ItemGroup>
<ClCompile Include="hello.cpp">
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">MaxSpeed</Optimization>
<ItemGroup>
<ClCompile Include="hello.cpp">
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">MaxSpeed</Optimization>
]]
end
@ -378,9 +382,9 @@
optimize "Full"
prepare()
test.capture [[
<ItemGroup>
<ClCompile Include="hello.cpp">
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Full</Optimization>
<ItemGroup>
<ClCompile Include="hello.cpp">
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Full</Optimization>
]]
end
@ -390,9 +394,9 @@
optimize "Off"
prepare()
test.capture [[
<ItemGroup>
<ClCompile Include="hello.cpp">
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
<ItemGroup>
<ClCompile Include="hello.cpp">
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
]]
end
@ -402,9 +406,9 @@
optimize "Debug"
prepare()
test.capture [[
<ItemGroup>
<ClCompile Include="hello.cpp">
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
<ItemGroup>
<ClCompile Include="hello.cpp">
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
]]
end
@ -419,12 +423,12 @@
flags { "NoPCH" }
prepare()
test.capture [[
<ItemGroup>
<ClCompile Include="hello.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClCompile Include="hello.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
</ClCompile>
</ItemGroup>
]]
end
@ -440,12 +444,12 @@
defines { "IS_CPP" }
prepare()
test.capture [[
<ItemGroup>
<ClCompile Include="hello.cpp">
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">IS_CPP;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">IS_CPP;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClCompile Include="hello.cpp">
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">IS_CPP;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">IS_CPP;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemGroup>
]]
end
@ -463,10 +467,10 @@
}
prepare()
test.capture [[
<ItemGroup>
<ClInclude Include="PrefsWriter.h" />
<ClInclude Include="SystemTray.h" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="PrefsWriter.h" />
<ClInclude Include="SystemTray.h" />
</ItemGroup>
]]
end
@ -482,11 +486,116 @@
vectorextensions "sse2"
prepare()
test.capture [[
<ItemGroup>
<ClCompile Include="hello.cpp">
<EnableEnhancedInstructionSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
<EnableEnhancedInstructionSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClCompile Include="hello.cpp">
<EnableEnhancedInstructionSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
<EnableEnhancedInstructionSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
</ClCompile>
</ItemGroup>
]]
end
--
-- Check handling of files using custom rule definitions.
--
function suite.correctlyCategorized_onCustomRule()
files { "hello.dae" }
filter "files:**.dae"
customRule "Animation"
prepare()
test.capture [[
<ItemGroup>
<Animation Include="hello.dae" />
</ItemGroup>
]]
end
function suite.customRule_onLiteralVars()
files { "hello.dae" }
filter "files:**.dae"
customRule "Animation"
customVar { "GenerateDebugInfo", "True" }
prepare()
test.capture [[
<ItemGroup>
<Animation Include="hello.dae">
<GenerateDebugInfo Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">True</GenerateDebugInfo>
<GenerateDebugInfo Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">True</GenerateDebugInfo>
</Animation>
</ItemGroup>
]]
end
function suite.customRule_onPerConfigLiteralVars()
files { "hello.dae" }
filter { "files:**.dae" }
customRule "Animation"
filter { "files:**.dae", "configurations:Debug" }
customVar { "GenerateDebugInfo", "True" }
prepare()
test.capture [[
<ItemGroup>
<Animation Include="hello.dae">
<GenerateDebugInfo Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">True</GenerateDebugInfo>
</Animation>
</ItemGroup>
]]
end
function suite.customRule_onListVars()
files { "hello.dae" }
filter "files:**.dae"
customRule "Animation"
customList { "ExtraDependencies", "File1", "File2" }
prepare()
test.capture [[
<ItemGroup>
<Animation Include="hello.dae">
<ExtraDependencies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">File1 File2</ExtraDependencies>
<ExtraDependencies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">File1 File2</ExtraDependencies>
</Animation>
</ItemGroup>
]]
end
function suite.customRule_onPerConfigListVars()
files { "hello.dae" }
filter { "files:**.dae" }
customRule "Animation"
customList { "ExtraDependencies", "File1", "File2" }
filter { "files:**.dae", "configurations:Release" }
customList { "ExtraDependencies", "File3" }
prepare()
test.capture [[
<ItemGroup>
<Animation Include="hello.dae">
<ExtraDependencies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">File1 File2</ExtraDependencies>
<ExtraDependencies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">File1 File2 File3</ExtraDependencies>
</Animation>
</ItemGroup>
]]
end
function suite.customRule_onListVarsWithCustomFormat()
files { "hello.dae" }
filter "files:**.dae"
customRule "Animation"
customListFormat { "ExtraDependencies", ";" }
customList { "ExtraDependencies", "File1", "File2" }
prepare()
test.capture [[
<ItemGroup>
<Animation Include="hello.dae">
<ExtraDependencies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">File1;File2</ExtraDependencies>
<ExtraDependencies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">File1;File2</ExtraDependencies>
</Animation>
</ItemGroup>
]]
end

View File

@ -20,8 +20,8 @@
end
local function prepare()
prj = premake.solution.getproject(sln, 1)
vc2010.filters_uniqueidentifiers(prj)
prj = test.getproject(sln)
vc2010.uniqueIdentifiers(prj)
end
@ -44,11 +44,11 @@
files { "src/hello.c", "src/goodbye.c", "so_long.h" }
prepare()
test.capture [[
<ItemGroup>
<Filter Include="src">
<UniqueIdentifier>{2DAB880B-99B4-887C-2230-9F7C8E38947C}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<Filter Include="src">
<UniqueIdentifier>{2DAB880B-99B4-887C-2230-9F7C8E38947C}</UniqueIdentifier>
</Filter>
</ItemGroup>
]]
end
@ -61,14 +61,14 @@
files { "src/hello.c", "src/departures/goodbye.c", "so_long.h" }
prepare()
test.capture [[
<ItemGroup>
<Filter Include="src">
<UniqueIdentifier>{2DAB880B-99B4-887C-2230-9F7C8E38947C}</UniqueIdentifier>
</Filter>
<Filter Include="src\departures">
<UniqueIdentifier>{BB36ED8F-A704-E195-9098-51BC7C05BDFA}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<Filter Include="src">
<UniqueIdentifier>{2DAB880B-99B4-887C-2230-9F7C8E38947C}</UniqueIdentifier>
</Filter>
<Filter Include="src\departures">
<UniqueIdentifier>{BB36ED8F-A704-E195-9098-51BC7C05BDFA}</UniqueIdentifier>
</Filter>
</ItemGroup>
]]
end
@ -82,11 +82,11 @@
vpaths { ["Source Files"] = "**.c" }
prepare()
test.capture [[
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{E9C7FDCE-D52A-8D73-7EB0-C5296AF258F6}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{E9C7FDCE-D52A-8D73-7EB0-C5296AF258F6}</UniqueIdentifier>
</Filter>
</ItemGroup>
]]
end
@ -95,13 +95,13 @@
vpaths { ["Source Files"] = "*.c", ["Header Files"] = "*.h" }
prepare()
test.capture [[
<ItemGroup>
<Filter Include="Header Files">
<UniqueIdentifier>{21EB8090-0D4E-1035-B6D3-48EBA215DCB7}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files">
<UniqueIdentifier>{E9C7FDCE-D52A-8D73-7EB0-C5296AF258F6}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<Filter Include="Header Files">
<UniqueIdentifier>{21EB8090-0D4E-1035-B6D3-48EBA215DCB7}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files">
<UniqueIdentifier>{E9C7FDCE-D52A-8D73-7EB0-C5296AF258F6}</UniqueIdentifier>
</Filter>
</ItemGroup>
]]
end

View File

@ -20,8 +20,8 @@
end
local function prepare(group)
prj = premake.solution.getproject(sln, 1)
vc2010.filters_filegroup(prj, group)
prj = test.getproject(sln)
vc2010.filterGroups(prj)
end
@ -30,32 +30,51 @@
--
function suite.itemGroup_onClInclude()
files { "hello.c", "hello.h", "hello.rc", "hello.txt" }
prepare("ClInclude")
files { "hello.h" }
prepare()
test.capture [[
<ItemGroup>
<ClInclude Include="hello.h" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="hello.h" />
</ItemGroup>
]]
end
function suite.itemGroup_onResourceSection()
files { "hello.c", "hello.h", "hello.rc", "hello.txt" }
prepare("ResourceCompile")
files { "hello.rc" }
prepare()
test.capture [[
<ItemGroup>
<ResourceCompile Include="hello.rc" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="hello.rc" />
</ItemGroup>
]]
end
function suite.itemGroup_onNoneSection()
files { "hello.c", "hello.h", "hello.rc", "hello.txt" }
prepare("None")
files { "hello.txt" }
prepare()
test.capture [[
<ItemGroup>
<None Include="hello.txt" />
</ItemGroup>
<ItemGroup>
<None Include="hello.txt" />
</ItemGroup>
]]
end
function suite.itemGroup_onMixed()
files { "hello.c", "hello.h", "hello.rc", "hello.txt" }
prepare()
test.capture [[
<ItemGroup>
<None Include="hello.txt" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="hello.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="hello.c" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="hello.rc" />
</ItemGroup>
]]
end
@ -65,28 +84,28 @@
--
function suite.itemGroup_onBuildRule()
files { "hello.c", "hello.h", "hello.rc", "hello.cg" }
files { "hello.cg" }
filter "files:**.cg"
buildcommands { "cgc $(InputFile)" }
buildoutputs { "$(InputName).obj" }
prepare("CustomBuild")
test.capture [[
<ItemGroup>
<CustomBuild Include="hello.cg" />
</ItemGroup>
<ItemGroup>
<CustomBuild Include="hello.cg" />
</ItemGroup>
]]
end
function suite.itemGroup_onSingleConfigBuildRule()
files { "hello.c", "hello.h", "hello.rc", "hello.cg" }
files { "hello.cg" }
filter { "Release", "files:**.cg" }
buildcommands { "cgc $(InputFile)" }
buildoutputs { "$(InputName).obj" }
prepare("CustomBuild")
test.capture [[
<ItemGroup>
<CustomBuild Include="hello.cg" />
</ItemGroup>
<ItemGroup>
<CustomBuild Include="hello.cg" />
</ItemGroup>
]]
end
@ -98,12 +117,12 @@
function suite.noFilter_onRootFiles()
files { "hello.c", "goodbye.c" }
prepare("ClCompile")
prepare()
test.capture [[
<ItemGroup>
<ClCompile Include="goodbye.c" />
<ClCompile Include="hello.c" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="goodbye.c" />
<ClCompile Include="hello.c" />
</ItemGroup>
]]
end
@ -113,13 +132,16 @@
function suite.filter_onRealPath()
files { "src/hello.c", "hello.h" }
prepare("ClCompile")
prepare()
test.capture [[
<ItemGroup>
<ClCompile Include="src\hello.c">
<Filter>src</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="hello.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\hello.c">
<Filter>src</Filter>
</ClCompile>
</ItemGroup>
]]
end
@ -130,12 +152,32 @@
function suite.filter_onVpath()
files { "src/hello.c", "hello.h" }
vpaths { ["Source Files"] = "**.c" }
prepare("ClCompile")
prepare()
test.capture [[
<ItemGroup>
<ClCompile Include="src\hello.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="hello.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\hello.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
]]
end
--
-- Check handling of files using custom rules.
--
function suite.filter_onCustomRule()
files { "hello.dae" }
filter "files:**.dae"
customRule "Animation"
prepare()
test.capture [[
<ItemGroup>
<Animation Include="hello.dae" />
</ItemGroup>
]]
end

View File

@ -32,7 +32,7 @@
function suite.structureIsCorrect_onDefaultValues()
prepare()
test.capture [[
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
]]
end
@ -45,8 +45,8 @@
kind "Makefile"
prepare()
test.capture [[
<ItemDefinitionGroup>
</ItemDefinitionGroup>
<ItemDefinitionGroup>
</ItemDefinitionGroup>
]]
end
@ -54,8 +54,8 @@
kind "Makefile"
prepare()
test.capture [[
<ItemDefinitionGroup>
</ItemDefinitionGroup>
<ItemDefinitionGroup>
</ItemDefinitionGroup>
]]
end

View File

@ -35,9 +35,9 @@
files { "source/test.manifest" }
prepare()
test.capture [[
<Manifest>
<AdditionalManifestFiles>source/test.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>
</Manifest>
<Manifest>
<AdditionalManifestFiles>source/test.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>
</Manifest>
]]
end

View File

@ -33,8 +33,8 @@
function suite.defaultSettings()
prepare()
test.capture [[
<ResourceCompile>
</ResourceCompile>
<ResourceCompile>
</ResourceCompile>
]]
end
@ -48,8 +48,8 @@
resdefines { "RESOURCES" }
prepare()
test.capture [[
<ResourceCompile>
<PreprocessorDefinitions>DEBUG;RESOURCES;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ResourceCompile>
<PreprocessorDefinitions>DEBUG;RESOURCES;%(PreprocessorDefinitions)</PreprocessorDefinitions>
]]
end
@ -63,8 +63,8 @@
resincludedirs { "include/zlib" }
prepare()
test.capture [[
<ResourceCompile>
<AdditionalIncludeDirectories>include\lua;include\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<ResourceCompile>
<AdditionalIncludeDirectories>include\lua;include\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
]]
end
@ -88,8 +88,8 @@
defines { 'VERSION_STRING="1.0.0 (testing)"' }
prepare()
test.capture [[
<ResourceCompile>
<PreprocessorDefinitions>VERSION_STRING=\"1.0.0 (testing)\";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ResourceCompile>
<PreprocessorDefinitions>VERSION_STRING=\"1.0.0 (testing)\";%(PreprocessorDefinitions)</PreprocessorDefinitions>
]]
end
@ -102,7 +102,7 @@
locale "en-US"
prepare()
test.capture [[
<ResourceCompile>
<Culture>0x0409</Culture>
<ResourceCompile>
<Culture>0x0409</Culture>
]]
end

View File

@ -48,6 +48,12 @@
end
test.getproject = function(sln, i)
local sln = premake.oven.bakeSolution(sln)
return premake.solution.getproject(sln, i or 1)
end
test.getconfig = function(prj, buildcfg, platform)
local sln = premake.oven.bakeSolution(prj.solution)
prj = premake.solution.getproject(sln, prj.name)
@ -162,6 +168,8 @@
dofile("actions/vstudio/vc2010/test_config_props.lua")
dofile("actions/vstudio/vc2010/test_debug_settings.lua")
dofile("actions/vstudio/vc2010/test_excluded_configs.lua")
dofile("actions/vstudio/vc2010/test_extension_settings.lua")
dofile("actions/vstudio/vc2010/test_extension_targets.lua")
dofile("actions/vstudio/vc2010/test_globals.lua")
dofile("actions/vstudio/vc2010/test_header.lua")
dofile("actions/vstudio/vc2010/test_files.lua")

View File

@ -288,6 +288,7 @@
premake.eol("\n")
premake.escaper(nil)
premake.indent("\t")
premake.api.reset()
-- reset captured I/O values
test.value_openedfilename = nil