vcxproj support getting there
This commit is contained in:
parent
7b61224398
commit
3f67eb5d7f
@ -51,17 +51,253 @@ premake.vstudio.vcxproj = { }
|
||||
end
|
||||
end
|
||||
|
||||
--[[
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\bin\Debug\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\obj\Debug\string_is_integral\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\bin\Release\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\obj\Release\string_is_integral\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
--]]
|
||||
--needs revisiting for when there are dependency projects
|
||||
function intermediate_and_out_dirs(prj)
|
||||
_p(1,'<PropertyGroup>')
|
||||
_p(2,'<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>')
|
||||
|
||||
for _, cfginfo in ipairs(prj.solution.vstudio_configs) do
|
||||
local cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform)
|
||||
_p(2,'<OutDir Condition="\'$(Configuration)|$(Platform)\'==\'%s\'">%s</OutDir>', premake.esc(cfginfo.name),premake.esc(cfg.buildtarget.directory) )
|
||||
_p(2,'<IntDir Condition="\'$(Configuration)|$(Platform)\'==\'%s\'">%s</IntDir>', premake.esc(cfginfo.name), premake.esc(cfg.objectsdir))
|
||||
if cfg.flags.NoManifest then
|
||||
_p(2,'<GenerateManifest Condition="\'$(Configuration)|$(Platform)\'==\'%s\'">false</GenerateManifest>',premake.esc(cfginfo.name))
|
||||
end
|
||||
end
|
||||
|
||||
_p(1,'</PropertyGroup>')
|
||||
end
|
||||
|
||||
function optimisation(cfg)
|
||||
local result = "Disabled"
|
||||
for _, value in ipairs(cfg.flags) do
|
||||
if (value == "Optimize") then
|
||||
result = "Full"
|
||||
elseif (value == "OptimizeSize") then
|
||||
result = "MinSpace"
|
||||
elseif (value == "OptimizeSpeed") then
|
||||
result = "MaxSpeed"
|
||||
end
|
||||
end
|
||||
return result
|
||||
end
|
||||
|
||||
function runtime(cfg)
|
||||
local runtime
|
||||
if cfg.flags.StaticRuntime then
|
||||
runtime = iif(cfg.flags.Symbols,"MultiThreadedDebug","MultiThreaded")
|
||||
else
|
||||
runtime = iif(cfg.flags.Symbols, "MultiThreadedDebugDLL", "MultiThreadedDLL")
|
||||
end
|
||||
return runtime
|
||||
end
|
||||
|
||||
function precompiled_header(cfg)
|
||||
if not cfg.flags.NoPCH and cfg.pchheader then
|
||||
_p(3,'<PrecompiledHeader>Use</PrecompiledHeader>')
|
||||
_p(3,'<PrecompiledHeaderFile>%s</PrecompiledHeaderFile>', path.getname(cfg.pchheader))
|
||||
else
|
||||
_p(3,'<PrecompiledHeader></PrecompiledHeader>')
|
||||
end
|
||||
end
|
||||
|
||||
--have a look at this and translate
|
||||
function vs10_vcxproj_symbols(cfg)
|
||||
if (not cfg.flags.Symbols) then
|
||||
return 0
|
||||
else
|
||||
-- Edit-and-continue does't work for some configurations
|
||||
if cfg.flags.NoEditAndContinue or
|
||||
_VS.optimization(cfg) ~= 0 or
|
||||
cfg.flags.Managed or
|
||||
cfg.platform == "x64" then
|
||||
return 3
|
||||
else
|
||||
return 4
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function preprocessor(indent,cfg)
|
||||
if #cfg.defines > 0 then
|
||||
_p(indent,'<PreprocessorDefinitions>%s;%%(PreprocessorDefinitions)</PreprocessorDefinitions>',premake.esc(table.concat(cfg.defines, ";")))
|
||||
else
|
||||
_p(indent,'<PreprocessorDefinitions></PreprocessorDefinitions>')
|
||||
end
|
||||
end
|
||||
|
||||
function include_dirs(indent,cfg)
|
||||
if #cfg.includedirs > 0 then
|
||||
_p(indent,'<AdditionalIncludeDirectories>%s;%%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>',premake.esc(path.translate(table.concat(cfg.includedirs, ";"), '\\')))
|
||||
else
|
||||
_p(indent,'<AdditionalIncludeDirectories></AdditionalIncludeDirectories>')
|
||||
end
|
||||
end
|
||||
|
||||
function resource_compile(cfg)
|
||||
_p(1,'<ResourceCompile>')
|
||||
preprocessor(2,cfg)
|
||||
include_dirs(2,cfg)
|
||||
_p(1,'</ResourceCompile>')
|
||||
|
||||
end
|
||||
|
||||
function exceptions(cfg)
|
||||
if cfg.flags.NoExceptions then
|
||||
_p(2,'<ExceptionHandling>false</ExceptionHandling>')
|
||||
elseif cfg.flags.SEH then
|
||||
_p(2,'<ExceptionHandling>Async</ExceptionHandling>')
|
||||
end
|
||||
end
|
||||
|
||||
function rtti(cfg)
|
||||
if cfg.flags.NoRTTI then
|
||||
_p(3,'<RuntimeTypeInfo>false</RuntimeTypeInfo>')
|
||||
--elseif _ACTION > "vs2003" and cfg.flags.NoRTTI then
|
||||
-- _p(3,'<RuntimeTypeInfo>true</RuntimeTypeInfo>')
|
||||
end
|
||||
end
|
||||
|
||||
function wchar_t_buildin(cfg)
|
||||
if cfg.flags.NativeWChar then
|
||||
_p(3,'<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>')
|
||||
elseif cfg.flags.NoNativeWChar then
|
||||
_p(3,'<TreatWChar_tAsBuiltInType>false</TreatWChar_tAsBuiltInType>')
|
||||
end
|
||||
end
|
||||
|
||||
function sse(cfg)
|
||||
if cfg.flags.EnableSSE then
|
||||
_p(3,'<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>')
|
||||
elseif cfg.flags.EnableSSE2 then
|
||||
_p(3,'<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>')
|
||||
end
|
||||
end
|
||||
|
||||
function floating_point(cfg)
|
||||
if cfg.flags.FloatFast then
|
||||
_p(3,'<FloatingPointModel>Fast</FloatingPointModel>')
|
||||
elseif cfg.flags.FloatStrict then
|
||||
_p(3,'<FloatingPointModel>Strict</FloatingPointModel>')
|
||||
end
|
||||
end
|
||||
|
||||
function debug_info(cfg)
|
||||
--[[
|
||||
EditAndContinue /ZI
|
||||
ProgramDatabase /Zi
|
||||
OldStyle C7 Compatable /Z7
|
||||
--]]
|
||||
if cfg.flags.Symbols and not cfg.flags.NoEditAndContinue then
|
||||
_p(3,'<DebugInformationFormat>EditAndContinue</DebugInformationFormat>')
|
||||
else
|
||||
_p(3,'<DebugInformationFormat></DebugInformationFormat>')
|
||||
end
|
||||
end
|
||||
|
||||
function vs10_clcompile(cfg)
|
||||
_p(2,'<ClCompile>')
|
||||
|
||||
if #cfg.buildoptions > 0 then
|
||||
_p(3,'<AdditionalOptions>%s %%(AdditionalOptions)</AdditionalOptions>',endtable.concat(premake.esc(cfg.buildoptions), " "))
|
||||
end
|
||||
|
||||
_p(3,'<Optimization>%s</Optimization>',optimisation(cfg))
|
||||
|
||||
include_dirs(3,cfg)
|
||||
|
||||
preprocessor(3,cfg)
|
||||
|
||||
if cfg.flags.Symbols and not cfg.flags.NoMinimalRebuild then
|
||||
_p(3,'<MinimalRebuild>true</MinimalRebuild>')
|
||||
elseif cfg.flags.Symbols then
|
||||
_p(3,'<MinimalRebuild>false</MinimalRebuild>')
|
||||
end
|
||||
|
||||
if optimisation(cfg) == "Disabled" and not cfg.flags.Managed then
|
||||
_p(3,'<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>')
|
||||
end
|
||||
|
||||
if optimisation(cfg) ~= "Disabled" then
|
||||
_p(3,'<StringPooling>true</StringPooling>')
|
||||
end
|
||||
|
||||
_p(3,'<RuntimeLibrary>%s</RuntimeLibrary>', runtime(cfg))
|
||||
|
||||
_p(3,'<FunctionLevelLinking>true</FunctionLevelLinking>')
|
||||
|
||||
precompiled_header(cfg)
|
||||
|
||||
_p(3,'<WarningLevel>Level%s</WarningLevel>', iif(cfg.flags.ExtraWarnings, 4, 3))
|
||||
|
||||
|
||||
|
||||
if cfg.flags.FatalWarnings then
|
||||
_p(3,'<TreatWarningAsError>true</TreatWarningAsError>')
|
||||
end
|
||||
|
||||
|
||||
-- if (cfg.kind == "ConsoleApp" or cfg.kind == "WindowedApp") and not cfg.flags.WinMain then
|
||||
-- _p(4,'EntryPointSymbol="mainCRTStartup"')
|
||||
-- end
|
||||
|
||||
exceptions(cfg)
|
||||
rtti(cfg)
|
||||
wchar_t_buildin(cfg)
|
||||
sse(cfg)
|
||||
floating_point(cfg)
|
||||
debug_info(cfg)
|
||||
|
||||
--[[
|
||||
NOTE: TODO:
|
||||
this can not be converted when using the upgrade tool
|
||||
added for now but it will removed or altered when I find out
|
||||
what is the correct thing to do.
|
||||
--]]
|
||||
_p(3,'<ProgramDataBaseFileName>$(OutDir)%s.pdb</ProgramDataBaseFileName>', path.getbasename(cfg.buildtarget.name))
|
||||
|
||||
if cfg.flags.NoFramePointer then
|
||||
_p(3,'<OmitFramePointers>true</OmitFramePointers>')
|
||||
end
|
||||
|
||||
|
||||
|
||||
_p(2,'</ClCompile>')
|
||||
end
|
||||
|
||||
|
||||
function event_hooks(cfg)
|
||||
if #cfg.postbuildcommands> 0 then
|
||||
_p(1,'<PostBuildEvent>')
|
||||
_p(2,'<Command>"%s"</Command>',premake.esc(table.implode(cfg.postbuildcommands, "", "", "\r\n")))
|
||||
_p(1,'</PostBuildEvent>')
|
||||
end
|
||||
|
||||
if #cfg.prebuildcommands> 0 then
|
||||
_p(1,'<PreBuildEvent>')
|
||||
_p(2,'<Command>"%s"</Command>',premake.esc(table.implode(cfg.prebuildcommands, "", "", "\r\n")))
|
||||
_p(1,'</PreBuildEvent>')
|
||||
end
|
||||
|
||||
if #cfg.prelinkcommands> 0 then
|
||||
_p(1,'<PreLinkEvent>')
|
||||
_p(2,'<Command>"%s"</Command>',premake.esc(table.implode(cfg.prelinkcommands, "", "", "\r\n")))
|
||||
_p(1,'</PreLinkEvent>')
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function item_definitions(prj)
|
||||
for _, cfginfo in ipairs(prj.solution.vstudio_configs) do
|
||||
local cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform)
|
||||
_p(1,'<ItemDefinitionGroup Condition="\'$(Configuration)|$(Platform)\'==\'%s\'">',premake.esc(cfginfo.name))
|
||||
vs10_clcompile(cfg)
|
||||
_p(1,'</ItemDefinitionGroup>')
|
||||
resource_compile(cfg)
|
||||
--link
|
||||
event_hooks(cfg)
|
||||
end
|
||||
end
|
||||
|
||||
function premake.vs2010_vcxproj(prj)
|
||||
io.eol = "\r\n"
|
||||
@ -87,6 +323,10 @@ premake.vstudio.vcxproj = { }
|
||||
--what type of macros are these?
|
||||
_p(1,'<PropertyGroup Label="UserMacros" />')
|
||||
|
||||
intermediate_and_out_dirs(prj)
|
||||
|
||||
item_definitions(prj)
|
||||
|
||||
|
||||
_p('</Project>')
|
||||
end
|
256
tests/actions/vstudio/test_vs2010_flags.lua
Normal file
256
tests/actions/vstudio/test_vs2010_flags.lua
Normal file
@ -0,0 +1,256 @@
|
||||
|
||||
T.vs2010_flags = { }
|
||||
local vs10_flags = T.vs2010_flags
|
||||
local sln, prj
|
||||
|
||||
|
||||
--[[
|
||||
function vs10_flags.setup()end
|
||||
function vs10_flags.nothing() end
|
||||
--]]
|
||||
|
||||
function vs10_flags.setup()
|
||||
_ACTION = "vs2010"
|
||||
|
||||
sln = solution "MySolution"
|
||||
configurations { "Debug" }
|
||||
platforms {}
|
||||
|
||||
prj = project "MyProject"
|
||||
language "C++"
|
||||
kind "ConsoleApp"
|
||||
uuid "AE61726D-187C-E440-BD07-2556188A6565"
|
||||
includedirs{"foo/bar"}
|
||||
end
|
||||
|
||||
local function get_buffer()
|
||||
io.capture()
|
||||
premake.buildconfigs()
|
||||
sln.vstudio_configs = premake.vstudio_buildconfigs(sln)
|
||||
premake.vs2010_vcxproj(prj)
|
||||
buffer = io.endcapture()
|
||||
return buffer
|
||||
end
|
||||
|
||||
|
||||
function vs10_flags.sseSet()
|
||||
flags {"EnableSSE"}
|
||||
|
||||
buffer = get_buffer()
|
||||
test.string_contains(buffer,'<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>')
|
||||
end
|
||||
|
||||
function vs10_flags.sse2Set()
|
||||
flags {"EnableSSE2"}
|
||||
|
||||
buffer = get_buffer()
|
||||
test.string_contains(buffer,'<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>')
|
||||
end
|
||||
|
||||
function vs10_flags.extraWarningNotSet_warningLevelIsThree()
|
||||
buffer = get_buffer()
|
||||
test.string_contains(buffer,'<WarningLevel>Level3</WarningLevel>')
|
||||
end
|
||||
|
||||
function vs10_flags.extraWarning_warningLevelIsFour()
|
||||
flags {"ExtraWarnings"}
|
||||
|
||||
buffer = get_buffer()
|
||||
test.string_contains(buffer,'<WarningLevel>Level4</WarningLevel>')
|
||||
end
|
||||
|
||||
function vs10_flags.extraWarning_treatWarningsAsError_setToTrue()
|
||||
flags {"FatalWarnings"}
|
||||
|
||||
buffer = get_buffer()
|
||||
test.string_contains(buffer,'<TreatWarningAsError>true</TreatWarningAsError>')
|
||||
end
|
||||
|
||||
function vs10_flags.floatFast_floatingPointModel_setToFast()
|
||||
flags {"FloatFast"}
|
||||
|
||||
buffer = get_buffer()
|
||||
test.string_contains(buffer,'<FloatingPointModel>Fast</FloatingPointModel>')
|
||||
end
|
||||
|
||||
function vs10_flags.floatStrict_floatingPointModel_setToStrict()
|
||||
flags {"FloatStrict"}
|
||||
|
||||
buffer = get_buffer()
|
||||
test.string_contains(buffer,'<FloatingPointModel>Strict</FloatingPointModel>')
|
||||
end
|
||||
|
||||
function vs10_flags.nativeWideChar_TreatWChar_tAsBuiltInType_setToTrue()
|
||||
flags {"NativeWChar"}
|
||||
|
||||
buffer = get_buffer()
|
||||
test.string_contains(buffer,'<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>')
|
||||
end
|
||||
|
||||
function vs10_flags.nativeWideChar_TreatWChar_tAsBuiltInType_setToFalse()
|
||||
flags {"NoNativeWChar"}
|
||||
|
||||
buffer = get_buffer()
|
||||
test.string_contains(buffer,'<TreatWChar_tAsBuiltInType>false</TreatWChar_tAsBuiltInType>')
|
||||
end
|
||||
|
||||
function vs10_flags.noExceptions_exceptionHandling_setToFalse()
|
||||
flags {"NoExceptions"}
|
||||
|
||||
buffer = get_buffer()
|
||||
test.string_contains(buffer,'<ExceptionHandling>false</ExceptionHandling>')
|
||||
end
|
||||
|
||||
function vs10_flags.structuredExceptions_exceptionHandling_setToAsync()
|
||||
flags {"SEH"}
|
||||
|
||||
buffer = get_buffer()
|
||||
test.string_contains(buffer,'<ExceptionHandling>Async</ExceptionHandling>')
|
||||
end
|
||||
|
||||
function vs10_flags.noFramePointer_omitFramePointers_setToTrue()
|
||||
flags {"NoFramePointer"}
|
||||
|
||||
buffer = get_buffer()
|
||||
test.string_contains(buffer,'<OmitFramePointers>true</OmitFramePointers>')
|
||||
end
|
||||
|
||||
|
||||
function vs10_flags.noRTTI_runtimeTypeInfo_setToFalse()
|
||||
flags {"NoRTTI"}
|
||||
|
||||
buffer = get_buffer()
|
||||
test.string_contains(buffer,'<RuntimeTypeInfo>false</RuntimeTypeInfo>')
|
||||
end
|
||||
|
||||
function vs10_flags.optimizeSize_optimization_setToMinSpace()
|
||||
flags {"OptimizeSize"}
|
||||
|
||||
buffer = get_buffer()
|
||||
test.string_contains(buffer,'<Optimization>MinSpace</Optimization>')
|
||||
end
|
||||
|
||||
function vs10_flags.optimizeSpeed_optimization_setToMaxSpeed()
|
||||
flags {"OptimizeSpeed"}
|
||||
|
||||
buffer = get_buffer()
|
||||
test.string_contains(buffer,'<Optimization>MaxSpeed</Optimization>')
|
||||
end
|
||||
function vs10_flags.optimizeSpeed_optimization_setToMaxSpeed()
|
||||
flags {"Optimize"}
|
||||
|
||||
buffer = get_buffer()
|
||||
test.string_contains(buffer,'<Optimization>Full</Optimization>')
|
||||
end
|
||||
|
||||
function vs10_flags.noStaticRuntime_runtimeLibrary_setToMultiThreadedDLL()
|
||||
buffer = get_buffer()
|
||||
test.string_contains(buffer,'<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>')
|
||||
end
|
||||
|
||||
--[[
|
||||
function vs10_flags.symbols_runtimeLibrary_setToMultiThreadedDebugDLL()
|
||||
flags {"Symbols"}
|
||||
|
||||
buffer = get_buffer()
|
||||
test.string_contains(buffer,'<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>')
|
||||
end
|
||||
--]]
|
||||
|
||||
function vs10_flags.noStaticRuntimeYetSymbols_runtimeLibrary_setToMultiThreadedDebugDLL()
|
||||
flags {"Symbols"}
|
||||
|
||||
buffer = get_buffer()
|
||||
test.string_contains(buffer,'<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>')
|
||||
end
|
||||
|
||||
function vs10_flags.staticRuntime_runtimeLibrary_setToMultiThreaded()
|
||||
flags {"StaticRuntime"}
|
||||
|
||||
buffer = get_buffer()
|
||||
test.string_contains(buffer,'<RuntimeLibrary>MultiThreaded</RuntimeLibrary>')
|
||||
end
|
||||
|
||||
function vs10_flags.staticRuntimeAndSymbols_runtimeLibrary_setToMultiThreadedDebug()
|
||||
flags {"StaticRuntime","Symbols"}
|
||||
|
||||
buffer = get_buffer()
|
||||
test.string_contains(buffer,'<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>')
|
||||
end
|
||||
|
||||
function vs10_flags.noCharacterSetDefine_characterSet_setToMultiByte()
|
||||
buffer = get_buffer()
|
||||
test.string_contains(buffer,'<CharacterSet>MultiByte</CharacterSet>')
|
||||
end
|
||||
|
||||
function vs10_flags.unicode_characterSet_setToUnicode()
|
||||
flags {"Unicode"}
|
||||
|
||||
buffer = get_buffer()
|
||||
test.string_contains(buffer,'<CharacterSet>Unicode</CharacterSet>')
|
||||
end
|
||||
|
||||
|
||||
function vs10_flags.noMinimalRebuildYetNotSymbols_minimalRebuild_isNotFound()
|
||||
flags {"NoMinimalRebuild"}
|
||||
|
||||
buffer = get_buffer()
|
||||
test.string_does_not_contain(buffer,'MinimalRebuild')
|
||||
end
|
||||
|
||||
function vs10_flags.noMinimalRebuildAndSymbols_minimalRebuild_setToFalse()
|
||||
flags {"NoMinimalRebuild","Symbols"}
|
||||
|
||||
buffer = get_buffer()
|
||||
test.string_contains(buffer,'<MinimalRebuild>false</MinimalRebuild>')
|
||||
end
|
||||
|
||||
function vs10_flags.symbolsSetYetNotMinimalRebuild_minimalRebuild_setToTrue()
|
||||
flags {"Symbols"}
|
||||
|
||||
buffer = get_buffer()
|
||||
test.string_contains(buffer,'<MinimalRebuild>true</MinimalRebuild>')
|
||||
end
|
||||
|
||||
--this generates an error: invalid value 'MFC'
|
||||
--[[
|
||||
function vs10_flags.mfc_useOfMfc_setToStatic()
|
||||
flags{"MFC"}
|
||||
|
||||
buffer = get_buffer()
|
||||
--test.string_contains(buffer,'<UseOfMfc>Static</UseOfMfc>')
|
||||
end
|
||||
--]]
|
||||
|
||||
function vs10_flags.Symbols_DebugInformationFormat_setToEditAndContinue()
|
||||
flags{"Symbols"}
|
||||
|
||||
buffer = get_buffer()
|
||||
test.string_contains(buffer,'<DebugInformationFormat>EditAndContinue</DebugInformationFormat>')
|
||||
end
|
||||
|
||||
function vs10_flags.symbolsAndNoEditAndContinue_DebugInformationFormat_isAnEmptyBlock()
|
||||
flags{"Symbols","NoEditAndContinue"}
|
||||
|
||||
buffer = get_buffer()
|
||||
test.string_contains(buffer,'<DebugInformationFormat></DebugInformationFormat>')
|
||||
end
|
||||
|
||||
function vs10_flags.noManifest_GenerateManifest_setToFalse()
|
||||
flags{"NoManifest"}
|
||||
|
||||
buffer = get_buffer()
|
||||
test.string_contains(buffer,'<GenerateManifest Condition="\'%$%(Configuration%)|%$%(Platform%)\'==\'Debug|Win32\'">false</GenerateManifest>')
|
||||
end
|
||||
|
||||
--[[
|
||||
this causes a problem when a project is updated with the command line tool
|
||||
yet it is here until the correct course of action is found
|
||||
--]]
|
||||
function vs10_flags.programDataBaseFile()
|
||||
buffer = get_buffer()
|
||||
test.string_contains(buffer,'<ProgramDataBaseFileName>%$%(OutDir%)MyProject%.pdb</ProgramDataBaseFileName>')
|
||||
end
|
||||
|
||||
|
||||
|
@ -1,23 +1,9 @@
|
||||
T.vs2010_vcxproj = { }
|
||||
local vs10_vcxproj = T.vs2010_vcxproj
|
||||
|
||||
--[[
|
||||
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
--]]
|
||||
|
||||
local include_directory = "bar/foo"
|
||||
local include_directory2 = "baz/foo"
|
||||
local debug_define = "I_AM_ALIVE_NUMBER_FIVE"
|
||||
|
||||
local sln, prj
|
||||
function vs10_vcxproj.setup()
|
||||
_ACTION = "vs2010"
|
||||
@ -25,15 +11,25 @@
|
||||
sln = solution "MySolution"
|
||||
configurations { "Debug", "Release" }
|
||||
platforms {}
|
||||
|
||||
--project "DotNetProject" -- to test handling of .NET platform in solution
|
||||
--language "C#"
|
||||
--kind "ConsoleApp"
|
||||
|
||||
|
||||
prj = project "MyProject"
|
||||
language "C++"
|
||||
kind "ConsoleApp"
|
||||
uuid "AE61726D-187C-E440-BD07-2556188A6565"
|
||||
|
||||
includedirs
|
||||
{
|
||||
include_directory,
|
||||
include_directory2
|
||||
}
|
||||
|
||||
configuration("Release")
|
||||
flags {"Optimize"}
|
||||
|
||||
configuration("Debug")
|
||||
defines {debug_define}
|
||||
|
||||
|
||||
end
|
||||
|
||||
local function get_buffer()
|
||||
@ -99,4 +95,84 @@
|
||||
function vs10_vcxproj.userMacrosPresent()
|
||||
buffer = get_buffer()
|
||||
test.string_contains(buffer,'<PropertyGroup Label="UserMacros" />')
|
||||
end
|
||||
|
||||
function vs10_vcxproj.intermediateAndOutDirsPropertyGroupWithMagicNumber()
|
||||
buffer = get_buffer()
|
||||
test.string_contains(buffer,'<PropertyGroup>*.*<_ProjectFileVersion>10%.0%.30319%.1</_ProjectFileVersion>')
|
||||
end
|
||||
|
||||
function vs10_vcxproj.outDirPresent()
|
||||
buffer = get_buffer()
|
||||
test.string_contains(buffer,'<OutDir>*.*</OutDir>')
|
||||
end
|
||||
function vs10_vcxproj.initDirPresent()
|
||||
buffer = get_buffer()
|
||||
test.string_contains(buffer,'<IntDir>*.*</IntDir>')
|
||||
end
|
||||
|
||||
function vs10_vcxproj.projectWithDebugAndReleaseConfig_twoOutDirsAndTwoIntDirs()
|
||||
buffer = get_buffer()
|
||||
test.string_contains(buffer,'<OutDir>*.*</OutDir>*.*<IntDir>*.*</IntDir>*.*<OutDir>*.*</OutDir>*.*<IntDir>*.*</IntDir>')
|
||||
end
|
||||
|
||||
function vs10_vcxproj.containsItemDefinition()
|
||||
buffer = get_buffer()
|
||||
test.string_contains(buffer,'<ItemDefinitionGroup Condition="\'%$%(Configuration%)|%$%(Platform%)\'==\'*.*\'">*.*</ItemDefinitionGroup>')
|
||||
end
|
||||
|
||||
|
||||
function vs10_vcxproj.containsClCompileBlock()
|
||||
buffer = get_buffer()
|
||||
test.string_contains(buffer,'<ClCompile>*.*</ClCompile>')
|
||||
end
|
||||
--[[
|
||||
function vs10_vcxproj.containsAdditionalOptions()
|
||||
buffer = get_buffer()
|
||||
test.string_contains(buffer,'<AdditionalOptions>*.*<AdditionalOptions>')
|
||||
end
|
||||
--]]
|
||||
|
||||
local function cl_compile_string(version)
|
||||
return '<ItemDefinitionGroup Condition="\'%$%(Configuration%)|%$%(Platform%)\'==\''..version..'|Win32\'">*.*<ClCompile>'
|
||||
end
|
||||
|
||||
function vs10_vcxproj.debugHasNoOptimisation()
|
||||
buffer = get_buffer()
|
||||
test.string_contains(buffer, cl_compile_string('Debug').. '*.*<Optimization>Disabled</Optimization>*.*</ItemDefinitionGroup>')
|
||||
end
|
||||
|
||||
function vs10_vcxproj.releaseHasFullOptimisation()
|
||||
buffer = get_buffer()
|
||||
test.string_contains(buffer, cl_compile_string('Release').. '*.*<Optimization>Full</Optimization>*.*</ItemDefinitionGroup>')
|
||||
end
|
||||
|
||||
function vs10_vcxproj.includeDirectories_debugEntryContains_include_directory()
|
||||
buffer = get_buffer()
|
||||
test.string_contains(buffer,cl_compile_string('Debug').. '*.*<AdditionalIncludeDirectories>'.. path.translate(include_directory, '\\') ..'*.*</AdditionalIncludeDirectories>')
|
||||
end
|
||||
|
||||
function vs10_vcxproj.includeDirectories_debugEntryContains_include_directory2PrefixWithSemiColon()
|
||||
buffer = get_buffer()
|
||||
test.string_contains(buffer,cl_compile_string('Debug').. '*.*<AdditionalIncludeDirectories>*.*;'.. path.translate(include_directory2, '\\') ..'*.*</AdditionalIncludeDirectories>')
|
||||
end
|
||||
|
||||
function vs10_vcxproj.includeDirectories_debugEntryContains_include_directory2PostfixWithSemiColon()
|
||||
buffer = get_buffer()
|
||||
test.string_contains(buffer,cl_compile_string('Debug').. '*.*<AdditionalIncludeDirectories>*.*'.. path.translate(include_directory2, '\\') ..';*.*</AdditionalIncludeDirectories>')
|
||||
end
|
||||
|
||||
function vs10_vcxproj.debugContainsPreprossorBlock()
|
||||
buffer = get_buffer()
|
||||
test.string_contains(buffer,cl_compile_string('Debug').. '*.*<PreprocessorDefinitions>*.*</PreprocessorDefinitions>')
|
||||
end
|
||||
|
||||
function vs10_vcxproj.debugHasDebugDefine()
|
||||
buffer = get_buffer()
|
||||
test.string_contains(buffer,cl_compile_string('Debug')..'*.*<PreprocessorDefinitions>*.*'..debug_define..'*.*</PreprocessorDefinitions>')
|
||||
end
|
||||
|
||||
function vs10_vcxproj.releaseHasStringPoolingOn()
|
||||
buffer = get_buffer()
|
||||
test.string_contains(buffer,cl_compile_string('Release')..'*.*<StringPooling>true</StringPooling>')
|
||||
end
|
@ -67,6 +67,8 @@
|
||||
dofile("actions/vstudio/test_vs2005_csproj.lua")
|
||||
dofile("actions/vstudio/test_vs200x_vcproj.lua")
|
||||
dofile("actions/vstudio/test_vs2010_vcxproj.lua")
|
||||
dofile("actions/vstudio/test_vs2010_flags.lua")
|
||||
|
||||
|
||||
-- Xcode tests
|
||||
dofile("actions/xcode/test_xcode_common.lua")
|
||||
|
@ -21,6 +21,12 @@
|
||||
end
|
||||
end
|
||||
|
||||
function test.string_does_not_contain(buffer, expected)
|
||||
if string.find(buffer,expected) then
|
||||
test.fail("\n==Fail==: Did not expected to find :\n%s\nyet it was found in buffer:\n%s\n", expected,buffer)
|
||||
end
|
||||
end
|
||||
|
||||
function test.capture(expected)
|
||||
local actual = io.endcapture()
|
||||
|
||||
|
15
todo.txt
Normal file
15
todo.txt
Normal file
@ -0,0 +1,15 @@
|
||||
find why MFC in flags causes an error
|
||||
|
||||
add support for flags: WinMain, Managed, MFC, NoImportLib, Unsafe
|
||||
add Link section to vcxproj
|
||||
add ClInclude section
|
||||
add LinkIncremental support
|
||||
add ImportGroup section
|
||||
support C
|
||||
support Managed C++
|
||||
support C#
|
||||
add X.vcxproj.filters
|
||||
add X.vcxproj.user
|
||||
find out why a unit test is failing
|
||||
|
||||
No64BitChecks is removed after being deprciated in previous releases
|
Loading…
Reference in New Issue
Block a user