Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/windirstat/premake-4.x-stable.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Perkins <starkos@industriousone.com>2010-07-13 17:05:13 +0400
committerJason Perkins <starkos@industriousone.com>2010-07-13 17:05:13 +0400
commit7ed58a9a9ede22e643cfe9ed77ea1b951713aa17 (patch)
tree21579cfa9c497a7b53070db7c5cacb125aff7ef5
parent851887e129de9bd16cedce4767ece41a3528ab8d (diff)
parent88a3d4e2ddd0289b37dfd3040af7b789483ecf10 (diff)
Merged VS 2010 C/C++ support (Liam Devine)
-rw-r--r--CHANGES.txt1
-rw-r--r--src/_manifest.lua2
-rw-r--r--src/actions/clean/_clean.lua20
-rw-r--r--src/actions/vstudio/_vstudio.lua37
-rw-r--r--src/actions/vstudio/vs2010_vcxproxj.lua717
-rw-r--r--src/actions/vstudio/vs_generic_solution.lua66
-rw-r--r--src/host/scripts.c40
-rw-r--r--tests/actions/vstudio/test_vs2010_filters.lua393
-rw-r--r--tests/actions/vstudio/test_vs2010_flags.lua253
-rw-r--r--tests/actions/vstudio/test_vs2010_links.lua143
-rw-r--r--tests/actions/vstudio/test_vs2010_project_kinds.lua154
-rw-r--r--tests/actions/vstudio/test_vs2010_vcxproj.lua355
-rw-r--r--tests/premake4.lua6
-rw-r--r--tests/test.bat2
-rw-r--r--tests/test_vs2010_sln.lua118
-rw-r--r--tests/testfx.lua11
-rw-r--r--todo.txt21
17 files changed, 2332 insertions, 7 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index 966a4fa..d219c4c 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -3,6 +3,7 @@
-------
* CHANGED LICENSE FROM GPLv2 TO BSD
+* Added Visual Studio 2010 C/C++ support (Liam Devine)
* Patch 2963313: Enable setting .NET framework version (Justen Hyde)
* Patch 2965229: Fix handling of '+' symbol in file patterns (Rachel Blum)
* Patch 2997449: Print configuration with target (ergosys)
diff --git a/src/_manifest.lua b/src/_manifest.lua
index f0007bf..4ae99f4 100644
--- a/src/_manifest.lua
+++ b/src/_manifest.lua
@@ -58,6 +58,8 @@
"actions/vstudio/vs2005_solution.lua",
"actions/vstudio/vs2005_csproj.lua",
"actions/vstudio/vs2005_csproj_user.lua",
+ "actions/vstudio/vs_generic_solution.lua",
+ "actions/vstudio/vs2010_vcxproxj.lua",
-- Xcode action
"actions/xcode/_xcode.lua",
diff --git a/src/actions/clean/_clean.lua b/src/actions/clean/_clean.lua
index 0e0ead0..fc53d09 100644
--- a/src/actions/clean/_clean.lua
+++ b/src/actions/clean/_clean.lua
@@ -59,6 +59,26 @@
onproject = function(prj)
for action in premake.action.each() do
+ -- io.write(action.trigger ..'\n')
+ if action.trigger =="vs2010" then
+ if action.oncleanproject then
+ io.write('vs2010 has an on clean and we are going to call it\n')
+ else
+ io.write('vs2010 does not have an on clean\n')
+ end
+ if action.oncleansolution then
+ io.write('vs2010 has an oncleansolution and we are going to call it\n')
+ else
+ io.write('vs2010 does not have an oncleansolution\n')
+ end
+ if action.oncleantarget then
+ io.write('vs2010 has an oncleantarget and we are going to call it\n')
+ else
+ io.write('vs2010 does not have an oncleantarget\n')
+ end
+
+
+ end
if action.oncleanproject then
action.oncleanproject(prj)
end
diff --git a/src/actions/vstudio/_vstudio.lua b/src/actions/vstudio/_vstudio.lua
index 863e8ca..47cf64c 100644
--- a/src/actions/vstudio/_vstudio.lua
+++ b/src/actions/vstudio/_vstudio.lua
@@ -259,6 +259,10 @@
local extension
if (prj.language == "C#") then
extension = ".csproj"
+ elseif (_ACTION == "vs2010" and prj.language == "C++" )then
+ extension = ".vcxproj"
+ elseif (_ACTION == "vs2010" and prj.language == "C" )then
+ extension = ".vcxproj"
else
extension = ".vcproj"
end
@@ -418,3 +422,36 @@
oncleanproject = premake.vstudio.cleanproject,
oncleantarget = premake.vstudio.cleantarget
}
+
+
+ newaction
+ {
+ trigger = "vs2010",
+ shortname = "Visual Studio 2010",
+ description = "Generate Visual Studio 2010 project files (experimental)",
+ os = "windows",
+
+ valid_kinds = { "ConsoleApp", "WindowedApp", "StaticLib", "SharedLib" },
+
+ valid_languages = { "C++","C"},
+
+ valid_tools = {
+ cc = { "msc" },
+ --dotnet = { "msnet" },
+ },
+
+ onsolution = function(sln)
+ premake.generate(sln, "%%.sln", premake.vs_generic_solution)
+ end,
+
+ onproject = function(prj)
+ premake.generate(prj, "%%.vcxproj", premake.vs2010_vcxproj)
+ premake.generate(prj, "%%.vcxproj.user", premake.vs2010_vcxproj_user)
+ premake.generate(prj, "%%.vcxproj.filters", premake.vs2010_vcxproj_filters)
+ end,
+
+
+ oncleansolution = premake.vs2010_cleansolution,
+ oncleanproject = premake.vs2010_cleanproject,
+ oncleantarget = premake.vs2010_cleantarget
+ } \ No newline at end of file
diff --git a/src/actions/vstudio/vs2010_vcxproxj.lua b/src/actions/vstudio/vs2010_vcxproxj.lua
new file mode 100644
index 0000000..67bbc47
--- /dev/null
+++ b/src/actions/vstudio/vs2010_vcxproxj.lua
@@ -0,0 +1,717 @@
+
+premake.vstudio.vcxproj = { }
+--local vcproj = premake.vstudio.vcxproj
+
+
+ function remove_relative_path(file)
+ file = file:gsub("%.%.\\",'')
+ file = file:gsub("%.\\",'')
+ return file
+ end
+
+ function file_path(file)
+ file = remove_relative_path(file)
+ local path = string.find(file,'\\[%w%.%_%-]+$')
+ if path then
+ return string.sub(file,1,path-1)
+ else
+ return nil
+ end
+ end
+
+ function list_of_directories_in_path(path)
+ local list={}
+ if path then
+ for dir in string.gmatch(path,"[%w%-%_%.]+\\")do
+ if #list == 0 then
+ list[1] = dir:sub(1,#dir-1)
+ else
+ list[#list +1] = list[#list] .."\\" ..dir:sub(1,#dir-1)
+ end
+ end
+ end
+ return list
+ end
+
+ function table_of_filters(t)
+ local filters ={}
+
+ for key, value in pairs(t) do
+ local result = list_of_directories_in_path(value)
+ for __,dir in ipairs(result) do
+ if table.contains(filters,dir) ~= true then
+ filters[#filters +1] = dir
+ end
+ end
+ end
+
+ return filters
+ end
+
+ function table_of_file_filters(files)
+ local filters ={}
+
+ for key, valueTable in pairs(files) do
+ for _, entry in ipairs(valueTable) do
+ local result = list_of_directories_in_path(entry)
+ for __,dir in ipairs(result) do
+ if table.contains(filters,dir) ~= true then
+ filters[#filters +1] = dir
+ end
+ end
+ end
+ end
+
+ return filters
+ end
+
+ local function vs2010_config(prj)
+ _p(1,'<ItemGroup Label="ProjectConfigurations">')
+ for _, cfginfo in ipairs(prj.solution.vstudio_configs) do
+ _p(2,'<ProjectConfiguration Include="%s">', premake.esc(cfginfo.name))
+ _p(3,'<Configuration>%s</Configuration>',cfginfo.buildcfg)
+ _p(3,'<Platform>%s</Platform>',cfginfo.platform)
+ _p(2,'</ProjectConfiguration>')
+ end
+ _p(1,'</ItemGroup>')
+ end
+
+ local function vs2010_globals(prj)
+ _p(1,'<PropertyGroup Label="Globals">')
+ _p(2,'<ProjectGuid>{%s}</ProjectGuid>',prj.uuid)
+ _p(2,'<RootNamespace>%s</RootNamespace>',prj.name)
+ _p(2,'<Keyword>Win32Proj</Keyword>')
+ _p(1,'</PropertyGroup>')
+ end
+
+ function config_type(config)
+ local t =
+ {
+ SharedLib = "DynamicLibrary",
+ StaticLib = "StaticLibrary",
+ ConsoleApp = "Application",
+ }
+ return t[config.kind]
+ end
+
+ function if_config_and_platform()
+ return 'Condition="\'$(Configuration)|$(Platform)'
+ end
+
+ function config_type_block(prj)
+ for _, cfginfo in ipairs(prj.solution.vstudio_configs) do
+ local cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform)
+ _p(1,'<PropertyGroup '..if_config_and_platform() ..'\'==\'%s\'" Label="Configuration">'
+ , premake.esc(cfginfo.name))
+ _p(2,'<ConfigurationType>%s</ConfigurationType>',config_type(cfg))
+ _p(2,'<CharacterSet>%s</CharacterSet>',iif(cfg.flags.Unicode,"Unicode","MultiByte"))
+
+ if cfg.flags.MFC then
+ _p(2,'<UseOfMfc>Dynamic</UseOfMfc>')
+ end
+
+ local use_debug = "false"
+ if optimisation(cfg) == "Disabled" then
+ use_debug = "true"
+ else
+ _p(2,'<WholeProgramOptimization>true</WholeProgramOptimization>')
+ end
+ _p(2,'<UseDebugLibraries>%s</UseDebugLibraries>',use_debug)
+
+ _p(1,'</PropertyGroup>')
+ end
+ end
+
+
+ function import_props(prj)
+ for _, cfginfo in ipairs(prj.solution.vstudio_configs) do
+ local cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform)
+ _p(1,'<ImportGroup '..if_config_and_platform() ..'\'==\'%s\'" Label="PropertySheets">'
+ ,premake.esc(cfginfo.name))
+ _p(2,'<Import Project="$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props" Condition="exists(\'$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\')" Label="LocalAppDataPlatform" />')
+ _p(1,'</ImportGroup>')
+ end
+ end
+
+ function incremental_link(cfg,cfginfo)
+ if cfg.kind ~= "StaticLib" then
+ ShoudLinkIncrementally = 'false'
+ if optimisation(cfg) == "Disabled" then
+ ShoudLinkIncrementally = 'true'
+ end
+
+ _p(2,'<LinkIncremental '..if_config_and_platform() ..'\'==\'%s\'">%s</LinkIncremental>'
+ ,premake.esc(cfginfo.name),ShoudLinkIncrementally)
+ end
+ end
+
+
+ function ignore_import_lib(cfg,cfginfo)
+ if cfg.kind == "SharedLib" then
+ local shouldIgnore = "false"
+ if cfg.flags.NoImportLib then shouldIgnore = "true" end
+ _p(2,'<IgnoreImportLibrary '..if_config_and_platform() ..'\'==\'%s\'">%s</IgnoreImportLibrary>'
+ ,premake.esc(cfginfo.name),shouldIgnore)
+ end
+ end
+
+
+ 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 '..if_config_and_platform() ..'\'==\'%s\'">%s\\</OutDir>'
+ , premake.esc(cfginfo.name),premake.esc(cfg.buildtarget.directory) )
+ _p(2,'<IntDir '..if_config_and_platform() ..'\'==\'%s\'">%s\\</IntDir>'
+ , premake.esc(cfginfo.name), premake.esc(cfg.objectsdir))
+ _p(2,'<TargetName '..if_config_and_platform() ..'\'==\'%s\'">%s</TargetName>'
+ ,premake.esc(cfginfo.name),path.getbasename(cfg.buildtarget.name))
+
+ ignore_import_lib(cfg,cfginfo)
+ incremental_link(cfg,cfginfo)
+ if cfg.flags.NoManifest then
+ _p(2,'<GenerateManifest '..if_config_and_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, ";"), '\\')))
+ end
+ end
+
+ function resource_compile(cfg)
+ _p(2,'<ResourceCompile>')
+ preprocessor(3,cfg)
+ include_dirs(3,cfg)
+ _p(2,'</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>')
+ 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 minimal_build(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
+ end
+
+ function compile_language(cfg)
+ if cfg.language == "C" then
+ _p(3,'<CompileAs>CompileAsC</CompileAs>')
+ end
+ end
+
+ function vs10_clcompile(cfg)
+ _p(2,'<ClCompile>')
+
+ if #cfg.buildoptions > 0 then
+ _p(3,'<AdditionalOptions>%s %%(AdditionalOptions)</AdditionalOptions>',
+ table.concat(premake.esc(cfg.buildoptions), " "))
+ end
+
+ _p(3,'<Optimization>%s</Optimization>',optimisation(cfg))
+
+ include_dirs(3,cfg)
+ preprocessor(3,cfg)
+ minimal_build(cfg)
+
+ if optimisation(cfg) == "Disabled" then
+ _p(3,'<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>')
+ if cfg.flags.ExtraWarnings then
+ _p(3,'<SmallerTypeCheck>true</SmallerTypeCheck>')
+ end
+ else
+ _p(3,'<StringPooling>true</StringPooling>')
+ end
+
+ _p(3,'<RuntimeLibrary>%s</RuntimeLibrary>', runtime(cfg))
+
+ _p(3,'<FunctionLevelLinking>true</FunctionLevelLinking>')
+
+ precompiled_header(cfg)
+
+ if cfg.flags.ExtraWarnings then
+ _p(3,'<WarningLevel>Level4</WarningLevel>')
+ else
+ _p(3,'<WarningLevel>Level3</WarningLevel>')
+ end
+
+ if cfg.flags.FatalWarnings then
+ _p(3,'<TreatWarningAsError>true</TreatWarningAsError>')
+ end
+
+ exceptions(cfg)
+ rtti(cfg)
+ wchar_t_buildin(cfg)
+ sse(cfg)
+ floating_point(cfg)
+ debug_info(cfg)
+
+
+ if cfg.flags.NoFramePointer then
+ _p(3,'<OmitFramePointers>true</OmitFramePointers>')
+ end
+
+ compile_language(cfg)
+
+ _p(2,'</ClCompile>')
+ end
+
+
+ function event_hooks(cfg)
+ if #cfg.postbuildcommands> 0 then
+ _p(2,'<PostBuildEvent>')
+ _p(3,'<Command>%s</Command>',premake.esc(table.implode(cfg.postbuildcommands, "", "", "\r\n")))
+ _p(2,'</PostBuildEvent>')
+ end
+
+ if #cfg.prebuildcommands> 0 then
+ _p(2,'<PreBuildEvent>')
+ _p(3,'<Command>%s</Command>',premake.esc(table.implode(cfg.prebuildcommands, "", "", "\r\n")))
+ _p(2,'</PreBuildEvent>')
+ end
+
+ if #cfg.prelinkcommands> 0 then
+ _p(2,'<PreLinkEvent>')
+ _p(3,'<Command>%s</Command>',premake.esc(table.implode(cfg.prelinkcommands, "", "", "\r\n")))
+ _p(2,'</PreLinkEvent>')
+ end
+ end
+
+ function item_def_lib(cfg)
+ if cfg.kind == 'StaticLib' then
+ _p(1,'<Lib>')
+ _p(2,'<OutputFile>$(OutDir)%s</OutputFile>',cfg.buildtarget.name)
+ _p(1,'</Lib>')
+ end
+ end
+
+ function link_target_machine(cfg)
+ local target
+ if cfg.platform == nil or cfg.platform == "x32" then target ="MachineX86"
+ elseif cfg.platform == "x64" then target ="MachineX64"
+ end
+
+ _p(3,'<TargetMachine>%s</TargetMachine>', target)
+ end
+
+ function import_lib(cfg)
+ --Prevent the generation of an import library for a Windows DLL.
+ if cfg.kind == "SharedLib" then
+ local implibname = cfg.linktarget.fullpath
+ _p(3,'<ImportLibrary>%s</ImportLibrary>',iif(cfg.flags.NoImportLib, cfg.objectsdir .. "\\" .. path.getname(implibname), implibname))
+ end
+ end
+
+
+ function common_link_section(cfg)
+ _p(3,'<SubSystem>%s</SubSystem>',iif(cfg.kind == "ConsoleApp","Console", "Windows"))
+
+ if cfg.flags.Symbols then
+ _p(3,'<GenerateDebugInformation>true</GenerateDebugInformation>')
+ else
+ _p(3,'<GenerateDebugInformation>false</GenerateDebugInformation>')
+ end
+
+ if optimisation(cfg) ~= "Disabled" then
+ _p(3,'<OptimizeReferences>true</OptimizeReferences>')
+ _p(3,'<EnableCOMDATFolding>true</EnableCOMDATFolding>')
+ end
+
+ _p(3,'<ProgramDataBaseFileName>$(OutDir)%s.pdb</ProgramDataBaseFileName>'
+ , path.getbasename(cfg.buildtarget.name))
+
+ end
+
+ function item_link(cfg)
+ _p(2,'<Link>')
+ if cfg.kind ~= 'StaticLib' then
+
+ if #cfg.links > 0 then
+ _p(3,'<AdditionalDependencies>%s;%%(AdditionalDependencies)</AdditionalDependencies>',
+ table.concat(premake.getlinks(cfg, "all", "fullpath"), ";"))
+ end
+ _p(3,'<OutputFile>$(OutDir)%s</OutputFile>', cfg.buildtarget.name)
+
+ _p(3,'<AdditionalLibraryDirectories>%s%s%%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>',
+ table.concat(premake.esc(path.translate(cfg.libdirs, '\\')) , ";"),
+ iif(cfg.libdirs and #cfg.libdirs >0,';',''))
+
+ common_link_section(cfg)
+
+ if (cfg.kind == "ConsoleApp" or cfg.kind == "WindowedApp") and not cfg.flags.WinMain then
+ _p(3,'<EntryPointSymbol>mainCRTStartup</EntryPointSymbol>')
+ end
+
+ import_lib(cfg)
+
+ _p(3,'<TargetMachine>%s</TargetMachine>', iif(cfg.platform == "x64", "MachineX64", "MachineX86"))
+
+ else
+ common_link_section(cfg)
+ end
+
+ _p(2,'</Link>')
+ 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)
+ resource_compile(cfg)
+ item_def_lib(cfg)
+ item_link(cfg)
+ event_hooks(cfg)
+ _p(1,'</ItemDefinitionGroup>')
+
+
+ end
+ end
+
+
+ function get_file_extension(file)
+ local ext_start,ext_end = string.find(file,"%.[%w_%-]+$")
+ if ext_start then
+ return string.sub(file,ext_start+1,ext_end)
+ end
+ end
+
+
+
+ --also translates file paths from '/' to '\\'
+ function sort_input_files(files,sorted_container)
+ local types =
+ {
+ h = "ClInclude",
+ hpp = "ClInclude",
+ hxx = "ClInclude",
+ c = "ClCompile",
+ cpp = "ClCompile",
+ cxx = "ClCompile",
+ cc = "ClCompile"
+ }
+
+ for _, current_file in ipairs(files) do
+ local translated_path = path.translate(current_file, '\\')
+ local ext = get_file_extension(translated_path)
+ if ext then
+ local type = types[ext]
+ if type then
+ table.insert(sorted_container[type],translated_path)
+ else
+ table.insert(sorted_container.None,translated_path)
+ end
+ end
+ end
+ end
+ --
+ -- <ItemGroup>
+ -- <ProjectReference Include="zlibvc.vcxproj">
+ -- <Project>{8fd826f8-3739-44e6-8cc8-997122e53b8d}</Project>
+ -- </ProjectReference>
+ -- </ItemGroup>
+ --
+
+ function write_file_type_block(files,group_type)
+ if #files > 0 then
+ _p(1,'<ItemGroup>')
+ for _, current_file in ipairs(files) do
+ _p(2,'<%s Include=\"%s\" />', group_type,current_file)
+ end
+ _p(1,'</ItemGroup>')
+ end
+ end
+
+ function vcxproj_files(prj)
+ local sorted =
+ {
+ ClCompile ={},
+ ClInclude ={},
+ None ={}
+ }
+
+ cfg = premake.getconfig(prj)
+ sort_input_files(cfg.files,sorted)
+ write_file_type_block(sorted.ClInclude,"ClInclude")
+ write_file_type_block(sorted.ClCompile,'ClCompile')
+ write_file_type_block(sorted.None,'None')
+
+ end
+
+ function write_filter_includes(sorted_table)
+ local directories = table_of_file_filters(sorted_table)
+ --I am going to take a punt here that the ItemGroup is missing if no files!!!!
+ --there is a test for this see
+ --vs10_filters.noInputFiles_bufferDoesNotContainTagItemGroup
+ if #directories >0 then
+ _p(1,'<ItemGroup>')
+ for _, dir in pairs(directories) do
+ _p(2,'<Filter Include="%s">',dir)
+ _p(3,'<UniqueIdentifier>{%s}</UniqueIdentifier>',os.uuid())
+ _p(2,'</Filter>')
+ end
+ _p(1,'</ItemGroup>')
+ end
+ end
+
+ function write_file_filter_block(files,group_type)
+ if #files > 0 then
+ _p(1,'<ItemGroup>')
+ for _, current_file in ipairs(files) do
+ local path_to_file = file_path(current_file)
+ if path_to_file then
+ _p(2,'<%s Include=\"%s\">', group_type,path.translate(current_file, "\\"))
+ _p(3,'<Filter>%s</Filter>',path_to_file)
+ _p(2,'</%s>',group_type)
+ else
+ _p(2,'<%s Include=\"%s\" />', group_type,path.translate(current_file, "\\"))
+ end
+ end
+ _p(1,'</ItemGroup>')
+ end
+ end
+
+ function vcxproj_filter_files(prj)
+ local sorted =
+ {
+ ClCompile ={},
+ ClInclude ={},
+ None ={}
+ }
+
+ cfg = premake.getconfig(prj)
+ sort_input_files(cfg.files,sorted)
+
+ io.eol = "\r\n"
+ _p('<?xml version="1.0" encoding="utf-8"?>')
+ _p('<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">')
+ write_filter_includes(sorted)
+ write_file_filter_block(sorted.ClInclude,"ClInclude")
+ write_file_filter_block(sorted.ClCompile,"ClCompile")
+ write_file_filter_block(sorted.None,"None")
+ _p('</Project>')
+ end
+
+--
+ -- <ItemGroup>
+ -- <ClCompile Include="SomeProjName.cpp" />
+ -- <ClCompile Include="stdafx.cpp">
+ -- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
+ -- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
+ --</ClCompile>
+ --</ItemGroup>
+--
+ function premake.vs2010_vcxproj(prj)
+ io.eol = "\r\n"
+ _p('<?xml version="1.0" encoding="utf-8"?>')
+ _p('<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">')
+
+ vs2010_config(prj)
+ vs2010_globals(prj)
+
+ _p(1,'<Import Project="$(VCTargetsPath)\\Microsoft.Cpp.Default.props" />')
+
+ config_type_block(prj)
+
+ _p(1,'<Import Project="$(VCTargetsPath)\\Microsoft.Cpp.props" />')
+
+ --check what this section is doing
+ _p(1,'<ImportGroup Label="ExtensionSettings">')
+ _p(1,'</ImportGroup>')
+
+
+ import_props(prj)
+
+ --what type of macros are these?
+ _p(1,'<PropertyGroup Label="UserMacros" />')
+
+ intermediate_and_out_dirs(prj)
+
+ item_definitions(prj)
+
+ vcxproj_files(prj)
+
+ _p(1,'<Import Project="$(VCTargetsPath)\\Microsoft.Cpp.targets" />')
+ _p(1,'<ImportGroup Label="ExtensionTargets">')
+ _p(1,'</ImportGroup>')
+
+ _p('</Project>')
+ end
+
+ function premake.vs2010_vcxproj_user(prj)
+ _p('<?xml version="1.0" encoding="utf-8"?>')
+ _p('<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">')
+ _p('</Project>')
+ end
+
+ function premake.vs2010_vcxproj_filters(prj)
+ vcxproj_filter_files(prj)
+ end
+
+ function premake.vs2010_cleansolution(sln)
+ premake.clean.file(sln, "%%.sln")
+ premake.clean.file(sln, "%%.suo")
+ --premake.clean.file(sln, "%%.sdf")
+ end
+
+ function premake.vs2010_cleanproject(prj)
+ io.write('vs2010 clean action')
+ local fname = premake.project.getfilename(prj, "%%")
+ local vcxname = fname .. ".vcxproj"
+ io.write(vcxname)
+ os.remove(fname .. '.vcxproj')
+ os.remove(fname .. '.vcxproj.user')
+ os.remove(fname .. '.vcxproj.filters')
+ os.remove(fname .. '.sdf')
+ --
+ local userfiles = os.matchfiles(fname .. ".vcxproj.user")
+ for _, fname in ipairs(userfiles) do
+ os.remove(fname)
+ end
+
+ local filter_files = os.matchfiles(fname .. ".vcxproj.filter")
+ for _, fname in ipairs(filter_files) do
+ os.remove(fname)
+ end
+
+ local proj_files = os.matchfiles(fname .. ".vcxproj")
+ for _, fname in ipairs(proj_files) do
+ os.remove(fname)
+ end
+
+ local sdf_files = os.matchfiles(fname .. ".sdf")
+ for _, fname in ipairs(sdf_files) do
+ os.remove(fname)
+ end
+ --
+ end
+
+ function premake.vs2010_cleantarget(name)
+ os.remove(name .. ".pdb")
+ os.remove(name .. ".idb")
+ os.remove(name .. ".ilk")
+ --os.remove(name .. ".vshost.exe")
+ --os.remove(name .. ".exe.manifest")
+ end
+ \ No newline at end of file
diff --git a/src/actions/vstudio/vs_generic_solution.lua b/src/actions/vstudio/vs_generic_solution.lua
new file mode 100644
index 0000000..370d6e9
--- /dev/null
+++ b/src/actions/vstudio/vs_generic_solution.lua
@@ -0,0 +1,66 @@
+
+local vs_format_version = function()
+ local t =
+ {
+ vs2005 = '9.00',
+ vs2008 = '10.00',
+ vs2010 = '11.00'
+ }
+ return t[_ACTION]
+end
+
+local vs_version = function()
+ local t =
+ {
+ vs2005 = '2005',
+ vs2008 = '2008',
+ vs2010 = '2010'
+ }
+ return t[_ACTION]
+end
+
+local vs_write_version_info = function()
+ _p('Microsoft Visual Studio Solution File, Format Version %s', vs_format_version())
+ _p('# Visual Studio %s', vs_version() )
+end
+
+
+local vs_write_projects = function(sln)
+ -- Write out the list of project entries
+ for prj in premake.solution.eachproject(sln) do
+ -- Build a relative path from the solution file to the project file
+ local projpath = path.translate(path.getrelative(sln.location, _VS.projectfile(prj)), "\\")
+ _p('Project("{%s}") = "%s", "%s", "{%s}"', _VS.tool(prj), prj.name, projpath, prj.uuid)
+
+ local deps = premake.getdependencies(prj)
+ if #deps > 0 then
+ _p('\tProjectSection(ProjectDependencies) = postProject')
+ for _, dep in ipairs(deps) do
+ _p('\t\t{%s} = {%s}', dep.uuid, dep.uuid)
+ end
+ _p('\tEndProjectSection')
+ end
+ _p('EndProject')
+ end
+end
+
+
+local vs_write_pre_version = function(sln)
+ io.eol = '\r\n'
+ sln.vstudio_configs = premake.vstudio_buildconfigs(sln)
+ -- Mark the file as Unicode
+ _p('\239\187\191')
+end
+
+function premake.vs_generic_solution(sln)
+ vs_write_pre_version(sln)
+ vs_write_version_info()
+ vs_write_projects(sln)
+
+ _p('Global')
+ premake.vs2005_solution_platforms(sln)
+ premake.vs2005_solution_project_platforms(sln)
+ premake.vs2005_solution_properties(sln)
+ _p('EndGlobal')
+
+end \ No newline at end of file
diff --git a/src/host/scripts.c b/src/host/scripts.c
index e260185..9609b8c 100644
--- a/src/host/scripts.c
+++ b/src/host/scripts.c
@@ -164,11 +164,12 @@ const char* builtin_scripts[] = {
"dcfg in ipairs(sln.configurations) do\nfor _, platform in ipairs(platforms) do\nlocal entry = { }\nentry.src_buildcfg = buildcfg\nentry.src_platform = platform\nif platform ~= \"PS3\" then\nentry.buildcfg = buildcfg\nentry.platform = premake.vstudio_platforms[platform]\nelse\nentry.buildcfg = platform .. \" \" .. buildcfg\nentry.platform = \"Win32\"\nend\nentry.name = entry.buildcfg .. \"|\" .. entry.platform\nentry.isreal = (platform ~= \"any\" and platform ~= \"mixed\")\ntable.insert(cfgs, entry)\nend\nend\nreturn cfgs\nend\nfunction _VS.cfgtype(cfg)\nif (cfg.kind == \"SharedLib\") then\nreturn 2\nelseif (cfg.kind == \"StaticLib\") then\nreturn 4\nelse\nreturn 1\nend\nend\nfunction premake.vstudio.cleansolution(sln)\npremake.clean.file(sln, \"%%.sln\")\npremake.clean.file(sln, \"%%.suo\")\npremake.clean.file(sln, \"%%.ncb\")\npremake.clean.file(sln, \"%%.userprefs\")\npremake.clean.file(sln, \"%%.usertasks\")\nend\nfunction premake.vstudio.cleanproject(prj)\nlocal fext = iif(premake.isdotnetproject(prj), \"."
"csproj\", \".vcproj\")\nlocal fname = premake.project.getfilename(prj, \"%%\")\nos.remove(fname .. fext)\nos.remove(fname .. fext .. \".user\")\nos.remove(fname .. \".pidb\")\nlocal userfiles = os.matchfiles(fname .. \".*.user\")\nfor _, fname in ipairs(userfiles) do\nos.remove(fname)\nend\nend\nfunction premake.vstudio.cleantarget(name)\nos.remove(name .. \".pdb\")\nos.remove(name .. \".idb\")\nos.remove(name .. \".ilk\")\nos.remove(name .. \".vshost.exe\")\nos.remove(name .. \".exe.manifest\")\nend\nlocal function output(indent, value)\n_p(indent .. value)\nend\nlocal function attrib(indent, name, value)\n_p(indent .. \"\\t\" .. name .. '=\"' .. value .. '\"')\nend\nfunction _VS.files(prj, fname, state, nestlevel)\nlocal indent = string.rep(\"\\t\", nestlevel + 2)\nif (state == \"GroupStart\") then\noutput(indent, \"<Filter\")\nattrib(indent, \"Name\", path.getname(fname))\nattrib(indent, \"Filter\", \"\")\noutput(indent, \"\\t>\")\nelseif (state == \"GroupEnd\") then\noutput(indent, \"</Filter>\")\nelse\nou"
"tput(indent, \"<File\")\nattrib(indent, \"RelativePath\", path.translate(fname, \"\\\\\"))\noutput(indent, \"\\t>\")\nif (not prj.flags.NoPCH and prj.pchsource == fname) then\nfor _, cfginfo in ipairs(prj.solution.vstudio_configs) do\nif cfginfo.isreal then\nlocal cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform)\noutput(indent, \"\\t<FileConfiguration\")\nattrib(indent, \"\\tName\", cfginfo.name)\noutput(indent, \"\\t\\t>\")\noutput(indent, \"\\t\\t<Tool\")\nattrib(indent, \"\\t\\tName\", iif(cfg.system == \"Xbox360\", \"VCCLX360CompilerTool\", \"VCCLCompilerTool\"))\nattrib(indent, \"\\t\\tUsePrecompiledHeader\", \"1\")\noutput(indent, \"\\t\\t/>\")\noutput(indent, \"\\t</FileConfiguration>\")\nend\nend\nend\noutput(indent, \"</File>\")\nend\nend\nfunction _VS.optimization(cfg)\nlocal result = 0\nfor _, value in ipairs(cfg.flags) do\nif (value == \"Optimize\") then\nresult = 3\nelseif (value == \"OptimizeSize\") then\nresult = 1\nelseif (value == \"OptimizeSpeed\") then\nresult = 2\nen"
- "d\nend\nreturn result\nend\nfunction _VS.projectfile(prj)\nlocal extension\nif (prj.language == \"C#\") then\nextension = \".csproj\"\nelse\nextension = \".vcproj\"\nend\nlocal fname = path.join(prj.location, prj.name)\nreturn fname..extension\nend\nfunction _VS.tool(prj)\nif (prj.language == \"C#\") then\nreturn \"FAE04EC0-301F-11D3-BF4B-00C04F79EFBC\"\nelse\nreturn \"8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942\"\nend\nend\nnewaction {\ntrigger = \"vs2002\",\nshortname = \"Visual Studio 2002\",\ndescription = \"Generate Microsoft Visual Studio 2002 project files\",\nos = \"windows\",\nvalid_kinds = { \"ConsoleApp\", \"WindowedApp\", \"StaticLib\", \"SharedLib\" },\nvalid_languages = { \"C\", \"C++\", \"C#\" },\nvalid_tools = {\ncc = { \"msc\" },\ndotnet = { \"msnet\" },\n},\nonsolution = function(sln)\npremake.generate(sln, \"%%.sln\", premake.vs2002_solution)\nend,\nonproject = function(prj)\nif premake.isdotnetproject(prj) then\npremake.generate(prj, \"%%.csproj\", prem"
- "ake.vs2002_csproj)\npremake.generate(prj, \"%%.csproj.user\", premake.vs2002_csproj_user)\nelse\npremake.generate(prj, \"%%.vcproj\", premake.vs200x_vcproj)\nend\nend,\noncleansolution = premake.vstudio.cleansolution,\noncleanproject = premake.vstudio.cleanproject,\noncleantarget = premake.vstudio.cleantarget\n}\nnewaction {\ntrigger = \"vs2003\",\nshortname = \"Visual Studio 2003\",\ndescription = \"Generate Microsoft Visual Studio 2003 project files\",\nos = \"windows\",\nvalid_kinds = { \"ConsoleApp\", \"WindowedApp\", \"StaticLib\", \"SharedLib\" },\nvalid_languages = { \"C\", \"C++\", \"C#\" },\nvalid_tools = {\ncc = { \"msc\" },\ndotnet = { \"msnet\" },\n},\nonsolution = function(sln)\npremake.generate(sln, \"%%.sln\", premake.vs2003_solution)\nend,\nonproject = function(prj)\nif premake.isdotnetproject(prj) then\npremake.generate(prj, \"%%.csproj\", premake.vs2002_csproj)\npremake.generate(prj, \"%%.csproj.user\", premake.vs2002_csproj_user)\nelse\npremake"
- ".generate(prj, \"%%.vcproj\", premake.vs200x_vcproj)\nend\nend,\noncleansolution = premake.vstudio.cleansolution,\noncleanproject = premake.vstudio.cleanproject,\noncleantarget = premake.vstudio.cleantarget\n}\nnewaction {\ntrigger = \"vs2005\",\nshortname = \"Visual Studio 2005\",\ndescription = \"Generate Microsoft Visual Studio 2005 project files\",\nos = \"windows\",\nvalid_kinds = { \"ConsoleApp\", \"WindowedApp\", \"StaticLib\", \"SharedLib\" },\nvalid_languages = { \"C\", \"C++\", \"C#\" },\nvalid_tools = {\ncc = { \"msc\" },\ndotnet = { \"msnet\" },\n},\nonsolution = function(sln)\npremake.generate(sln, \"%%.sln\", premake.vs2005_solution)\nend,\nonproject = function(prj)\nif premake.isdotnetproject(prj) then\npremake.generate(prj, \"%%.csproj\", premake.vs2005_csproj)\npremake.generate(prj, \"%%.csproj.user\", premake.vs2005_csproj_user)\nelse\npremake.generate(prj, \"%%.vcproj\", premake.vs200x_vcproj)\nend\nend,\noncleansolution = premake.vstudio.clean"
- "solution,\noncleanproject = premake.vstudio.cleanproject,\noncleantarget = premake.vstudio.cleantarget\n}\nnewaction {\ntrigger = \"vs2008\",\nshortname = \"Visual Studio 2008\",\ndescription = \"Generate Microsoft Visual Studio 2008 project files\",\nos = \"windows\",\nvalid_kinds = { \"ConsoleApp\", \"WindowedApp\", \"StaticLib\", \"SharedLib\" },\nvalid_languages = { \"C\", \"C++\", \"C#\" },\nvalid_tools = {\ncc = { \"msc\" },\ndotnet = { \"msnet\" },\n},\nonsolution = function(sln)\npremake.generate(sln, \"%%.sln\", premake.vs2005_solution)\nend,\nonproject = function(prj)\nif premake.isdotnetproject(prj) then\npremake.generate(prj, \"%%.csproj\", premake.vs2005_csproj)\npremake.generate(prj, \"%%.csproj.user\", premake.vs2005_csproj_user)\nelse\npremake.generate(prj, \"%%.vcproj\", premake.vs200x_vcproj)\nend\nend,\noncleansolution = premake.vstudio.cleansolution,\noncleanproject = premake.vstudio.cleanproject,\noncleantarget = premake.vstudio.cleantarge"
- "t\n}\n",
+ "d\nend\nreturn result\nend\nfunction _VS.projectfile(prj)\nlocal extension\nif (prj.language == \"C#\") then\nextension = \".csproj\"\nelseif (_ACTION == \"vs2010\" and prj.language == \"C++\" )then\nextension = \".vcxproj\"\nelseif (_ACTION == \"vs2010\" and prj.language == \"C\" )then\nextension = \".vcxproj\"\nelse\nextension = \".vcproj\"\nend\nlocal fname = path.join(prj.location, prj.name)\nreturn fname..extension\nend\nfunction _VS.tool(prj)\nif (prj.language == \"C#\") then\nreturn \"FAE04EC0-301F-11D3-BF4B-00C04F79EFBC\"\nelse\nreturn \"8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942\"\nend\nend\nnewaction {\ntrigger = \"vs2002\",\nshortname = \"Visual Studio 2002\",\ndescription = \"Generate Microsoft Visual Studio 2002 project files\",\nos = \"windows\",\nvalid_kinds = { \"ConsoleApp\", \"WindowedApp\", \"StaticLib\", \"SharedLib\" },\nvalid_languages = { \"C\", \"C++\", \"C#\" },\nvalid_tools = {\ncc = { \"msc\" },\ndotnet = { \"msnet\" },\n},\nonsolution = funct"
+ "ion(sln)\npremake.generate(sln, \"%%.sln\", premake.vs2002_solution)\nend,\nonproject = function(prj)\nif premake.isdotnetproject(prj) then\npremake.generate(prj, \"%%.csproj\", premake.vs2002_csproj)\npremake.generate(prj, \"%%.csproj.user\", premake.vs2002_csproj_user)\nelse\npremake.generate(prj, \"%%.vcproj\", premake.vs200x_vcproj)\nend\nend,\noncleansolution = premake.vstudio.cleansolution,\noncleanproject = premake.vstudio.cleanproject,\noncleantarget = premake.vstudio.cleantarget\n}\nnewaction {\ntrigger = \"vs2003\",\nshortname = \"Visual Studio 2003\",\ndescription = \"Generate Microsoft Visual Studio 2003 project files\",\nos = \"windows\",\nvalid_kinds = { \"ConsoleApp\", \"WindowedApp\", \"StaticLib\", \"SharedLib\" },\nvalid_languages = { \"C\", \"C++\", \"C#\" },\nvalid_tools = {\ncc = { \"msc\" },\ndotnet = { \"msnet\" },\n},\nonsolution = function(sln)\npremake.generate(sln, \"%%.sln\", premake.vs2003_solution)\nend,\nonproject = function(prj)\ni"
+ "f premake.isdotnetproject(prj) then\npremake.generate(prj, \"%%.csproj\", premake.vs2002_csproj)\npremake.generate(prj, \"%%.csproj.user\", premake.vs2002_csproj_user)\nelse\npremake.generate(prj, \"%%.vcproj\", premake.vs200x_vcproj)\nend\nend,\noncleansolution = premake.vstudio.cleansolution,\noncleanproject = premake.vstudio.cleanproject,\noncleantarget = premake.vstudio.cleantarget\n}\nnewaction {\ntrigger = \"vs2005\",\nshortname = \"Visual Studio 2005\",\ndescription = \"Generate Microsoft Visual Studio 2005 project files\",\nos = \"windows\",\nvalid_kinds = { \"ConsoleApp\", \"WindowedApp\", \"StaticLib\", \"SharedLib\" },\nvalid_languages = { \"C\", \"C++\", \"C#\" },\nvalid_tools = {\ncc = { \"msc\" },\ndotnet = { \"msnet\" },\n},\nonsolution = function(sln)\npremake.generate(sln, \"%%.sln\", premake.vs2005_solution)\nend,\nonproject = function(prj)\nif premake.isdotnetproject(prj) then\npremake.generate(prj, \"%%.csproj\", premake.vs2005_csproj)\npremak"
+ "e.generate(prj, \"%%.csproj.user\", premake.vs2005_csproj_user)\nelse\npremake.generate(prj, \"%%.vcproj\", premake.vs200x_vcproj)\nend\nend,\noncleansolution = premake.vstudio.cleansolution,\noncleanproject = premake.vstudio.cleanproject,\noncleantarget = premake.vstudio.cleantarget\n}\nnewaction {\ntrigger = \"vs2008\",\nshortname = \"Visual Studio 2008\",\ndescription = \"Generate Microsoft Visual Studio 2008 project files\",\nos = \"windows\",\nvalid_kinds = { \"ConsoleApp\", \"WindowedApp\", \"StaticLib\", \"SharedLib\" },\nvalid_languages = { \"C\", \"C++\", \"C#\" },\nvalid_tools = {\ncc = { \"msc\" },\ndotnet = { \"msnet\" },\n},\nonsolution = function(sln)\npremake.generate(sln, \"%%.sln\", premake.vs2005_solution)\nend,\nonproject = function(prj)\nif premake.isdotnetproject(prj) then\npremake.generate(prj, \"%%.csproj\", premake.vs2005_csproj)\npremake.generate(prj, \"%%.csproj.user\", premake.vs2005_csproj_user)\nelse\npremake.generate(prj, \"%%.vcproj"
+ "\", premake.vs200x_vcproj)\nend\nend,\noncleansolution = premake.vstudio.cleansolution,\noncleanproject = premake.vstudio.cleanproject,\noncleantarget = premake.vstudio.cleantarget\n}\nnewaction \n{\ntrigger = \"vs2010\",\nshortname = \"Visual Studio 2010\",\ndescription = \"Generate Microsoft Visual Studio 2010 project files\",\nos = \"windows\",\nvalid_kinds = { \"ConsoleApp\", \"WindowedApp\", \"StaticLib\", \"SharedLib\" },\nvalid_languages = { \"C++\",\"C\"},\nvalid_tools = {\ncc = { \"msc\" },\n},\nonsolution = function(sln)\npremake.generate(sln, \"%%.sln\", premake.vs_generic_solution)\nend,\nonproject = function(prj)\npremake.generate(prj, \"%%.vcxproj\", premake.vs2010_vcxproj)\npremake.generate(prj, \"%%.vcxproj.user\", premake.vs2010_vcxproj_user)\npremake.generate(prj, \"%%.vcxproj.filters\", premake.vs2010_vcxproj_filters)\nend,\noncleansolution = premake.vs2010_cleansolution,\noncleanproject = premake.vs2010_cleanproject,\noncleantarget = premak"
+ "e.vs2010_cleantarget\n}",
/* actions/vstudio/vs2002_solution.lua */
"function premake.vs2002_solution(sln)\nio.eol = '\\r\\n'\nsln.vstudio_configs = premake.vstudio_buildconfigs(sln)\n_p('Microsoft Visual Studio Solution File, Format Version 7.00')\nfor prj in premake.solution.eachproject(sln) do\nlocal projpath = path.translate(path.getrelative(sln.location, _VS.projectfile(prj)))\n_p('Project(\"{%s}\") = \"%s\", \"%s\", \"{%s}\"', _VS.tool(prj), prj.name, projpath, prj.uuid)\n_p('EndProject')\nend\n_p('Global')\n_p(1,'GlobalSection(SolutionConfiguration) = preSolution')\nfor i, cfgname in ipairs(sln.configurations) do\n_p(2,'ConfigName.%d = %s', i - 1, cfgname)\nend\n_p(1,'EndGlobalSection')\n_p(1,'GlobalSection(ProjectDependencies) = postSolution')\n_p(1,'EndGlobalSection')\n_p(1,'GlobalSection(ProjectConfiguration) = postSolution')\nfor prj in premake.solution.eachproject(sln) do\nfor _, cfgname in ipairs(sln.configurations) do\n_p(2,'{%s}.%s.ActiveCfg = %s|%s', prj.uuid, cfgname, cfgname, _VS.arch(prj))\n_p(2,'{%s}.%s.Build.0 = %s|%s', prj.uuid, cfgname, cfgname, _VS.arch("
@@ -223,6 +224,30 @@ const char* builtin_scripts[] = {
/* actions/vstudio/vs2005_csproj_user.lua */
"function premake.vs2005_csproj_user(prj)\nio.eol = \"\\r\\n\"\n_p('<Project xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">')\n_p(' <PropertyGroup>')\nlocal refpaths = table.translate(prj.libdirs, function(v) return path.getabsolute(prj.location .. \"/\" .. v) end)\n_p(' <ReferencePath>%s</ReferencePath>', path.translate(table.concat(refpaths, \";\"), \"\\\\\"))\n_p(' </PropertyGroup>')\n_p('</Project>')\nend\n",
+ /* actions/vstudio/vs_generic_solution.lua */
+ "\nlocal vs_format_version = function()\nlocal t =\n{\nvs2005 = '9.00',\n vs2008 = '10.00',\n vs2010 = '11.00'\n}\nreturn t[_ACTION]\nend\nlocal vs_version = function()\nlocal t =\n{\nvs2005 = '2005',\n vs2008 = '2008',\n vs2010 = '2010'\n}\nreturn t[_ACTION]\nend\nlocal vs_write_version_info = function()\n_p('Microsoft Visual Studio Solution File, Format Version %s', vs_format_version())\n_p('# Visual Studio %s', vs_version() )\nend\nlocal vs_write_projects = function(sln)\nfor prj in premake.solution.eachproject(sln) do\nlocal projpath = path.translate(path.getrelative(sln.location, _VS.projectfile(prj)), \"\\\\\")\n_p('Project(\"{%s}\") = \"%s\", \"%s\", \"{%s}\"', _VS.tool(prj), prj.name, projpath, prj.uuid)\nlocal deps = premake.getdependencies(prj)\nif #deps > 0 then\n_p('\\tProjectSection(ProjectDependencies) = postProject')\nfor _, dep in ipairs(deps) do\n_p('\\t\\t{%s} = {%s}', dep.uuid, dep.uuid)\nend\n_p('\\tEndProjectSection')\nend\n_p('EndProject')\nend\nend\nlocal vs_write_pre_version "
+ "= function(sln)\nio.eol = '\\r\\n'\nsln.vstudio_configs = premake.vstudio_buildconfigs(sln)\n_p('\\239\\187\\191')\nend\nfunction premake.vs_generic_solution(sln)\nvs_write_pre_version(sln)\nvs_write_version_info()\nvs_write_projects(sln)\n_p('Global')\npremake.vs2005_solution_platforms(sln)\npremake.vs2005_solution_project_platforms(sln)\npremake.vs2005_solution_properties(sln)\n_p('EndGlobal')\nend",
+
+ /* actions/vstudio/vs2010_vcxproxj.lua */
+ "\npremake.vstudio.vcxproj = { }\nfunction remove_relative_path(file)\nfile = file:gsub(\"%.%.\\\\\",'')\nfile = file:gsub(\"%.\\\\\",'')\nreturn file\nend\nfunction file_path(file)\nfile = remove_relative_path(file)\nlocal path = string.find(file,'\\\\[%w%.%_%-]+$')\nif path then\nreturn string.sub(file,1,path-1)\nelse\nreturn nil\nend\nend\nfunction list_of_directories_in_path(path)\nlocal list={}\nif path then\nfor dir in string.gmatch(path,\"[%w%-%_%.]+\\\\\")do\nif #list == 0 then\nlist[1] = dir:sub(1,#dir-1)\nelse\nlist[#list +1] = list[#list] ..\"\\\\\" ..dir:sub(1,#dir-1)\nend\nend\nend\nreturn list\nend\nfunction table_of_filters(t)\nlocal filters ={}\nfor key, value in pairs(t) do\nlocal result = list_of_directories_in_path(value)\nfor __,dir in ipairs(result) do\nif table.contains(filters,dir) ~= true then\nfilters[#filters +1] = dir\nend\nend\nend\nreturn filters\nend\nfunction table_of_file_filters(files)\nlocal filters ={}\nfor key, valueTable in pairs(files) do\nfor _, entry in ipairs(valueTable)"
+ " do\nlocal result = list_of_directories_in_path(entry)\nfor __,dir in ipairs(result) do\nif table.contains(filters,dir) ~= true then\nfilters[#filters +1] = dir\nend\nend\nend\nend\nreturn filters\nend\nlocal function vs2010_config(prj)\n_p(1,'<ItemGroup Label=\"ProjectConfigurations\">')\nfor _, cfginfo in ipairs(prj.solution.vstudio_configs) do\n_p(2,'<ProjectConfiguration Include=\"%s\">', premake.esc(cfginfo.name))\n_p(3,'<Configuration>%s</Configuration>',cfginfo.buildcfg)\n_p(3,'<Platform>%s</Platform>',cfginfo.platform)\n_p(2,'</ProjectConfiguration>')\nend\n_p(1,'</ItemGroup>')\nend\nlocal function vs2010_globals(prj)\n_p(1,'<PropertyGroup Label=\"Globals\">')\n_p(2,'<ProjectGuid>{%s}</ProjectGuid>',prj.uuid)\n_p(2,'<RootNamespace>%s</RootNamespace>',prj.name)\n_p(2,'<Keyword>Win32Proj</Keyword>')\n_p(1,'</PropertyGroup>')\nend\nfunction config_type(config)\nlocal t =\n{\nSharedLib = \"DynamicLibrary\",\nStaticLib = \"StaticLibrary\",\nConsoleApp = \"Application\",\n}\nreturn t[config.kind]\nend\nfunct"
+ "ion if_config_and_platform()\nreturn 'Condition=\"\\'$(Configuration)|$(Platform)'\nend\nfunction config_type_block(prj)\nfor _, cfginfo in ipairs(prj.solution.vstudio_configs) do\nlocal cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform)\n_p(1,'<PropertyGroup '..if_config_and_platform() ..'\\'==\\'%s\\'\" Label=\"Configuration\">'\n, premake.esc(cfginfo.name))\n_p(2,'<ConfigurationType>%s</ConfigurationType>',config_type(cfg))\n_p(2,'<CharacterSet>%s</CharacterSet>',iif(cfg.flags.Unicode,\"Unicode\",\"MultiByte\"))\nif cfg.flags.MFC then\n_p(2,'<UseOfMfc>Dynamic</UseOfMfc>')\nend\nlocal use_debug = \"false\"\nif optimisation(cfg) == \"Disabled\" then \nuse_debug = \"true\" \nelse\n_p(2,'<WholeProgramOptimization>true</WholeProgramOptimization>')\nend\n_p(2,'<UseDebugLibraries>%s</UseDebugLibraries>',use_debug)\n_p(1,'</PropertyGroup>')\nend\nend\nfunction import_props(prj)\nfor _, cfginfo in ipairs(prj.solution.vstudio_configs) do\nlocal cfg = premake.getconfig(prj, cfginfo.src_buildcfg, "
+ "cfginfo.src_platform)\n_p(1,'<ImportGroup '..if_config_and_platform() ..'\\'==\\'%s\\'\" Label=\"PropertySheets\">'\n,premake.esc(cfginfo.name))\n_p(2,'<Import Project=\"$(UserRootDir)\\\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists(\\'$(UserRootDir)\\\\Microsoft.Cpp.$(Platform).user.props\\')\" Label=\"LocalAppDataPlatform\" />')\n_p(1,'</ImportGroup>')\nend\nend\nfunction incremental_link(cfg,cfginfo)\nif cfg.kind ~= \"StaticLib\" then\nShoudLinkIncrementally = 'false'\nif optimisation(cfg) == \"Disabled\" then\nShoudLinkIncrementally = 'true'\nend\n_p(2,'<LinkIncremental '..if_config_and_platform() ..'\\'==\\'%s\\'\">%s</LinkIncremental>'\n,premake.esc(cfginfo.name),ShoudLinkIncrementally)\nend\nend\nfunction ignore_import_lib(cfg,cfginfo)\nif cfg.kind == \"SharedLib\" then\nlocal shouldIgnore = \"false\"\nif cfg.flags.NoImportLib then shouldIgnore = \"true\" end\n _p(2,'<IgnoreImportLibrary '..if_config_and_platform() ..'\\'==\\'%s\\'\">%s</IgnoreImportLibrary>'\n,premake.esc(cfginfo.name),sho"
+ "uldIgnore)\nend\nend\nfunction intermediate_and_out_dirs(prj)\n_p(1,'<PropertyGroup>')\n_p(2,'<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>')\nfor _, cfginfo in ipairs(prj.solution.vstudio_configs) do\nlocal cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform)\n_p(2,'<OutDir '..if_config_and_platform() ..'\\'==\\'%s\\'\">%s\\\\</OutDir>'\n, premake.esc(cfginfo.name),premake.esc(cfg.buildtarget.directory) )\n_p(2,'<IntDir '..if_config_and_platform() ..'\\'==\\'%s\\'\">%s\\\\</IntDir>'\n, premake.esc(cfginfo.name), premake.esc(cfg.objectsdir))\n_p(2,'<TargetName '..if_config_and_platform() ..'\\'==\\'%s\\'\">%s</TargetName>'\n,premake.esc(cfginfo.name),path.getbasename(cfg.buildtarget.name))\nignore_import_lib(cfg,cfginfo)\nincremental_link(cfg,cfginfo)\nif cfg.flags.NoManifest then\n_p(2,'<GenerateManifest '..if_config_and_platform() ..'\\'==\\'%s\\'\">false</GenerateManifest>'\n,premake.esc(cfginfo.name))\nend\nend\n_p(1,'</PropertyGroup>')\nend\nfunction optimisation(cfg)\nlocal "
+ "result = \"Disabled\"\nfor _, value in ipairs(cfg.flags) do\nif (value == \"Optimize\") then\nresult = \"Full\"\nelseif (value == \"OptimizeSize\") then\nresult = \"MinSpace\"\nelseif (value == \"OptimizeSpeed\") then\nresult = \"MaxSpeed\"\nend\nend\nreturn result\nend\nfunction runtime(cfg)\nlocal runtime\nif cfg.flags.StaticRuntime then\nruntime = iif(cfg.flags.Symbols,\"MultiThreadedDebug\",\"MultiThreaded\")\nelse\nruntime = iif(cfg.flags.Symbols, \"MultiThreadedDebugDLL\", \"MultiThreadedDLL\")\nend\nreturn runtime\nend\nfunction precompiled_header(cfg)\n if not cfg.flags.NoPCH and cfg.pchheader then\n_p(3,'<PrecompiledHeader>Use</PrecompiledHeader>')\n_p(3,'<PrecompiledHeaderFile>%s</PrecompiledHeaderFile>', path.getname(cfg.pchheader))\nelse\n_p(3,'<PrecompiledHeader></PrecompiledHeader>')\nend\nend\nfunction preprocessor(indent,cfg)\nif #cfg.defines > 0 then\n_p(indent,'<PreprocessorDefinitions>%s;%%(PreprocessorDefinitions)</PreprocessorDefinitions>'\n,premake.esc(table.concat(cfg.defines, \";\""
+ ")))\nelse\n_p(indent,'<PreprocessorDefinitions></PreprocessorDefinitions>')\nend\nend\nfunction include_dirs(indent,cfg)\nif #cfg.includedirs > 0 then\n_p(indent,'<AdditionalIncludeDirectories>%s;%%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>'\n,premake.esc(path.translate(table.concat(cfg.includedirs, \";\"), '\\\\')))\nend\nend\nfunction resource_compile(cfg)\n_p(2,'<ResourceCompile>')\npreprocessor(3,cfg)\ninclude_dirs(3,cfg)\n_p(2,'</ResourceCompile>')\nend\nfunction exceptions(cfg)\nif cfg.flags.NoExceptions then\n_p(2,'<ExceptionHandling>false</ExceptionHandling>')\nelseif cfg.flags.SEH then\n_p(2,'<ExceptionHandling>Async</ExceptionHandling>')\nend\nend\nfunction rtti(cfg)\nif cfg.flags.NoRTTI then\n_p(3,'<RuntimeTypeInfo>false</RuntimeTypeInfo>')\nend\nend\nfunction wchar_t_buildin(cfg)\nif cfg.flags.NativeWChar then\n_p(3,'<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>')\nelseif cfg.flags.NoNativeWChar then\n_p(3,'<TreatWChar_tAsBuiltInType>false</TreatWChar_tAsBuiltInType"
+ ">')\nend\nend\nfunction sse(cfg)\nif cfg.flags.EnableSSE then\n_p(3,'<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>')\nelseif cfg.flags.EnableSSE2 then\n_p(3,'<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>')\nend\nend\nfunction floating_point(cfg)\n if cfg.flags.FloatFast then\n_p(3,'<FloatingPointModel>Fast</FloatingPointModel>')\nelseif cfg.flags.FloatStrict then\n_p(3,'<FloatingPointModel>Strict</FloatingPointModel>')\nend\nend\nfunction debug_info(cfg)\nif cfg.flags.Symbols and not cfg.flags.NoEditAndContinue then\n_p(3,'<DebugInformationFormat>EditAndContinue</DebugInformationFormat>')\nelse\n_p(3,'<DebugInformationFormat></DebugInformationFormat>')\nend\nend\nfunction minimal_build(cfg)\nif cfg.flags.Symbols and not cfg.flags.NoMinimalRebuild then\n_p(3,'<MinimalRebuild>true</MinimalRebuild>')\nelseif cfg.flags.Symbols then\n_p(3,'<MinimalRebuild>false</MinimalRebuild>')\nend\nend\nfunction compile_language(cfg)\nif cfg.lang"
+ "uage == \"C\" then\n_p(3,'<CompileAs>CompileAsC</CompileAs>')\nend\nend\nfunction vs10_clcompile(cfg)\n_p(2,'<ClCompile>')\nif #cfg.buildoptions > 0 then\n_p(3,'<AdditionalOptions>%s %%(AdditionalOptions)</AdditionalOptions>',\ntable.concat(premake.esc(cfg.buildoptions), \" \"))\nend\n_p(3,'<Optimization>%s</Optimization>',optimisation(cfg))\ninclude_dirs(3,cfg)\npreprocessor(3,cfg)\nminimal_build(cfg)\nif optimisation(cfg) == \"Disabled\" then\n_p(3,'<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>')\nif cfg.flags.ExtraWarnings then\n_p(3,'<SmallerTypeCheck>true</SmallerTypeCheck>')\nend\nelse\n_p(3,'<StringPooling>true</StringPooling>')\nend\n_p(3,'<RuntimeLibrary>%s</RuntimeLibrary>', runtime(cfg))\n_p(3,'<FunctionLevelLinking>true</FunctionLevelLinking>')\nprecompiled_header(cfg)\nif cfg.flags.ExtraWarnings then\n_p(3,'<WarningLevel>Level4</WarningLevel>')\nelse\n_p(3,'<WarningLevel>Level3</WarningLevel>')\nend\nif cfg.flags.FatalWarnings then\n_p(3,'<TreatWarningAsError>true</TreatWarningAsError>"
+ "')\nend\nexceptions(cfg)\nrtti(cfg)\nwchar_t_buildin(cfg)\nsse(cfg)\nfloating_point(cfg)\ndebug_info(cfg)\nif cfg.flags.NoFramePointer then\n_p(3,'<OmitFramePointers>true</OmitFramePointers>')\nend\ncompile_language(cfg)\n_p(2,'</ClCompile>')\nend\nfunction event_hooks(cfg)\nif #cfg.postbuildcommands> 0 then\n _p(2,'<PostBuildEvent>')\n_p(3,'<Command>%s</Command>',premake.esc(table.implode(cfg.postbuildcommands, \"\", \"\", \"\\r\\n\")))\n_p(2,'</PostBuildEvent>')\nend\nif #cfg.prebuildcommands> 0 then\n _p(2,'<PreBuildEvent>')\n_p(3,'<Command>%s</Command>',premake.esc(table.implode(cfg.prebuildcommands, \"\", \"\", \"\\r\\n\")))\n_p(2,'</PreBuildEvent>')\nend\nif #cfg.prelinkcommands> 0 then\n _p(2,'<PreLinkEvent>')\n_p(3,'<Command>%s</Command>',premake.esc(table.implode(cfg.prelinkcommands, \"\", \"\", \"\\r\\n\")))\n_p(2,'</PreLinkEvent>')\nend\nend\nfunction item_def_lib(cfg)\nif cfg.kind == 'StaticLib' then\n_p(1,'<Lib>')\n_p(2,'<OutputFile>$(OutDir)%s</OutputFile>',cfg.buildtarget.name)\n_p(1,'<"
+ "/Lib>')\nend\nend\nfunction link_target_machine(cfg)\nlocal target\nif cfg.platform == nil or cfg.platform == \"x32\" then target =\"MachineX86\"\nelseif cfg.platform == \"x64\" then target =\"MachineX64\"\nend\n_p(3,'<TargetMachine>%s</TargetMachine>', target)\nend\nfunction import_lib(cfg)\nif cfg.kind == \"SharedLib\" then\nlocal implibname = cfg.linktarget.fullpath\n_p(3,'<ImportLibrary>%s</ImportLibrary>',iif(cfg.flags.NoImportLib, cfg.objectsdir .. \"\\\\\" .. path.getname(implibname), implibname))\nend\nend\nfunction common_link_section(cfg)\n_p(3,'<SubSystem>%s</SubSystem>',iif(cfg.kind == \"ConsoleApp\",\"Console\", \"Windows\"))\nif cfg.flags.Symbols then \n_p(3,'<GenerateDebugInformation>true</GenerateDebugInformation>')\nelse\n_p(3,'<GenerateDebugInformation>false</GenerateDebugInformation>')\nend\nif optimisation(cfg) ~= \"Disabled\" then\n_p(3,'<OptimizeReferences>true</OptimizeReferences>')\n_p(3,'<EnableCOMDATFolding>true</EnableCOMDATFolding>')\nend\n_p(3,'<ProgramDataBaseFileName>$(OutDir)%s."
+ "pdb</ProgramDataBaseFileName>'\n, path.getbasename(cfg.buildtarget.name))\nend\nfunction item_link(cfg)\n_p(2,'<Link>')\nif cfg.kind ~= 'StaticLib' then\nif #cfg.links > 0 then\n_p(3,'<AdditionalDependencies>%s;%%(AdditionalDependencies)</AdditionalDependencies>',\ntable.concat(premake.getlinks(cfg, \"all\", \"fullpath\"), \";\"))\nend\n_p(3,'<OutputFile>$(OutDir)%s</OutputFile>', cfg.buildtarget.name)\n_p(3,'<AdditionalLibraryDirectories>%s%s%%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>',\ntable.concat(premake.esc(path.translate(cfg.libdirs, '\\\\')) , \";\"),\niif(cfg.libdirs and #cfg.libdirs >0,';',''))\ncommon_link_section(cfg)\nif (cfg.kind == \"ConsoleApp\" or cfg.kind == \"WindowedApp\") and not cfg.flags.WinMain then\n_p(3,'<EntryPointSymbol>mainCRTStartup</EntryPointSymbol>')\nend\nimport_lib(cfg)\n_p(3,'<TargetMachine>%s</TargetMachine>', iif(cfg.platform == \"x64\", \"MachineX64\", \"MachineX86\"))\nelse\ncommon_link_section(cfg)\nend\n_p(2,'</Link>')\nend\n \nfunction item_defi"
+ "nitions(prj)\nfor _, cfginfo in ipairs(prj.solution.vstudio_configs) do\nlocal cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform)\n_p(1,'<ItemDefinitionGroup Condition=\"\\'$(Configuration)|$(Platform)\\'==\\'%s\\'\">'\n,premake.esc(cfginfo.name))\nvs10_clcompile(cfg)\nresource_compile(cfg)\nitem_def_lib(cfg)\nitem_link(cfg)\nevent_hooks(cfg)\n_p(1,'</ItemDefinitionGroup>')\nend\nend\nfunction get_file_extension(file)\nlocal ext_start,ext_end = string.find(file,\"%.[%w_%-]+$\")\nif ext_start then\nreturn string.sub(file,ext_start+1,ext_end)\nend\nend\nfunction sort_input_files(files,sorted_container)\nlocal types = \n{\nh= \"ClInclude\",\nhpp= \"ClInclude\",\nhxx= \"ClInclude\",\nc= \"ClCompile\",\ncpp= \"ClCompile\",\ncxx= \"ClCompile\",\ncc= \"ClCompile\"\n}\nfor _, current_file in ipairs(files) do\nlocal translated_path = path.translate(current_file, '\\\\')\nlocal ext = get_file_extension(translated_path)\nif ext then\nlocal type = types[ext]\nif type then\ntable.insert(sorted_contai"
+ "ner[type],translated_path)\nelse\ntable.insert(sorted_container.None,translated_path)\nend\nend\nend\nend\n -- <ProjectReference Include=\"zlibvc.vcxproj\">\n -- <Project>{8fd826f8-3739-44e6-8cc8-997122e53b8d}</Project>\n -- </ProjectReference>\n -- </ItemGroup>\nfunction write_file_type_block(files,group_type)\nif #files > 0 then\n_p(1,'<ItemGroup>')\nfor _, current_file in ipairs(files) do\n_p(2,'<%s Include=\\\"%s\\\" />', group_type,current_file)\nend\n_p(1,'</ItemGroup>')\nend\nend\nfunction vcxproj_files(prj)\nlocal sorted =\n{\nClCompile={},\nClInclude={},\nNone={}\n}\ncfg = premake.getconfig(prj)\nsort_input_files(cfg.files,sorted)\nwrite_file_type_block(sorted.ClInclude,\"ClInclude\")\nwrite_file_type_block(sorted.ClCompile,'ClCompile')\nwrite_file_type_block(sorted.None,'None')\nend\nfunction write_filter_includes(sorted_table)\nlocal directories = table_of_file_filters(sorted_table)\nif #directories >0 then\n_p(1,'<ItemGroup>')\nfor _, dir in pairs(directories) do\n_p(2,'<Filter"
+ " Include=\"%s\">',dir)\n_p(3,'<UniqueIdentifier>{%s}</UniqueIdentifier>',os.uuid())\n_p(2,'</Filter>')\nend\n_p(1,'</ItemGroup>')\nend\nend\nfunction write_file_filter_block(files,group_type)\nif #files > 0 then\n_p(1,'<ItemGroup>')\nfor _, current_file in ipairs(files) do\nlocal path_to_file = file_path(current_file)\nif path_to_file then\n_p(2,'<%s Include=\\\"%s\\\">', group_type,path.translate(current_file, \"\\\\\"))\n_p(3,'<Filter>%s</Filter>',path_to_file)\n_p(2,'</%s>',group_type)\nelse\n_p(2,'<%s Include=\\\"%s\\\" />', group_type,path.translate(current_file, \"\\\\\"))\nend\nend\n_p(1,'</ItemGroup>')\nend\nend\nfunction vcxproj_filter_files(prj)\nlocal sorted =\n{\nClCompile={},\nClInclude={},\nNone={}\n}\ncfg = premake.getconfig(prj)\nsort_input_files(cfg.files,sorted)\nio.eol = \"\\r\\n\"\n_p('<?xml version=\"1.0\" encoding=\"utf-8\"?>')\n_p('<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">')\nwrite_filter_includes(sorted)\nwrite_file_filter_block(sorted"
+ ".ClInclude,\"ClInclude\")\nwrite_file_filter_block(sorted.ClCompile,\"ClCompile\")\nwrite_file_filter_block(sorted.None,\"None\")\n_p('</Project>')\nend\n -- <ItemGroup>\n -- <ClCompile Include=\"SomeProjName.cpp\" />\n -- <ClCompile Include=\"stdafx.cpp\">\n -- <PrecompiledHeader Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">Create</PrecompiledHeader>\n -- <PrecompiledHeader Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">Create</PrecompiledHeader>\n --</ClCompile>\n --</ItemGroup>\nfunction premake.vs2010_vcxproj(prj)\nio.eol = \"\\r\\n\"\n_p('<?xml version=\"1.0\" encoding=\"utf-8\"?>')\n_p('<Project DefaultTargets=\"Build\" ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">')\nvs2010_config(prj)\nvs2010_globals(prj)\n_p(1,'<Import Project=\"$(VCTargetsPath)\\\\Microsoft.Cpp.Default.props\" />')\nconfig_type_block(prj)\n_p(1,'<Import Project=\"$(VCTargetsPath)\\\\Microsoft.Cpp.props\" />')\n_p(1,'<ImportGroup Label=\"ExtensionSetti"
+ "ngs\">')\n_p(1,'</ImportGroup>')\nimport_props(prj)\n_p(1,'<PropertyGroup Label=\"UserMacros\" />')\nintermediate_and_out_dirs(prj)\nitem_definitions(prj)\nvcxproj_files(prj)\n_p(1,'<Import Project=\"$(VCTargetsPath)\\\\Microsoft.Cpp.targets\" />')\n_p(1,'<ImportGroup Label=\"ExtensionTargets\">')\n_p(1,'</ImportGroup>')\n_p('</Project>')\nend\nfunction premake.vs2010_vcxproj_user(prj)\n_p('<?xml version=\"1.0\" encoding=\"utf-8\"?>')\n_p('<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">')\n_p('</Project>')\nend\nfunction premake.vs2010_vcxproj_filters(prj)\nvcxproj_filter_files(prj)\nend\nfunction premake.vs2010_cleansolution(sln)\npremake.clean.file(sln, \"%%.sln\")\npremake.clean.file(sln, \"%%.suo\")\nend\nfunction premake.vs2010_cleanproject(prj)\nio.write('vs2010 clean action')\nlocal fname = premake.project.getfilename(prj, \"%%\")\nlocal vcxname = fname .. \".vcxproj\"\nio.write(vcxname)\nos.remove(fname .. '.vcxproj')\nos.remove(fname .. '.vcxproj.user')\nos"
+ ".remove(fname .. '.vcxproj.filters')\nos.remove(fname .. '.sdf')\nlocal userfiles = os.matchfiles(fname .. \".vcxproj.user\")\nfor _, fname in ipairs(userfiles) do\nos.remove(fname)\nend\nlocal filter_files = os.matchfiles(fname .. \".vcxproj.filter\")\nfor _, fname in ipairs(filter_files) do\nos.remove(fname)\nend\nlocal proj_files = os.matchfiles(fname .. \".vcxproj\")\nfor _, fname in ipairs(proj_files) do\nos.remove(fname)\nend\nlocal sdf_files = os.matchfiles(fname .. \".sdf\")\nfor _, fname in ipairs(sdf_files) do\nos.remove(fname)\nend\nend\nfunction premake.vs2010_cleantarget(name)\nos.remove(name .. \".pdb\")\nos.remove(name .. \".idb\")\nos.remove(name .. \".ilk\")\nend\n",
+
/* actions/xcode/_xcode.lua */
"premake.xcode = { }\nnewaction \n{\ntrigger = \"xcode3\",\nshortname = \"Xcode 3\",\ndescription = \"Generate Apple Xcode 3 project files (experimental)\",\nos = \"macosx\",\nvalid_kinds = { \"ConsoleApp\", \"WindowedApp\", \"SharedLib\", \"StaticLib\" },\nvalid_languages = { \"C\", \"C++\" },\nvalid_tools = {\ncc = { \"gcc\" },\n},\nvalid_platforms = { \nNative = \"Native\", \nx32 = \"Native 32-bit\", \nx64 = \"Native 64-bit\", \nUniversal32 = \"32-bit Universal\", \nUniversal64 = \"64-bit Universal\", \nUniversal = \"Universal\",\n},\ndefault_platform = \"Universal\",\nonsolution = function(sln)\npremake.xcode.preparesolution(sln)\nend,\nonproject = function(prj)\npremake.generate(prj, \"%%.xcodeproj/project.pbxproj\", premake.xcode.project)\nend,\noncleanproject = function(prj)\npremake.clean.directory(prj, \"%%.xcodeproj\")\nend,\noncheckproject = function(prj)\nlocal last\nfor cfg in premake.eachconfig(prj) do\nif last and last ~= cfg.kind then\nerror(\"Project '"
"\" .. prj.name .. \"' uses more than one target kind; not supported by Xcode\", 0)\nend\nlast = cfg.kind\nend\nend,\n}\n",
@@ -256,8 +281,9 @@ const char* builtin_scripts[] = {
"BXProject(tr)\nxcode.PBXReferenceProxy(tr)\nxcode.PBXResourcesBuildPhase(tr)\nxcode.PBXShellScriptBuildPhase(tr)\nxcode.PBXSourcesBuildPhase(tr)\nxcode.PBXVariantGroup(tr)\nxcode.PBXTargetDependency(tr)\nxcode.XCBuildConfiguration(tr)\nxcode.XCBuildConfigurationList(tr)\nxcode.Footer(tr)\nend\n",
/* actions/clean/_clean.lua */
- "premake.clean = { }\nfunction premake.clean.directory(obj, pattern)\nlocal fname = premake.project.getfilename(obj, pattern)\nos.rmdir(fname)\nend\nfunction premake.clean.file(obj, pattern)\nlocal fname = premake.project.getfilename(obj, pattern)\nos.remove(fname)\nend\nnewaction {\ntrigger = \"clean\",\ndescription = \"Remove all binaries and generated files\",\nonsolution = function(sln)\nfor action in premake.action.each() do\nif action.oncleansolution then\naction.oncleansolution(sln)\nend\nend\nend,\nonproject = function(prj)\nfor action in premake.action.each() do\nif action.oncleanproject then\naction.oncleanproject(prj)\nend\nend\nif (prj.objectsdir) then\npremake.clean.directory(prj, prj.objectsdir)\nend\nlocal platforms = prj.solution.platforms or { }\nif not table.contains(platforms, \"Native\") then\nplatforms = table.join(platforms, { \"Native\" })\nend\nfor _, platform in ipairs(platforms) do\nfor cfg in premake.eachconfig(prj, platform) do\npremake.clean.directory(prj, cfg.objectsdir)\nprema"
- "ke.clean.file(prj, premake.gettarget(cfg, \"build\", \"posix\", \"windows\", \"windows\").fullpath)\npremake.clean.file(prj, premake.gettarget(cfg, \"build\", \"posix\", \"posix\", \"linux\").fullpath)\npremake.clean.file(prj, premake.gettarget(cfg, \"build\", \"posix\", \"posix\", \"macosx\").fullpath)\npremake.clean.file(prj, premake.gettarget(cfg, \"build\", \"posix\", \"PS3\", \"windows\").fullpath)\nif cfg.kind == \"WindowedApp\" then\npremake.clean.directory(prj, premake.gettarget(cfg, \"build\", \"posix\", \"posix\", \"linux\").fullpath .. \".app\")\nend\npremake.clean.file(prj, premake.gettarget(cfg, \"link\", \"windows\", \"windows\", \"windows\").fullpath)\npremake.clean.file(prj, premake.gettarget(cfg, \"link\", \"posix\", \"posix\", \"linux\").fullpath)\nlocal target = path.join(premake.project.getfilename(prj, cfg.buildtarget.directory), cfg.buildtarget.basename)\nfor action in premake.action.each() do\nif action.oncleantarget then\naction.oncleantarget(target)\nend\nend\nend\nend\nend\n}\n",
+ "premake.clean = { }\nfunction premake.clean.directory(obj, pattern)\nlocal fname = premake.project.getfilename(obj, pattern)\nos.rmdir(fname)\nend\nfunction premake.clean.file(obj, pattern)\nlocal fname = premake.project.getfilename(obj, pattern)\nos.remove(fname)\nend\nnewaction {\ntrigger = \"clean\",\ndescription = \"Remove all binaries and generated files\",\nonsolution = function(sln)\nfor action in premake.action.each() do\nif action.oncleansolution then\naction.oncleansolution(sln)\nend\nend\nend,\nonproject = function(prj)\nfor action in premake.action.each() do\nif action.trigger ==\"vs2010\" then\nif action.oncleanproject then\nio.write('vs2010 has an on clean and we are going to call it\\n')\nelse\nio.write('vs2010 does not have an on clean\\n')\nend\nif action.oncleansolution then\nio.write('vs2010 has an oncleansolution and we are going to call it\\n')\nelse\nio.write('vs2010 does not have an oncleansolution\\n')\nend\nif action.oncleantarget then\nio.write('vs2010 has an oncleantarget and we "
+ "are going to call it\\n')\nelse\nio.write('vs2010 does not have an oncleantarget\\n')\nend\nend\nif action.oncleanproject then\naction.oncleanproject(prj)\nend\nend\nif (prj.objectsdir) then\npremake.clean.directory(prj, prj.objectsdir)\nend\nlocal platforms = prj.solution.platforms or { }\nif not table.contains(platforms, \"Native\") then\nplatforms = table.join(platforms, { \"Native\" })\nend\nfor _, platform in ipairs(platforms) do\nfor cfg in premake.eachconfig(prj, platform) do\npremake.clean.directory(prj, cfg.objectsdir)\npremake.clean.file(prj, premake.gettarget(cfg, \"build\", \"posix\", \"windows\", \"windows\").fullpath)\npremake.clean.file(prj, premake.gettarget(cfg, \"build\", \"posix\", \"posix\", \"linux\").fullpath)\npremake.clean.file(prj, premake.gettarget(cfg, \"build\", \"posix\", \"posix\", \"macosx\").fullpath)\npremake.clean.file(prj, premake.gettarget(cfg, \"build\", \"posix\", \"PS3\", \"windows\").fullpath)\nif cfg.kind == \"WindowedApp\" then\npremake.clean.directory(prj, premake.get"
+ "target(cfg, \"build\", \"posix\", \"posix\", \"linux\").fullpath .. \".app\")\nend\npremake.clean.file(prj, premake.gettarget(cfg, \"link\", \"windows\", \"windows\", \"windows\").fullpath)\npremake.clean.file(prj, premake.gettarget(cfg, \"link\", \"posix\", \"posix\", \"linux\").fullpath)\nlocal target = path.join(premake.project.getfilename(prj, cfg.buildtarget.directory), cfg.buildtarget.basename)\nfor action in premake.action.each() do\nif action.oncleantarget then\naction.oncleantarget(target)\nend\nend\nend\nend\nend\n}\n",
/* _premake_main.lua */
"local scriptfile = \"premake4.lua\"\nlocal shorthelp = \"Type 'premake4 --help' for help\"\nlocal versionhelp = \"premake4 (Premake Build Script Generator) %s\"\nlocal function injectplatform(platform)\nif not platform then return true end\nplatform = premake.checkvalue(platform, premake.fields.platforms.allowed)\nfor sln in premake.solution.each() do\nlocal platforms = sln.platforms or { }\nif #platforms == 0 then\ntable.insert(platforms, \"Native\")\nend\nif not table.contains(platforms, \"Native\") then\nreturn false, sln.name .. \" does not target native platform\\nNative platform settings are required for the --platform feature.\"\nend\nif not table.contains(platforms, platform) then\ntable.insert(platforms, platform)\nend\nsln.platforms = platforms\nend\nreturn true\nend\nfunction _premake_main(scriptpath)\nif (scriptpath) then\nlocal scripts = dofile(scriptpath .. \"/_manifest.lua\")\nfor _,v in ipairs(scripts) do\ndofile(scriptpath .. \"/\" .. v)\nend\nend\npremake.action.set(_ACTION)\nmath.r"
diff --git a/tests/actions/vstudio/test_vs2010_filters.lua b/tests/actions/vstudio/test_vs2010_filters.lua
new file mode 100644
index 0000000..d4621ca
--- /dev/null
+++ b/tests/actions/vstudio/test_vs2010_filters.lua
@@ -0,0 +1,393 @@
+ T.vs2010_filters = { }
+ local vs10_filters = T.vs2010_filters
+
+
+
+ local sln, prj
+ function vs10_filters.setup()
+ _ACTION = "vs2010"
+ sln = solution "MySolution"
+ configurations { "Debug" }
+ platforms {}
+
+ prj = project "MyProject"
+ language "C++"
+ kind "ConsoleApp"
+ end
+
+ local function get_buffer()
+ io.capture()
+ premake.buildconfigs()
+ sln.vstudio_configs = premake.vstudio_buildconfigs(sln)
+ premake.vs2010_vcxproj_filters(prj)
+ buffer = io.endcapture()
+ return buffer
+ end
+
+ function vs10_filters.path_noPath_returnsNil()
+ local result = file_path("foo.h")
+ test.isequal(nil,result)
+ end
+
+ function vs10_filters.path_hasOneDirectoryPath_returnsIsFoo()
+ local path = "foo"
+ local result = file_path(path .."\\foo.h")
+ test.isequal(path,result)
+ end
+
+ function vs10_filters.path_hasTwoDirectoryPath_returnsIsFooSlashBar()
+ local path = "foo\\bar"
+ local result = file_path(path .."\\foo.h")
+ test.isequal(path,result)
+ end
+
+ function vs10_filters.path_hasTwoDirectoryPath_returnsIsFooSlashBar_Baz()
+ local path = "foo\\bar_baz"
+ local result = file_path(path .."\\foo.h")
+ test.isequal(path,result)
+ end
+
+ function vs10_filters.path_extensionWithHyphen_returnsIsFoo()
+ local path = "foo"
+ local result = file_path(path .."\\foo-bar.h")
+ test.isequal(path,result)
+ end
+
+ function vs10_filters.path_extensionWithNumber_returnsIs2Foo()
+ local path = "foo"
+ local result = file_path(path .."\\2foo.h")
+ test.isequal(path,result)
+ end
+
+ function vs10_filters.path_hasThreeDirectoryPath_returnsIsFooSlashBarSlashBaz()
+ local path = "foo\\bar\\baz"
+ local result = file_path(path .."\\foo.h")
+ test.isequal(path,result)
+ end
+
+ function vs10_filters.path_hasDotDotSlashDirectoryPath_returnsNil()
+ local path = ".."
+ local result = file_path(path .."\\foo.h")
+ test.isequal(nil,result)
+ end
+
+ function vs10_filters.removeRelativePath_noRelativePath_returnsInput()
+ local path = "foo.h"
+ local result = remove_relative_path(path)
+ test.isequal("foo.h",result)
+ end
+
+ function vs10_filters.removeRelativePath_dotDotSlashFoo_returnsFoo()
+ local path = "..\\foo"
+ local result = remove_relative_path(path)
+ test.isequal("foo",result)
+ end
+
+ function vs10_filters.removeRelativePath_dotDotSlashDotDotSlashFoo_returnsFoo()
+ local path = "..\\..\\foo"
+ local result = remove_relative_path(path)
+ test.isequal("foo",result)
+ end
+
+ function vs10_filters.removeRelativePath_DotSlashFoo_returnsFoo()
+ local path = ".\\foo"
+ local result = remove_relative_path(path)
+ test.isequal("foo",result)
+ end
+
+ function vs10_filters.listOfDirectories_passedNil_returnsIsEmpty()
+ local result = list_of_directories_in_path(nil)
+ test.isequal(0,#result)
+ end
+
+ function vs10_filters.listOfDirectories_oneDirectory_returnsSizeIsOne()
+ local result = list_of_directories_in_path("foo\\bar.h")
+ test.isequal(1,#result)
+ end
+
+ function vs10_filters.listOfDirectories_oneDirectory_returnsContainsFoo()
+ local result = list_of_directories_in_path("foo\\bar.h")
+ test.contains(result,"foo")
+ end
+
+ function vs10_filters.listOfDirectories_twoDirectories_returnsSizeIsTwo()
+ local result = list_of_directories_in_path("foo\\bar\\bar.h")
+ test.isequal(2,#result)
+ end
+
+ function vs10_filters.listOfDirectories_twoDirectories_secondEntryIsFooSlashBar()
+ local result = list_of_directories_in_path("foo\\bar\\bar.h")
+ test.isequal("foo\\bar",result[2])
+ end
+
+ function vs10_filters.tableOfFilters_emptyTable_returnsEmptyTable()
+ t = {}
+ local result = table_of_filters(t)
+ test.isequal(0,#result)
+ end
+
+ function vs10_filters.tableOfFilters_tableHasFilesYetNoDirectories_returnSizeIsZero()
+ t =
+ {
+ 'foo.h'
+ }
+ local result = table_of_filters(t)
+ test.isequal(0,#result)
+ end
+
+ function vs10_filters.tableOfFilters_tableHasOneDirectory_returnSizeIsOne()
+ t =
+ {
+ 'bar\\foo.h'
+ }
+ local result = table_of_filters(t)
+ test.isequal(1,#result)
+ end
+ function vs10_filters.tableOfFilters_tableHasTwoDirectories_returnSizeIsOne()
+ t =
+ {
+ 'bar\\foo.h',
+ 'baz\\foo.h'
+ }
+ local result = table_of_filters(t)
+ test.isequal(2,#result)
+ end
+ function vs10_filters.tableOfFilters_tableHasTwoDirectories_firstEntryIsBar()
+ t =
+ {
+ 'bar\\foo.h',
+ 'baz\\foo.h'
+ }
+ local result = table_of_filters(t)
+ test.isequal("bar",result[1])
+ end
+ function vs10_filters.tableOfFilters_tableHasTwoDirectories_secondEntryIsBaz()
+ t =
+ {
+ 'bar\\foo.h',
+ 'baz\\foo.h'
+ }
+ local result = table_of_filters(t)
+ test.isequal("baz",result[2])
+ end
+
+ function vs10_filters.tableOfFilters_tableHasTwoSameDirectories_returnSizeIsOne()
+ t =
+ {
+ 'bar\\foo.h',
+ 'bar\\baz.h'
+ }
+ local result = table_of_filters(t)
+ test.isequal(1,#result)
+ end
+
+ function vs10_filters.tableOfFilters_tableEntryHasTwoDirectories_returnSizeIsTwo()
+ t =
+ {
+ 'bar\\baz\\foo.h'
+ }
+ local result = table_of_filters(t)
+ test.isequal(2,#result)
+ end
+
+ function vs10_filters.tableOfFilters_tableEntryHasTwoDirectories_firstEntryIsBarSlashBar()
+ t =
+ {
+ 'bar\\baz\\foo.h'
+ }
+ local result = table_of_filters(t)
+ test.isequal('bar',result[1])
+ end
+
+ function vs10_filters.tableOfFilters_tableEntryHasTwoDirectories_secondEntryIsBarSlashBaz()
+ t =
+ {
+ 'bar\\baz\\foo.h'
+ }
+ local result = table_of_filters(t)
+ test.isequal('bar\\baz',result[2])
+ end
+
+
+ function vs10_filters.tableOfFilters_tableEntryHasTwoDirectoriesSecondDirisAlsoInNextEntry_returnSizeIsThree()
+ t =
+ {
+ 'bar\\baz\\foo.h',
+ 'baz\\foo.h'
+ }
+ local result = table_of_filters(t)
+ test.isequal(3,#result)
+ end
+
+ function vs10_filters.tableOfFileFilters_returnSizeIsTwo()
+ local t =
+ {
+ foo = {'foo\\bar.h'},
+ bar = {'foo\\bar.h'},
+ baz = {'baz\\bar.h'}
+ }
+ local result = table_of_file_filters(t)
+ test.isequal(2,#result)
+ end
+
+ function vs10_filters.tableOfFileFilters_returnContainsFoo()
+ local t =
+ {
+ foo = {'foo\\bar.h'},
+ bar = {'foo\\bar.h'},
+ baz = {'baz\\bar.h'}
+ }
+ local result = table_of_file_filters(t)
+ --order is not defined
+ test.contains(result,'foo')
+ end
+
+ function vs10_filters.tableOfFileFilters_returnContainsBaz()
+ local t =
+ {
+ foo = {'foo\\bar.h'},
+ bar = {'foo\\bar.h'},
+ baz = {'baz\\bar.h'}
+ }
+ local result = table_of_file_filters(t)
+ --order is not defined
+ test.contains(result,'baz')
+ end
+
+ function vs10_filters.tableOfFileFilters_returnSizeIsFour()
+ local t =
+ {
+ foo = {'foo\\bar.h'},
+ bar = {'foo\\bar\\bar.h'},
+ baz = {'bar\\bar.h'},
+ bazz = {'bar\\foo\\bar.h'}
+ }
+ local result = table_of_file_filters(t)
+ --order is not defined
+ test.isequal(4,#result)
+ end
+
+ function vs10_filters.tableOfFileFilters_tableHasSubTableWithTwoEntries_returnSizeIsTwo()
+ local t =
+ {
+ foo = {'foo\\bar.h','foo\\bar\\bar.h'}
+ }
+ local result = table_of_file_filters(t)
+ --order is not defined
+ test.isequal(2,#result)
+ end
+
+
+ function vs10_filters.noInputFiles_bufferDoesNotContainTagFilter()
+ local buffer = get_buffer()
+ test.string_does_not_contain(buffer,"<Filter")
+ end
+
+ function vs10_filters.noInputFiles_bufferDoesNotContainTagItemGroup()
+ local buffer = get_buffer()
+ test.string_does_not_contain(buffer,"<ItemGroup>")
+ end
+
+ function vs10_filters.oneInputFileYetNoDirectory_bufferDoesNotContainTagFilter()
+ files
+ {
+ "dontCare.h"
+ }
+ local buffer = get_buffer()
+ test.string_does_not_contain(buffer,"<Filter")
+ end
+
+ function vs10_filters.oneInputFileWithDirectory_bufferContainsTagFilter()
+ files
+ {
+ "dontCare\\dontCare.h"
+ }
+ local buffer = get_buffer()
+ test.string_contains(buffer,"<Filter")
+ end
+
+ function vs10_filters.oneInputFileWithDirectory_bufferContainsTagFilterInsideItemGroupTag()
+ files
+ {
+ "dontCare\\dontCare.h"
+ }
+ local buffer = get_buffer()
+ test.string_contains(buffer,"<ItemGroup>.*<Filter.*</Filter>.*</ItemGroup>")
+ end
+
+ function vs10_filters.oneInputFileWithDirectory_bufferContainsTagFilterWithIncludeSetToFoo()
+ files
+ {
+ "foo\\dontCare.h"
+ }
+ local buffer = get_buffer()
+ test.string_contains(buffer,'<Filter Include="foo">')
+ end
+
+ function vs10_filters.clIncludeFilter_oneInputFile_bufferContainsTagClInclude()
+ files
+ {
+ "dontCare.h"
+ }
+ local buffer = get_buffer()
+ test.string_contains(buffer,'<ClInclude')
+ end
+
+ function vs10_filters.clIncludeFilter_oneInputFileWithoutDirectory_bufferContainsTagClIncludeOnOneLine()
+ files
+ {
+ "foo.h"
+ }
+ local buffer = get_buffer()
+ test.string_contains(buffer,'<ClInclude Include="foo.h" />')
+ end
+
+ function vs10_filters.clCompileFilter_oneInputFile_bufferContainsTagClCompile()
+ files
+ {
+ "dontCare.cpp"
+ }
+ local buffer = get_buffer()
+ test.string_contains(buffer,'<ClCompile')
+ end
+
+ function vs10_filters.noneFilter_oneInputFile_bufferContainsTagClCompile()
+ files
+ {
+ "dontCare.ext"
+ }
+ local buffer = get_buffer()
+ test.string_contains(buffer,'<None')
+ end
+
+
+ function vs10_filters.tableOfFileFilters_filterContainsDots_bufferContainsTheEntry()
+ t =
+ {
+ 'bar\\baz\\foo.bar.h'
+ }
+ local result = table_of_filters(t)
+ test.isequal(2,#result)
+ end
+ function vs10_filters.tableOfFileFilters_filterContainsDots_resultsLengthIsThree()
+ t =
+ {
+ foo = {'src\\host\\lua-5.1.4\\foo.h'}
+ }
+ local result = table_of_file_filters(t)
+ test.isequal(3,#result)
+ end
+
+ function vs10_filters.tableOfFileFilters_filterContainsDots_resultContainsTheEntry()
+ t =
+ {
+ foo = {'src\\host\\lua-5.1.4\\foo.h'}
+ }
+ local result = table_of_file_filters(t)
+ test.contains(result,'src\\host\\lua-5.1.4')
+ end
+
+ function vs10_filters.listOfDirectories_filterContainsDots_resultContainsTheEntry()
+ local result = list_of_directories_in_path('src\\host\\lua.4\\foo.h')
+ test.contains(result,'src\\host\\lua.4')
+ end
diff --git a/tests/actions/vstudio/test_vs2010_flags.lua b/tests/actions/vstudio/test_vs2010_flags.lua
new file mode 100644
index 0000000..258ef25
--- /dev/null
+++ b/tests/actions/vstudio/test_vs2010_flags.lua
@@ -0,0 +1,253 @@
+
+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>Dynamic</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
+
+
+function vs10_flags.programDataBaseFile()
+ buffer = get_buffer()
+ test.string_contains(buffer,'<Link>.*<ProgramDataBaseFileName>%$%(OutDir%)MyProject%.pdb</ProgramDataBaseFileName>.*</Link>')
+end
+
+
+
diff --git a/tests/actions/vstudio/test_vs2010_links.lua b/tests/actions/vstudio/test_vs2010_links.lua
new file mode 100644
index 0000000..0d6b128
--- /dev/null
+++ b/tests/actions/vstudio/test_vs2010_links.lua
@@ -0,0 +1,143 @@
+ T.vs2010_links = { }
+ local vs10_links = T.vs2010_links
+ local sln, prj
+
+ function vs10_links.setup()
+ _ACTION = "vs2010"
+
+ sln = solution "MySolution"
+ configurations { "Debug" }
+ platforms {}
+
+ prj = project "MyProject"
+ language "C++"
+ kind "ConsoleApp"
+ uuid "AE61726D-187C-E440-BD07-2556188A6565"
+ 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_links.hasLinkBlock()
+ local buffer = get_buffer()
+ test.string_contains(buffer,'<Link>.*</Link>')
+ end
+
+ function vs10_links.additionalDependancies_isInsideLinkBlock()
+ configuration("Debug")
+ links{"link_test"}
+ local buffer = get_buffer()
+ test.string_contains(buffer,
+ '<Link>.*<AdditionalDependencies>.*%%%(AdditionalDependencies%)</AdditionalDependencies>.*</Link>')
+ end
+
+ function vs10_links.additionalDependancies_containsLinkTestDotLib()
+ configuration("Debug")
+ links{"link_test"}
+ local buffer = get_buffer()
+ test.string_contains(buffer,
+ '<AdditionalDependencies>link_test%.lib;%%%(AdditionalDependencies%)</AdditionalDependencies>')
+ end
+
+ function vs10_links.outPutFile_isEqualToOutDirMyProjectDotExe()
+ local buffer = get_buffer()
+ test.string_contains(buffer,'<OutputFile>%$%(OutDir%)MyProject.exe</OutputFile>')
+ end
+
+ function vs10_links.additionalLibraryDirectories_inputNoDirectories_tagsAreEmpty()
+ local buffer = get_buffer()
+ test.string_contains(buffer,
+ '<AdditionalLibraryDirectories>%%%(AdditionalLibraryDirectories%)</AdditionalLibraryDirectories>')
+ end
+
+ function vs10_links.additionalLibraryDirectories_inputTestPath_tagsContainExspectedValue()
+ configuration("Debug")
+ libdirs { "test_path" }
+ local buffer = get_buffer()
+ local exspect = "test_path;"
+ test.string_contains(buffer,
+ '<AdditionalLibraryDirectories>'..exspect..'%%%(AdditionalLibraryDirectories%)</AdditionalLibraryDirectories>')
+ end
+
+ function vs10_links.additionalLibraryDirectories_inputTwoPaths_tagsContainExspectedValue()
+ configuration("Debug")
+ libdirs { "test_path","another_path" }
+ local buffer = get_buffer()
+ local exspect = "test_path;another_path;"
+ test.string_contains(buffer,
+ '<AdditionalLibraryDirectories>'..exspect..'%%%(AdditionalLibraryDirectories%)</AdditionalLibraryDirectories>')
+ end
+
+ function vs10_links.generateDebugInformation_withoutSymbolsFlag_valueInTagsIsFalse()
+ local buffer = get_buffer()
+ test.string_contains(buffer,'<GenerateDebugInformation>false</GenerateDebugInformation>')
+ end
+
+ function vs10_links.generateDebugInformation_withSymbolsFlag_valueInTagsIsTrue()
+ flags {"Symbols"}
+ local buffer = get_buffer()
+ test.string_contains(buffer,'<GenerateDebugInformation>true</GenerateDebugInformation>')
+ end
+
+
+ function vs10_links.noOptimiseFlag_optimizeReferences_isNotInBuffer()
+ local buffer = get_buffer()
+ test.string_does_not_contain(buffer,'OptimizeReferences')
+ end
+
+ function vs10_links.noOptimiseFlag_enableCOMDATFolding_isNotInBuffer()
+ local buffer = get_buffer()
+ test.string_does_not_contain(buffer,'EnableCOMDATFolding')
+ end
+
+ function vs10_links.optimiseFlag_optimizeReferences_valueInsideTagsIsTrue()
+ flags{"Optimize"}
+ local buffer = get_buffer()
+ test.string_contains(buffer,'<OptimizeReferences>true</OptimizeReferences>')
+ end
+
+ function vs10_links.noOptimiseFlag_enableCOMDATFolding_valueInsideTagsIsTrue()
+ flags{"Optimize"}
+ local buffer = get_buffer()
+ test.string_contains(buffer,'EnableCOMDATFolding>true</EnableCOMDATFolding')
+ end
+
+ function vs10_links.entryPointSymbol_noWimMainFlag_valueInTagsIsMainCrtStartUp()
+ local buffer = get_buffer()
+ test.string_contains(buffer,'<EntryPointSymbol>mainCRTStartup</EntryPointSymbol>')
+ end
+
+ function vs10_links.entryPointSymbol_noWimMainFlag_valueInTagsIsMainCrtStartUp()
+ local buffer = get_buffer()
+ test.string_contains(buffer,'<EntryPointSymbol>mainCRTStartup</EntryPointSymbol>')
+ end
+
+ function vs10_links.entryPointSymbol_winMainFlag_doesNotContainEntryPointSymbol()
+ flags{"WinMain"}
+ local buffer = get_buffer()
+ test.string_does_not_contain(buffer,'<EntryPointSymbol>')
+ end
+
+ function vs10_links.targetMachine_default_valueInTagsIsMachineX86()
+ local buffer = get_buffer()
+ test.string_contains(buffer,'<TargetMachine>MachineX86</TargetMachine>')
+ end
+
+ function vs10_links.targetMachine_x32_valueInTagsIsMachineX64()
+ platforms {"x32"}
+ local buffer = get_buffer()
+ test.string_contains(buffer,'<TargetMachine>MachineX86</TargetMachine>')
+ end
+
+ function vs10_links.targetMachine_x64_valueInTagsIsMachineX64()
+ platforms {"x64"}
+ local buffer = get_buffer()
+ test.string_contains(buffer,'<TargetMachine>MachineX64</TargetMachine>')
+ end
+ \ No newline at end of file
diff --git a/tests/actions/vstudio/test_vs2010_project_kinds.lua b/tests/actions/vstudio/test_vs2010_project_kinds.lua
new file mode 100644
index 0000000..0a19b49
--- /dev/null
+++ b/tests/actions/vstudio/test_vs2010_project_kinds.lua
@@ -0,0 +1,154 @@
+ T.vs2010_project_kinds= { }
+ local vs10_project_kinds = T.vs2010_project_kinds
+ local sln, prj
+
+ function vs10_project_kinds.setup()
+ _ACTION = "vs2010"
+
+ sln = solution "MySolution"
+ configurations { "Debug" }
+ platforms {}
+
+ prj = project "MyProject"
+ language "C++"
+ 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
+ --incorrect assumption
+ --[[
+ function vs10_project_kinds.staticLib_doesNotContainLinkSection()
+ kind "StaticLib"
+ local buffer = get_buffer()
+ test.string_does_not_contain(buffer,'<Link>.*</Link>')
+ end
+ --]]
+
+ function vs10_project_kinds.staticLib_containsLibSection()
+ kind "StaticLib"
+ local buffer = get_buffer()
+ test.string_contains(buffer,'<ItemDefinitionGroup.*<Lib>.*</Lib>.*</ItemDefinitionGroup>')
+ end
+ function vs10_project_kinds.staticLib_libSection_containsProjectNameDotLib()
+ kind "StaticLib"
+ local buffer = get_buffer()
+ test.string_contains(buffer,'<Lib>.*<OutputFile>.*MyProject.lib.*</OutputFile>.*</Lib>')
+ end
+ --[[
+ function vs10_project_kinds.sharedLib_fail_asIDoNotKnowWhatItShouldLookLike_printsTheBufferSoICanCompare()
+ kind "SharedLib"
+ local buffer = get_buffer()
+ test.string_contains(buffer,'youWillNotFindThis')
+ end
+ --]]
+
+ --[[
+check OutDir in debug it is showing "."
+shared lib missing <ImportLibrary>???</ImportLibrary> in link section when noInportLib not used
+ --]]
+ --check why <MinimalRebuild>true</MinimalRebuild> is missing in a debug static lib and shared lib build
+ function vs10_project_kinds.staticLib_valueInMinimalRebuildIsTrue()
+ kind "StaticLib"
+ flags {"Symbols"}
+ local buffer = get_buffer()
+ test.string_contains(buffer,'<ClCompile>.*<MinimalRebuild>true</MinimalRebuild>.*</ClCompile>')
+ end
+ function vs10_project_kinds.sharedLib_valueInMinimalRebuildIsTrue()
+ kind "SharedLib"
+ flags {"Symbols"}
+ local buffer = get_buffer()
+ test.string_contains(buffer,'<ClCompile>.*<MinimalRebuild>true</MinimalRebuild>.*</ClCompile>')
+ end
+ --shared lib missing <DebugInformationFormat>EditAndContinue</DebugInformationFormat> in ClCompile section
+ function vs10_project_kinds.sharedLib_valueDebugInformationFormatIsEditAndContinue()
+ kind "SharedLib"
+ flags {"Symbols"}
+ local buffer = get_buffer()
+ test.string_contains(buffer,'<ClCompile>.*<DebugInformationFormat>EditAndContinue</DebugInformationFormat>.*</ClCompile>')
+ end
+ function vs10_project_kinds.sharedLib_valueGenerateDebugInformationIsTrue()
+ kind "SharedLib"
+ flags {"Symbols"}
+ local buffer = get_buffer()
+ test.string_contains(buffer,'<Link>.*<GenerateDebugInformation>true</GenerateDebugInformation>.*</Link>')
+ end
+ function vs10_project_kinds.sharedLib_linkSectionContainsImportLibrary()
+ kind "SharedLib"
+ local buffer = get_buffer()
+ test.string_contains(buffer,'<Link>.*<ImportLibrary>.*</ImportLibrary>.*</Link>')
+ end
+
+ function vs10_project_kinds.sharedLib_bufferContainsImportLibrary()
+ kind "SharedLib"
+ local buffer = get_buffer()
+ test.string_contains(buffer,'<Link>.*<ImportLibrary>MyProject.lib</ImportLibrary>.*</Link>')
+ end
+ --should this go in vs2010_flags???
+
+ function vs10_project_kinds.sharedLib_withNoImportLibraryFlag_linkSectionContainsImportLibrary()
+ kind "SharedLib"
+ flags{"NoImportLib"}
+ local buffer = get_buffer()
+ test.string_contains(buffer,'<Link>.*<ImportLibrary>.*</ImportLibrary>.*</Link>')
+ end
+
+ function vs10_project_kinds.sharedLib_withOutNoImportLibraryFlag_propertyGroupSectionContainsIgnoreImportLibrary()
+ kind "SharedLib"
+ local buffer = get_buffer()
+ test.string_contains(buffer,'<PropertyGroup>.*<IgnoreImportLibrary.*</IgnoreImportLibrary>.*</PropertyGroup>')
+ end
+
+ function vs10_project_kinds.sharedLib_withNoImportLibraryFlag_propertyGroupSectionContainsIgnoreImportLibrary()
+ kind "SharedLib"
+ flags{"NoImportLib"}
+ local buffer = get_buffer()
+ test.string_contains(buffer,'<PropertyGroup>.*<IgnoreImportLibrary.*</IgnoreImportLibrary>.*</PropertyGroup>')
+ end
+
+ function vs10_project_kinds.sharedLib_withOutNoImportLibraryFlag_ignoreImportLibraryValueIsFalse()
+ kind "SharedLib"
+ local buffer = get_buffer()
+ test.string_contains(buffer,'<PropertyGroup>.*<IgnoreImportLibrary.*false</IgnoreImportLibrary>.*</PropertyGroup>')
+ end
+
+ function vs10_project_kinds.sharedLib_withNoImportLibraryFlag_ignoreImportLibraryValueIsTrue()
+ kind "SharedLib"
+ flags{"NoImportLib"}
+ local buffer = get_buffer()
+ test.string_contains(buffer,'<PropertyGroup>.*<IgnoreImportLibrary.*true</IgnoreImportLibrary>.*</PropertyGroup>')
+ end
+
+ --shared lib LinkIncremental set to incorrect value of false
+ function vs10_project_kinds.staticLib_doesNotContainLinkIncremental()
+ kind "StaticLib"
+ flags {"Symbols"}
+ local buffer = get_buffer()
+ test.string_does_not_contain(buffer,'<LinkIncremental.*</LinkIncremental>')
+ end
+
+ function vs10_project_kinds.sharedLib_withoutOptimisation_linkIncrementalValueIsTrue()
+ kind "SharedLib"
+ local buffer = get_buffer()
+ test.string_contains(buffer,'<LinkIncremental.*true</LinkIncremental>')
+ end
+
+ function vs10_project_kinds.sharedLib_withOptimisation_linkIncrementalValueIsFalse()
+ kind "SharedLib"
+ flags{"Optimize"}
+ local buffer = get_buffer()
+ test.string_contains(buffer,'<LinkIncremental.*false</LinkIncremental>')
+ end
+
+ --check all configs %(AdditionalIncludeDirectories) missing before AdditionalIncludeDirectories end tag in ClCompile
+ function vs10_project_kinds.kindDoesNotMatter_noAdditionalDirectoriesSpecified_bufferDoesNotContainAdditionalIncludeDirectories()
+ kind "SharedLib"
+ local buffer = get_buffer()
+ test.string_does_not_contain(buffer,'<ClCompile>.*<AdditionalIncludeDirectories>.*</ClCompile>')
+ end
+ \ No newline at end of file
diff --git a/tests/actions/vstudio/test_vs2010_vcxproj.lua b/tests/actions/vstudio/test_vs2010_vcxproj.lua
new file mode 100644
index 0000000..3ba584a
--- /dev/null
+++ b/tests/actions/vstudio/test_vs2010_vcxproj.lua
@@ -0,0 +1,355 @@
+ T.vs2010_vcxproj = { }
+ local vs10_vcxproj = T.vs2010_vcxproj
+ 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"
+
+ sln = solution "MySolution"
+ configurations { "Debug", "Release" }
+ platforms {}
+
+ prj = project "MyProject"
+ language "C++"
+ kind "ConsoleApp"
+ uuid "AE61726D-187C-E440-BD07-2556188A6565"
+
+ includedirs
+ {
+ include_directory,
+ include_directory2
+ }
+ files
+ {
+ "foo/dummyHeader.h",
+ "foo/dummySource.cpp",
+ "../src/host/*h",
+ "../src/host/*.c"
+ }
+
+ configuration("Release")
+ flags {"Optimize"}
+ links{"foo","bar"}
+
+ configuration("Debug")
+ defines {debug_define}
+ links{"foo_d"}
+
+
+ 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_vcxproj.xmlDeclarationPresent()
+ buffer = get_buffer()
+ test.istrue(string.startswith(buffer, '<?xml version=\"1.0\" encoding=\"utf-8\"?>'))
+ end
+
+ function vs10_vcxproj.projectBlocksArePresent()
+ buffer = get_buffer()
+ test.string_contains(buffer,'<Project.*</Project>')
+ end
+
+ function vs10_vcxproj.projectOpenTagIsCorrect()
+ buffer = get_buffer()
+ test.string_contains(buffer,'<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">.*</Project>')
+ end
+
+ function vs10_vcxproj.configItemGroupPresent()
+ buffer = get_buffer()
+ test.string_contains(buffer,'<ItemGroup Label="ProjectConfigurations">.*</ItemGroup>')
+ end
+
+ function vs10_vcxproj.configBlocksArePresent()
+ buffer = get_buffer()
+ test.string_contains(buffer,'<ProjectConfiguration.*</ProjectConfiguration>')
+ end
+
+ function vs10_vcxproj.configTypeBlockPresent()
+ buffer = get_buffer()
+ test.string_contains(buffer,'<PropertyGroup Condition="\'%$%(Configuration%)|%$%(Platform%)\'==\'.*\'" Label="Configuration">.*</PropertyGroup>')
+ end
+
+ function vs10_vcxproj.twoConfigTypeBlocksPresent()
+ buffer = get_buffer()
+ test.string_contains(buffer,'<PropertyGroup Condition.*</PropertyGroup>.*<PropertyGroup Condition=.*</PropertyGroup>')
+ end
+
+ function vs10_vcxproj.propsDefaultForCppProjArePresent()
+ buffer = get_buffer()
+ test.string_contains(buffer,'<Import Project="$%(VCTargetsPath%)\\Microsoft.Cpp.Default.props" />')
+ end
+
+
+ function vs10_vcxproj.propsForCppProjArePresent()
+ buffer = get_buffer()
+ test.string_contains(buffer,'<Import Project="%$%(VCTargetsPath%)\\Microsoft.Cpp.props" />')
+ end
+
+ function vs10_vcxproj.extensionSettingArePresent()
+ buffer = get_buffer()
+ test.string_contains(buffer,'<ImportGroup Label="ExtensionSettings">.*</ImportGroup>')
+ end
+
+ 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()
+ buildoptions {"/Gm"}
+ buffer = get_buffer()
+ test.string_contains(buffer,'<AdditionalOptions>/Gm %%%(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
+
+ function vs10_vcxproj.hasItemGroupSection()
+ buffer = get_buffer()
+ test.string_contains(buffer,'<ItemGroup>.*</ItemGroup>')
+ end
+
+ function vs10_vcxproj.fileExtension_extEqualH()
+ local ext = get_file_extension('foo.h')
+ test.isequal('h', ext)
+ end
+
+ function vs10_vcxproj.fileExtension_containsTwoDots_extEqualH()
+ local ext = get_file_extension('foo.bar.h')
+ test.isequal('h', ext)
+ end
+
+ function vs10_vcxproj.fileExtension_alphaNumeric_extEqualOneH()
+ local ext = get_file_extension('foo.1h')
+ test.isequal('1h', ext)
+ end
+
+ function vs10_vcxproj.fileExtension_alphaNumericWithUnderscore_extEqualOne_H()
+ local ext = get_file_extension('foo.1_h')
+ test.isequal('1_h', ext)
+ end
+
+ function vs10_vcxproj.fileExtension_containsHyphen_extEqualHHyphenH()
+ local ext = get_file_extension('foo.h-h')
+ test.isequal('h-h', ext)
+ end
+
+ function vs10_vcxproj.fileExtension_containsMoreThanOneDot_extEqualOneH()
+ local ext = get_file_extension('foo.bar.h')
+ test.isequal('h', ext)
+ end
+
+ local function SortAndReturnSortedInputFiles(input)
+ local sorted =
+ {
+ ClInclude ={},
+ ClCompile ={},
+ None ={}
+ }
+ sort_input_files(input,sorted)
+ return sorted
+ end
+ function vs10_vcxproj.sortFile_headerFile_SortedClIncludeEqualToFile()
+ local file = {"bar.h"}
+ local sorted = SortAndReturnSortedInputFiles(file)
+ test.isequal(file, sorted.ClInclude)
+ end
+
+ function vs10_vcxproj.sortFile_srcFile_SortedClCompileEqualToFile()
+ local file = {"b.cxx"}
+ local sorted = SortAndReturnSortedInputFiles(file)
+ test.isequal(file, sorted.ClCompile)
+ end
+
+ function vs10_vcxproj.sortFile_notRegistered_SortedNoneEqualToFile()
+ local file = {"foo.bar.00h"}
+ local sorted = SortAndReturnSortedInputFiles(file)
+ test.isequal(file, sorted.None)
+ end
+
+ function vs10_vcxproj.itemGroupSection_hasHeaderListed()
+ buffer = get_buffer()
+ test.string_contains(buffer,'<ItemGroup>.*<ClInclude Include="foo\\dummyHeader%.h" />.*</ItemGroup>')
+ end
+
+ function vs10_vcxproj.checkProjectConfigurationOpeningTag_hasACloseingAngleBracket()
+ local buffer = get_buffer()
+ test.string_contains(buffer,'<ProjectConfiguration Include="Debug|Win32">')
+ end
+
+ function vs10_vcxproj.postBuildEvent_isPresent()
+ postbuildcommands { "doSomeThing" }
+ local buffer = get_buffer()
+ test.string_contains(buffer,'<PostBuildEvent>.*<Command>.*</Command>.*</PostBuildEvent>')
+ end
+
+ function vs10_vcxproj.postBuildEvent_containsCorrectInformationBetweenCommandTag()
+ postbuildcommands { "doSomeThing" }
+ local buffer = get_buffer()
+ test.string_contains(buffer,'<PostBuildEvent>.*<Command>doSomeThing</Command>.*</PostBuildEvent>')
+ end
+
+ function vs10_vcxproj.postBuildEvent_eventEncloseByQuotes_containsCorrectInformationBetweenCommandTag()
+ postbuildcommands { "\"doSomeThing\"" }
+ local buffer = get_buffer()
+ test.string_contains(buffer,'<PostBuildEvent>.*<Command>&quot;doSomeThing&quot;</Command>.*</PostBuildEvent>')
+ end
+
+ function vs10_vcxproj.outDir_directorySuppliedIsNotSlashPostFixed_bufferContainsOutDirSlashPostFixed()
+ targetdir("dir")
+ local buffer = get_buffer()
+ test.string_contains(buffer,'<OutDir Condition="\'%$%(Configuration%)|%$%(Platform%)\'==\.*\'">dir\\</OutDir>')
+ end
+ --postfixed directory slashes are removed by default
+ --yet these following two tests are to ensure if this behaviour is changed they will fail
+ function vs10_vcxproj.outDir_directorySuppliedWhichIsForwardSlashPostFixed_bufferContainsOutDirSlashPostFixed()
+ targetdir("dir/")
+ local buffer = get_buffer()
+ test.string_contains(buffer,'<OutDir Condition="\'%$%(Configuration%)|%$%(Platform%)\'==\.*\'">dir\\</OutDir>')
+ end
+
+ function vs10_vcxproj.outDir_directorySuppliedWhichIsWindowsSlashPostFixed_bufferContainsOutDirSlashPostFixed()
+ targetdir("dir\\")
+ local buffer = get_buffer()
+ test.string_contains(buffer,'<OutDir Condition="\'%$%(Configuration%)|%$%(Platform%)\'==\.*\'">dir\\</OutDir>')
+ end
+
+ function vs10_vcxproj.objectDir_directorySuppliedIsNotSlashPostFixed_bufferContainsIntermediateDirSlashPostFixed()
+ objdir ("dir")
+
+ local buffer = get_buffer()
+ test.string_contains(buffer,'<IntDir Condition="\'%$%(Configuration%)|%$%(Platform%)\'==\'.*\'">dir\\</IntDir>')
+ end
+
+ --postfixed directory slashes are removed by default
+ --yet these following two tests are to ensure if this behaviour is changed they will fail
+ function vs10_vcxproj.objectDir_directorySuppliedWhichIsSlashPostFixed_bufferContainsIntermediateDirSlashPostFixed()
+ objdir ("dir/")
+ local buffer = get_buffer()
+ test.string_contains(buffer,'<IntDir Condition="\'%$%(Configuration%)|%$%(Platform%)\'==\'.*\'">dir\\</IntDir>')
+ end
+
+ function vs10_vcxproj.objectDir_directorySuppliedWhichIsWindowsSlashPostFixed_bufferContainsIntermediateDirSlashPostFixed()
+ objdir ("dir\\")
+ local buffer = get_buffer()
+ test.string_contains(buffer,'<IntDir Condition="\'%$%(Configuration%)|%$%(Platform%)\'==\'.*\'">dir\\</IntDir>')
+ end
+ function vs10_vcxproj.targetName()
+ configuration("Debug")
+ targetname ("foo_d")
+ local buffer = get_buffer()
+ test.string_contains(buffer,'<TargetName Condition="\'%$%(Configuration%)|%$%(Platform%)\'==\'Debug|Win32\'">foo_d</TargetName>')
+ end
+
+ function vs10_vcxproj.noExtraWarnings_bufferDoesNotContainSmallerTypeCheck()
+ local buffer = get_buffer()
+ test.string_does_not_contain(buffer,'<SmallerTypeCheck>')
+ end
+
+ function vs10_vcxproj.debugAndExtraWarnings_bufferContainsSmallerTypeCheck()
+ configuration("Debug")
+ flags {"ExtraWarnings"}
+ local buffer = get_buffer()
+ test.string_contains(buffer,'<SmallerTypeCheck>true</SmallerTypeCheck>')
+ end
+
+ function vs10_vcxproj.releaseAndExtraWarnings_bufferDoesNotContainSmallerTypeCheck()
+ configuration("Release")
+ flags {"ExtraWarnings"}
+ local buffer = get_buffer()
+ test.string_does_not_contain(buffer,'<SmallerTypeCheck>')
+ end
+
+ function vs10_vcxproj.onlyOneProjectConfigurationBlockWhenMultipleConfigs()
+ local buffer = get_buffer()
+ test.string_does_not_contain(buffer,'<ItemGroup Label="ProjectConfigurations">.*<ItemGroup Label="ProjectConfigurations">')
+ end
+
+ function vs10_vcxproj.languageC_bufferContainsCompileAsC()
+ language "C"
+ local buffer = get_buffer()
+ test.string_contains(buffer,'<CompileAs>CompileAsC</CompileAs>')
+ end
+ \ No newline at end of file
diff --git a/tests/premake4.lua b/tests/premake4.lua
index ff89d37..c852ba8 100644
--- a/tests/premake4.lua
+++ b/tests/premake4.lua
@@ -63,8 +63,14 @@
dofile("test_vs2003_sln.lua")
dofile("test_vs2005_sln.lua")
dofile("test_vs2008_sln.lua")
+ dofile("test_vs2010_sln.lua")
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")
+ dofile("actions/vstudio/test_vs2010_links.lua")
+ dofile("actions/vstudio/test_vs2010_filters.lua")
+ dofile("actions/vstudio/test_vs2010_project_kinds.lua")
-- Xcode tests
dofile("actions/xcode/test_xcode_common.lua")
diff --git a/tests/test.bat b/tests/test.bat
new file mode 100644
index 0000000..d39aba0
--- /dev/null
+++ b/tests/test.bat
@@ -0,0 +1,2 @@
+
+CALL ..\\bin\\debug\\premake4 /scripts=..\\src test \ No newline at end of file
diff --git a/tests/test_vs2010_sln.lua b/tests/test_vs2010_sln.lua
new file mode 100644
index 0000000..e690f6d
--- /dev/null
+++ b/tests/test_vs2010_sln.lua
@@ -0,0 +1,118 @@
+ T.vs2010_sln = { }
+
+local vs_magic_cpp_build_tool_id = "8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942"
+local constant_uuid = "AE61726D-187C-E440-BD07-2556188A6565"
+local constant_project_name = "MyProject"
+--
+-- Configure a solution for testing
+--
+
+ local sln
+ function T.vs2010_sln.setup()
+ _ACTION = "vs2010"
+
+ sln = solution "MySolution"
+ configurations { "Debug", "Release" }
+ platforms {}
+
+ prj = project(constant_project_name)
+ language "C++"
+ kind "ConsoleApp"
+ uuid(constant_uuid)
+
+ premake.buildconfigs()
+ end
+
+ local function escape_id(str)
+ return string.gsub(str,"%-+","%%%-")
+ end
+
+ local function assert_has_project(buffer,uid,name,ext)
+ test.string_contains(buffer,"Project(\"{"..escape_id(vs_magic_cpp_build_tool_id).."}\") = \""..name.."\", \""..name.."."..ext.."\", \"{"..escape_id(uid).."}\"")
+ end
+
+
+
+ local function assert_find_uuid(buffer,id)
+ test.string_contains(buffer,escape_id(id))
+ end
+
+ local function get_buffer()
+ io.capture()
+ premake.vs_generic_solution(sln)
+ buffer = io.endcapture()
+ return buffer
+ end
+
+ function T.vs2010_sln.action_formatVersionis11()
+ local buffer = get_buffer()
+ test.string_contains(buffer,'Format Version 11.00')
+ end
+
+ function T.vs2010_sln.action_vsIs2010()
+ local buffer = get_buffer()
+ test.string_contains(buffer,'# Visual Studio 2010')
+ end
+
+ function T.vs2010_sln.action_hasProjectScope()
+ local buffer = get_buffer()
+ test.string_contains(buffer,"Project(.*)EndProject")
+ end
+
+ function T.vs2010_sln.containsVsCppMagicId()
+ local buffer = get_buffer()
+ assert_find_uuid(buffer,vs_magic_cpp_build_tool_id)
+ end
+
+ function T.vs2010_sln.action_findMyProjectID()
+ local buffer = get_buffer()
+ test.string_contains(buffer,escape_id(constant_uuid))
+ end
+
+ function T.vs2010_sln.action_findsExtension()
+ local buffer = get_buffer()
+ test.string_contains(buffer,".vcxproj")
+ end
+
+ function T.vs2010_sln.action_hasGlobalStartBlock()
+ local buffer = get_buffer()
+ test.string_contains(buffer,"Global")
+ end
+
+ function T.vs2010_sln.action_hasGlobalEndBlock()
+ local buffer = get_buffer()
+ test.string_contains(buffer,"EndGlobal")
+ end
+
+ function T.vs2010_sln.BasicLayout()
+ io.capture()
+ premake.vs_generic_solution(sln)
+ test.capture ('\239\187\191' .. [[
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MyProject", "MyProject.vcxproj", "{AE61726D-187C-E440-BD07-2556188A6565}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {AE61726D-187C-E440-BD07-2556188A6565}.Debug|Win32.ActiveCfg = Debug|Win32
+ {AE61726D-187C-E440-BD07-2556188A6565}.Debug|Win32.Build.0 = Debug|Win32
+ {AE61726D-187C-E440-BD07-2556188A6565}.Release|Win32.ActiveCfg = Release|Win32
+ {AE61726D-187C-E440-BD07-2556188A6565}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
+ ]])
+ end
+
+
+
+
+
+
diff --git a/tests/testfx.lua b/tests/testfx.lua
index 55fbb0b..4696878 100644
--- a/tests/testfx.lua
+++ b/tests/testfx.lua
@@ -15,6 +15,17 @@
--
-- Assertion functions
--
+ function test.string_contains(buffer, expected)
+ if not string.find(buffer,expected) then
+ test.fail("\n==Fail==: Expected to find :\n%s\nyet it was not found in buffer:\n%s\n", expected,buffer)
+ 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()
diff --git a/todo.txt b/todo.txt
new file mode 100644
index 0000000..246e98d
--- /dev/null
+++ b/todo.txt
@@ -0,0 +1,21 @@
+
+
+add support for flags: Managed, Unsafe
+support C
+support Managed C++
+support C#
+
+
+ MFC support added which sets <UseOfMfc>Dynamic</UseOfMfc>
+
+
+ Should the project define DEBUG and NDEBUG depending on if debugging info is on??
+
+ look at ResourceCompile
+ why are the preprocessor and include dir repeated?
+
+
+ dll add the following when required
+ <Link>
+ <NoEntryPoint>true</NoEntryPoint>
+ </Link> \ No newline at end of file