From 375e4fafa753b065253fe2854172a87e95f4f97e Mon Sep 17 00:00:00 2001 From: LiamDevine Date: Thu, 10 Jun 2010 16:42:45 +0100 Subject: [PATCH 01/19] vs2010 sln --- src/_manifest.lua | 2 + src/actions/vstudio/_vstudio.lua | 36 ++++++ src/actions/vstudio/vs_generic_solution.lua | 66 +++++++++++ tests/premake4.lua | 2 + tests/test.bat | 2 + tests/test_vs2010_sln.lua | 118 ++++++++++++++++++++ tests/testfx.lua | 5 + 7 files changed, 231 insertions(+) create mode 100644 src/actions/vstudio/vs_generic_solution.lua create mode 100644 tests/test.bat create mode 100644 tests/test_vs2010_sln.lua diff --git a/src/_manifest.lua b/src/_manifest.lua index f0007bf3..4ae99f4e 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/vstudio/_vstudio.lua b/src/actions/vstudio/_vstudio.lua index 863e8ca3..6ba39af0 100644 --- a/src/actions/vstudio/_vstudio.lua +++ b/src/actions/vstudio/_vstudio.lua @@ -259,6 +259,8 @@ local extension if (prj.language == "C#") then extension = ".csproj" + elseif (_ACTION == "vs2010" and prj.language == "C++" )then + extension = ".vcxproj" else extension = ".vcproj" end @@ -418,3 +420,37 @@ oncleanproject = premake.vstudio.cleanproject, oncleantarget = premake.vstudio.cleantarget } + + + local function ignore() + end + + newaction + { + trigger = "vs2010", + shortname = "Visual Studio 2010", + description = "Generate Microsoft Visual Studio 2010 project files", + os = "windows", + + valid_kinds = { "ConsoleApp", "WindowedApp", "StaticLib", "SharedLib" }, + + valid_languages = { "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) + end, + + + oncleansolution = ignore, --premake.vstudio.cleansolution, + oncleanproject = ignore, --premake.vstudio.cleanproject, + oncleantarget = ignore --premake.vstudio.cleantarget + } \ 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 00000000..370d6e90 --- /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/tests/premake4.lua b/tests/premake4.lua index ff89d37a..dcc79e8d 100644 --- a/tests/premake4.lua +++ b/tests/premake4.lua @@ -63,8 +63,10 @@ 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") -- Xcode tests dofile("actions/xcode/test_xcode_common.lua") diff --git a/tests/test.bat b/tests/test.bat new file mode 100644 index 00000000..d39aba01 --- /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 00000000..e690f6d2 --- /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 55fbb0b2..ff58c3a2 100644 --- a/tests/testfx.lua +++ b/tests/testfx.lua @@ -15,6 +15,11 @@ -- -- 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.capture(expected) local actual = io.endcapture() From 4484d388a41d69d36e7365d5463cb18b353e2923 Mon Sep 17 00:00:00 2001 From: LiamDevine Date: Thu, 10 Jun 2010 16:45:25 +0100 Subject: [PATCH 02/19] vs2010 started vcxproj --- src/actions/vstudio/vs2010_vcxproxj.lua | 95 +++++++++++++++++++ tests/actions/vstudio/test_vs2010_vcxproj.lua | 71 ++++++++++++++ 2 files changed, 166 insertions(+) create mode 100644 src/actions/vstudio/vs2010_vcxproxj.lua create mode 100644 tests/actions/vstudio/test_vs2010_vcxproj.lua diff --git a/src/actions/vstudio/vs2010_vcxproxj.lua b/src/actions/vstudio/vs2010_vcxproxj.lua new file mode 100644 index 00000000..963e7e1e --- /dev/null +++ b/src/actions/vstudio/vs2010_vcxproxj.lua @@ -0,0 +1,95 @@ + +premake.vstudio.vcxproj = { } +--local vcproj = premake.vstudio.vcxproj + + local function vs2010_config(prj) + for _, cfginfo in ipairs(prj.solution.vstudio_configs) do + --cfginfo = prj.solution.vstudio_configs[1] + --local cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform) + + _p(1,'') + _p(2,'%s',cfginfo.buildcfg) + _p(3,'%s',cfginfo.platform) + _p(2,'') + _p(1,'') + end + end + + local function vs2010_globals(prj) + _p(1,'') + _p(2,'{%s}',prj.uuid) + _p(2,'%s',prj.name) + _p(2,'Win32Proj') + _p(1,'') + end + + function config_type(config) + local t = + { + SharedLib = "DynamicLibrary", + StaticLib = "StaticLibrary", + ConsoleApp = "Application", + } + return t[config.kind] + 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,'', premake.esc(cfginfo.name)) + _p(2,'%s',config_type(cfg)) + _p(2,'%s',iif(cfg.flags.Unicode,"Unicode","MultiByte")) + _p(1,'') + 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,'',premake.esc(cfginfo.name)) + _p(2,'') + _p(1,'') + end + end + +--[[ + + <_ProjectFileVersion>10.0.30319.1 + ..\..\bin\Debug\ + ..\..\obj\Debug\string_is_integral\ + true + ..\..\bin\Release\ + ..\..\obj\Release\string_is_integral\ + false + +--]] + + function premake.vs2010_vcxproj(prj) + io.eol = "\r\n" + _p('') + _p('') + + vs2010_config(prj) + vs2010_globals(prj) + + _p(1,'') + + config_type_block(prj) + + _p(1,'') + + --check what this section is doing + _p(1,'') + _p(1,'') + + import_props(prj) + + --what type of macros are these? + _p(1,'') + + + + _p('') + 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 00000000..f5669a8a --- /dev/null +++ b/tests/actions/vstudio/test_vs2010_vcxproj.lua @@ -0,0 +1,71 @@ + T.vs2010_vcxproj = { } + local vs10_vcxproj = T.vs2010_vcxproj + +--[[ + + + + + + Debug + Win32 + + + Release + Win32 + + + +--]] + + local sln, prj + function vs10_vcxproj.setup() + _ACTION = "vs2010" + + sln = solution "MySolution" + configurations { "Debug", "Release" } + platforms {} + + --project "DotNetProject" -- to test handling of .NET platform in solution + --language "C#" + --kind "ConsoleApp" + + prj = project "MyProject" + language "C++" + kind "ConsoleApp" + uuid "AE61726D-187C-E440-BD07-2556188A6565" + 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, '')) + end + + function vs10_vcxproj.projectBlocksArePresent() + buffer = get_buffer() + test.string_contains(buffer,'') + end + + function vs10_vcxproj.projectOpenTagIsCorrect() + buffer = get_buffer() + test.string_contains(buffer,'*.*') + end + + function vs10_vcxproj.configItemGroupPresent() + buffer = get_buffer() + test.string_contains(buffer,'*.*') + end + + function vs10_vcxproj.configBlocksArePresent() + buffer = get_buffer() + test.string_contains(buffer,'') + end From 7b61224398a8e82063adacd9555f8f7ffa88e2fe Mon Sep 17 00:00:00 2001 From: LiamDevine Date: Thu, 10 Jun 2010 18:15:49 +0100 Subject: [PATCH 03/19] hmm missing tests --- src/actions/vstudio/vs2010_vcxproxj.lua | 11 +++---- tests/actions/vstudio/test_vs2010_vcxproj.lua | 33 ++++++++++++++++++- 2 files changed, 36 insertions(+), 8 deletions(-) diff --git a/src/actions/vstudio/vs2010_vcxproxj.lua b/src/actions/vstudio/vs2010_vcxproxj.lua index 963e7e1e..21f61485 100644 --- a/src/actions/vstudio/vs2010_vcxproxj.lua +++ b/src/actions/vstudio/vs2010_vcxproxj.lua @@ -4,9 +4,6 @@ premake.vstudio.vcxproj = { } local function vs2010_config(prj) for _, cfginfo in ipairs(prj.solution.vstudio_configs) do - --cfginfo = prj.solution.vstudio_configs[1] - --local cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform) - _p(1,'') _p(2,'%s',cfginfo.buildcfg) @@ -74,21 +71,21 @@ premake.vstudio.vcxproj = { } vs2010_config(prj) vs2010_globals(prj) - _p(1,'') + _p(1,'') config_type_block(prj) - _p(1,'') + _p(1,'') --check what this section is doing _p(1,'') _p(1,'') + import_props(prj) --what type of macros are these? - _p(1,'') - + _p(1,'') _p('') diff --git a/tests/actions/vstudio/test_vs2010_vcxproj.lua b/tests/actions/vstudio/test_vs2010_vcxproj.lua index f5669a8a..547e8a18 100644 --- a/tests/actions/vstudio/test_vs2010_vcxproj.lua +++ b/tests/actions/vstudio/test_vs2010_vcxproj.lua @@ -62,10 +62,41 @@ function vs10_vcxproj.configItemGroupPresent() buffer = get_buffer() - test.string_contains(buffer,'*.*') + test.string_contains(buffer,'*.*') end function vs10_vcxproj.configBlocksArePresent() buffer = get_buffer() test.string_contains(buffer,'') end + + function vs10_vcxproj.configTypeBlockPresent() + buffer = get_buffer() + test.string_contains(buffer,'*.*') + end + + function vs10_vcxproj.twoConfigTypeBlocksPresent() + buffer = get_buffer() + test.string_contains(buffer,'*.*') + end + + function vs10_vcxproj.propsDefaultForCppProjArePresent() + buffer = get_buffer() + test.string_contains(buffer,'') + end + + + function vs10_vcxproj.propsForCppProjArePresent() + buffer = get_buffer() + test.string_contains(buffer,'') + end + + function vs10_vcxproj.extensionSettingArePresent() + buffer = get_buffer() + test.string_contains(buffer,'*.*') + end + + function vs10_vcxproj.userMacrosPresent() + buffer = get_buffer() + test.string_contains(buffer,'') + end \ No newline at end of file From 3f67eb5d7f4708ae6d89bb7f94c50e5458be3411 Mon Sep 17 00:00:00 2001 From: LiamDevine Date: Fri, 11 Jun 2010 22:07:07 +0100 Subject: [PATCH 04/19] vcxproj support getting there --- src/actions/vstudio/vs2010_vcxproxj.lua | 262 +++++++++++++++++- tests/actions/vstudio/test_vs2010_flags.lua | 256 +++++++++++++++++ tests/actions/vstudio/test_vs2010_vcxproj.lua | 122 ++++++-- tests/premake4.lua | 2 + tests/testfx.lua | 6 + todo.txt | 15 + 6 files changed, 629 insertions(+), 34 deletions(-) create mode 100644 tests/actions/vstudio/test_vs2010_flags.lua create mode 100644 todo.txt diff --git a/src/actions/vstudio/vs2010_vcxproxj.lua b/src/actions/vstudio/vs2010_vcxproxj.lua index 21f61485..5a30e812 100644 --- a/src/actions/vstudio/vs2010_vcxproxj.lua +++ b/src/actions/vstudio/vs2010_vcxproxj.lua @@ -51,17 +51,253 @@ premake.vstudio.vcxproj = { } end end ---[[ - - <_ProjectFileVersion>10.0.30319.1 - ..\..\bin\Debug\ - ..\..\obj\Debug\string_is_integral\ - true - ..\..\bin\Release\ - ..\..\obj\Release\string_is_integral\ - false - ---]] +--needs revisiting for when there are dependency projects + function intermediate_and_out_dirs(prj) + _p(1,'') + _p(2,'<_ProjectFileVersion>10.0.30319.1') + + for _, cfginfo in ipairs(prj.solution.vstudio_configs) do + local cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform) + _p(2,'%s', premake.esc(cfginfo.name),premake.esc(cfg.buildtarget.directory) ) + _p(2,'%s', premake.esc(cfginfo.name), premake.esc(cfg.objectsdir)) + if cfg.flags.NoManifest then + _p(2,'false',premake.esc(cfginfo.name)) + end + end + + _p(1,'') + 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,'Use') + _p(3,'%s', path.getname(cfg.pchheader)) + else + _p(3,'') + 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,'%s;%%(PreprocessorDefinitions)',premake.esc(table.concat(cfg.defines, ";"))) + else + _p(indent,'') + end + end + + function include_dirs(indent,cfg) + if #cfg.includedirs > 0 then + _p(indent,'%s;%%(AdditionalIncludeDirectories)',premake.esc(path.translate(table.concat(cfg.includedirs, ";"), '\\'))) + else + _p(indent,'') + end + end + + function resource_compile(cfg) + _p(1,'') + preprocessor(2,cfg) + include_dirs(2,cfg) + _p(1,'') + + end + + function exceptions(cfg) + if cfg.flags.NoExceptions then + _p(2,'false') + elseif cfg.flags.SEH then + _p(2,'Async') + end + end + + function rtti(cfg) + if cfg.flags.NoRTTI then + _p(3,'false') + --elseif _ACTION > "vs2003" and cfg.flags.NoRTTI then + -- _p(3,'true') + end + end + + function wchar_t_buildin(cfg) + if cfg.flags.NativeWChar then + _p(3,'true') + elseif cfg.flags.NoNativeWChar then + _p(3,'false') + end + end + + function sse(cfg) + if cfg.flags.EnableSSE then + _p(3,'StreamingSIMDExtensions') + elseif cfg.flags.EnableSSE2 then + _p(3,'StreamingSIMDExtensions2') + end + end + + function floating_point(cfg) + if cfg.flags.FloatFast then + _p(3,'Fast') + elseif cfg.flags.FloatStrict then + _p(3,'Strict') + 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,'EditAndContinue') + else + _p(3,'') + end + end + + function vs10_clcompile(cfg) + _p(2,'') + + if #cfg.buildoptions > 0 then + _p(3,'%s %%(AdditionalOptions)',endtable.concat(premake.esc(cfg.buildoptions), " ")) + end + + _p(3,'%s',optimisation(cfg)) + + include_dirs(3,cfg) + + preprocessor(3,cfg) + + if cfg.flags.Symbols and not cfg.flags.NoMinimalRebuild then + _p(3,'true') + elseif cfg.flags.Symbols then + _p(3,'false') + end + + if optimisation(cfg) == "Disabled" and not cfg.flags.Managed then + _p(3,'EnableFastChecks') + end + + if optimisation(cfg) ~= "Disabled" then + _p(3,'true') + end + + _p(3,'%s', runtime(cfg)) + + _p(3,'true') + + precompiled_header(cfg) + + _p(3,'Level%s', iif(cfg.flags.ExtraWarnings, 4, 3)) + + + + if cfg.flags.FatalWarnings then + _p(3,'true') + end + + + -- if (cfg.kind == "ConsoleApp" or cfg.kind == "WindowedApp") and not cfg.flags.WinMain then + -- _p(4,'EntryPointSymbol="mainCRTStartup"') + -- end + + exceptions(cfg) + rtti(cfg) + wchar_t_buildin(cfg) + sse(cfg) + floating_point(cfg) + debug_info(cfg) + + --[[ + NOTE: TODO: + this can not be converted when using the upgrade tool + added for now but it will removed or altered when I find out + what is the correct thing to do. + --]] + _p(3,'$(OutDir)%s.pdb', path.getbasename(cfg.buildtarget.name)) + + if cfg.flags.NoFramePointer then + _p(3,'true') + end + + + + _p(2,'') + end + + + function event_hooks(cfg) + if #cfg.postbuildcommands> 0 then + _p(1,'') + _p(2,'"%s"',premake.esc(table.implode(cfg.postbuildcommands, "", "", "\r\n"))) + _p(1,'') + end + + if #cfg.prebuildcommands> 0 then + _p(1,'') + _p(2,'"%s"',premake.esc(table.implode(cfg.prebuildcommands, "", "", "\r\n"))) + _p(1,'') + end + + if #cfg.prelinkcommands> 0 then + _p(1,'') + _p(2,'"%s"',premake.esc(table.implode(cfg.prelinkcommands, "", "", "\r\n"))) + _p(1,'') + end + end + + + function item_definitions(prj) + for _, cfginfo in ipairs(prj.solution.vstudio_configs) do + local cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform) + _p(1,'',premake.esc(cfginfo.name)) + vs10_clcompile(cfg) + _p(1,'') + resource_compile(cfg) + --link + event_hooks(cfg) + end + end function premake.vs2010_vcxproj(prj) io.eol = "\r\n" @@ -87,6 +323,10 @@ premake.vstudio.vcxproj = { } --what type of macros are these? _p(1,'') + intermediate_and_out_dirs(prj) + item_definitions(prj) + + _p('') end \ No newline at end of file diff --git a/tests/actions/vstudio/test_vs2010_flags.lua b/tests/actions/vstudio/test_vs2010_flags.lua new file mode 100644 index 00000000..1584906a --- /dev/null +++ b/tests/actions/vstudio/test_vs2010_flags.lua @@ -0,0 +1,256 @@ + +T.vs2010_flags = { } +local vs10_flags = T.vs2010_flags +local sln, prj + + +--[[ +function vs10_flags.setup()end +function vs10_flags.nothing() end +--]] + +function vs10_flags.setup() + _ACTION = "vs2010" + + sln = solution "MySolution" + configurations { "Debug" } + platforms {} + + prj = project "MyProject" + language "C++" + kind "ConsoleApp" + uuid "AE61726D-187C-E440-BD07-2556188A6565" + includedirs{"foo/bar"} +end + +local function get_buffer() + io.capture() + premake.buildconfigs() + sln.vstudio_configs = premake.vstudio_buildconfigs(sln) + premake.vs2010_vcxproj(prj) + buffer = io.endcapture() + return buffer +end + + +function vs10_flags.sseSet() + flags {"EnableSSE"} + + buffer = get_buffer() + test.string_contains(buffer,'StreamingSIMDExtensions') +end + +function vs10_flags.sse2Set() + flags {"EnableSSE2"} + + buffer = get_buffer() + test.string_contains(buffer,'StreamingSIMDExtensions2') +end + +function vs10_flags.extraWarningNotSet_warningLevelIsThree() + buffer = get_buffer() + test.string_contains(buffer,'Level3') +end + +function vs10_flags.extraWarning_warningLevelIsFour() + flags {"ExtraWarnings"} + + buffer = get_buffer() + test.string_contains(buffer,'Level4') +end + +function vs10_flags.extraWarning_treatWarningsAsError_setToTrue() + flags {"FatalWarnings"} + + buffer = get_buffer() + test.string_contains(buffer,'true') +end + +function vs10_flags.floatFast_floatingPointModel_setToFast() + flags {"FloatFast"} + + buffer = get_buffer() + test.string_contains(buffer,'Fast') +end + +function vs10_flags.floatStrict_floatingPointModel_setToStrict() + flags {"FloatStrict"} + + buffer = get_buffer() + test.string_contains(buffer,'Strict') +end + +function vs10_flags.nativeWideChar_TreatWChar_tAsBuiltInType_setToTrue() + flags {"NativeWChar"} + + buffer = get_buffer() + test.string_contains(buffer,'true') +end + +function vs10_flags.nativeWideChar_TreatWChar_tAsBuiltInType_setToFalse() + flags {"NoNativeWChar"} + + buffer = get_buffer() + test.string_contains(buffer,'false') +end + +function vs10_flags.noExceptions_exceptionHandling_setToFalse() + flags {"NoExceptions"} + + buffer = get_buffer() + test.string_contains(buffer,'false') +end + +function vs10_flags.structuredExceptions_exceptionHandling_setToAsync() + flags {"SEH"} + + buffer = get_buffer() + test.string_contains(buffer,'Async') +end + +function vs10_flags.noFramePointer_omitFramePointers_setToTrue() + flags {"NoFramePointer"} + + buffer = get_buffer() + test.string_contains(buffer,'true') +end + + +function vs10_flags.noRTTI_runtimeTypeInfo_setToFalse() + flags {"NoRTTI"} + + buffer = get_buffer() + test.string_contains(buffer,'false') +end + +function vs10_flags.optimizeSize_optimization_setToMinSpace() + flags {"OptimizeSize"} + + buffer = get_buffer() + test.string_contains(buffer,'MinSpace') +end + +function vs10_flags.optimizeSpeed_optimization_setToMaxSpeed() + flags {"OptimizeSpeed"} + + buffer = get_buffer() + test.string_contains(buffer,'MaxSpeed') +end +function vs10_flags.optimizeSpeed_optimization_setToMaxSpeed() + flags {"Optimize"} + + buffer = get_buffer() + test.string_contains(buffer,'Full') +end + +function vs10_flags.noStaticRuntime_runtimeLibrary_setToMultiThreadedDLL() + buffer = get_buffer() + test.string_contains(buffer,'MultiThreadedDLL') +end + +--[[ +function vs10_flags.symbols_runtimeLibrary_setToMultiThreadedDebugDLL() + flags {"Symbols"} + + buffer = get_buffer() + test.string_contains(buffer,'MultiThreadedDebugDLL') +end +--]] + +function vs10_flags.noStaticRuntimeYetSymbols_runtimeLibrary_setToMultiThreadedDebugDLL() + flags {"Symbols"} + + buffer = get_buffer() + test.string_contains(buffer,'MultiThreadedDebugDLL') +end + +function vs10_flags.staticRuntime_runtimeLibrary_setToMultiThreaded() + flags {"StaticRuntime"} + + buffer = get_buffer() + test.string_contains(buffer,'MultiThreaded') +end + +function vs10_flags.staticRuntimeAndSymbols_runtimeLibrary_setToMultiThreadedDebug() + flags {"StaticRuntime","Symbols"} + + buffer = get_buffer() + test.string_contains(buffer,'MultiThreadedDebug') +end + +function vs10_flags.noCharacterSetDefine_characterSet_setToMultiByte() + buffer = get_buffer() + test.string_contains(buffer,'MultiByte') +end + +function vs10_flags.unicode_characterSet_setToUnicode() + flags {"Unicode"} + + buffer = get_buffer() + test.string_contains(buffer,'Unicode') +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,'false') +end + +function vs10_flags.symbolsSetYetNotMinimalRebuild_minimalRebuild_setToTrue() + flags {"Symbols"} + + buffer = get_buffer() + test.string_contains(buffer,'true') +end + +--this generates an error: invalid value 'MFC' +--[[ +function vs10_flags.mfc_useOfMfc_setToStatic() + flags{"MFC"} + + buffer = get_buffer() + --test.string_contains(buffer,'Static') +end +--]] + +function vs10_flags.Symbols_DebugInformationFormat_setToEditAndContinue() + flags{"Symbols"} + + buffer = get_buffer() + test.string_contains(buffer,'EditAndContinue') +end + +function vs10_flags.symbolsAndNoEditAndContinue_DebugInformationFormat_isAnEmptyBlock() + flags{"Symbols","NoEditAndContinue"} + + buffer = get_buffer() + test.string_contains(buffer,'') +end + +function vs10_flags.noManifest_GenerateManifest_setToFalse() + flags{"NoManifest"} + + buffer = get_buffer() + test.string_contains(buffer,'false') +end + +--[[ +this causes a problem when a project is updated with the command line tool +yet it is here until the correct course of action is found +--]] +function vs10_flags.programDataBaseFile() + buffer = get_buffer() + test.string_contains(buffer,'%$%(OutDir%)MyProject%.pdb') +end + + + diff --git a/tests/actions/vstudio/test_vs2010_vcxproj.lua b/tests/actions/vstudio/test_vs2010_vcxproj.lua index 547e8a18..3281ae46 100644 --- a/tests/actions/vstudio/test_vs2010_vcxproj.lua +++ b/tests/actions/vstudio/test_vs2010_vcxproj.lua @@ -1,23 +1,9 @@ T.vs2010_vcxproj = { } local vs10_vcxproj = T.vs2010_vcxproj - ---[[ - - - - - - Debug - Win32 - - - Release - Win32 - - - ---]] - + local include_directory = "bar/foo" + local include_directory2 = "baz/foo" + local debug_define = "I_AM_ALIVE_NUMBER_FIVE" + local sln, prj function vs10_vcxproj.setup() _ACTION = "vs2010" @@ -25,15 +11,25 @@ sln = solution "MySolution" configurations { "Debug", "Release" } platforms {} - - --project "DotNetProject" -- to test handling of .NET platform in solution - --language "C#" - --kind "ConsoleApp" - + prj = project "MyProject" language "C++" kind "ConsoleApp" uuid "AE61726D-187C-E440-BD07-2556188A6565" + + includedirs + { + include_directory, + include_directory2 + } + + configuration("Release") + flags {"Optimize"} + + configuration("Debug") + defines {debug_define} + + end local function get_buffer() @@ -99,4 +95,84 @@ function vs10_vcxproj.userMacrosPresent() buffer = get_buffer() test.string_contains(buffer,'') + end + + function vs10_vcxproj.intermediateAndOutDirsPropertyGroupWithMagicNumber() + buffer = get_buffer() + test.string_contains(buffer,'*.*<_ProjectFileVersion>10%.0%.30319%.1') + end + + function vs10_vcxproj.outDirPresent() + buffer = get_buffer() + test.string_contains(buffer,'*.*') + end + function vs10_vcxproj.initDirPresent() + buffer = get_buffer() + test.string_contains(buffer,'*.*') + end + + function vs10_vcxproj.projectWithDebugAndReleaseConfig_twoOutDirsAndTwoIntDirs() + buffer = get_buffer() + test.string_contains(buffer,'*.**.**.**.**.**.**.*') + end + + function vs10_vcxproj.containsItemDefinition() + buffer = get_buffer() + test.string_contains(buffer,'*.*') + end + + + function vs10_vcxproj.containsClCompileBlock() + buffer = get_buffer() + test.string_contains(buffer,'*.*') + end + --[[ + function vs10_vcxproj.containsAdditionalOptions() + buffer = get_buffer() + test.string_contains(buffer,'*.*') + end + --]] + + local function cl_compile_string(version) + return '*.*' + end + + function vs10_vcxproj.debugHasNoOptimisation() + buffer = get_buffer() + test.string_contains(buffer, cl_compile_string('Debug').. '*.*Disabled*.*') + end + + function vs10_vcxproj.releaseHasFullOptimisation() + buffer = get_buffer() + test.string_contains(buffer, cl_compile_string('Release').. '*.*Full*.*') + end + + function vs10_vcxproj.includeDirectories_debugEntryContains_include_directory() + buffer = get_buffer() + test.string_contains(buffer,cl_compile_string('Debug').. '*.*'.. path.translate(include_directory, '\\') ..'*.*') + end + + function vs10_vcxproj.includeDirectories_debugEntryContains_include_directory2PrefixWithSemiColon() + buffer = get_buffer() + test.string_contains(buffer,cl_compile_string('Debug').. '*.**.*;'.. path.translate(include_directory2, '\\') ..'*.*') + end + + function vs10_vcxproj.includeDirectories_debugEntryContains_include_directory2PostfixWithSemiColon() + buffer = get_buffer() + test.string_contains(buffer,cl_compile_string('Debug').. '*.**.*'.. path.translate(include_directory2, '\\') ..';*.*') + end + + function vs10_vcxproj.debugContainsPreprossorBlock() + buffer = get_buffer() + test.string_contains(buffer,cl_compile_string('Debug').. '*.**.*') + end + + function vs10_vcxproj.debugHasDebugDefine() + buffer = get_buffer() + test.string_contains(buffer,cl_compile_string('Debug')..'*.**.*'..debug_define..'*.*') + end + + function vs10_vcxproj.releaseHasStringPoolingOn() + buffer = get_buffer() + test.string_contains(buffer,cl_compile_string('Release')..'*.*true') end \ No newline at end of file diff --git a/tests/premake4.lua b/tests/premake4.lua index dcc79e8d..041ada2f 100644 --- a/tests/premake4.lua +++ b/tests/premake4.lua @@ -67,6 +67,8 @@ dofile("actions/vstudio/test_vs2005_csproj.lua") dofile("actions/vstudio/test_vs200x_vcproj.lua") dofile("actions/vstudio/test_vs2010_vcxproj.lua") + dofile("actions/vstudio/test_vs2010_flags.lua") + -- Xcode tests dofile("actions/xcode/test_xcode_common.lua") diff --git a/tests/testfx.lua b/tests/testfx.lua index ff58c3a2..46968782 100644 --- a/tests/testfx.lua +++ b/tests/testfx.lua @@ -21,6 +21,12 @@ end end + function test.string_does_not_contain(buffer, expected) + if string.find(buffer,expected) then + test.fail("\n==Fail==: Did not expected to find :\n%s\nyet it was found in buffer:\n%s\n", expected,buffer) + end + end + function test.capture(expected) local actual = io.endcapture() diff --git a/todo.txt b/todo.txt new file mode 100644 index 00000000..b05c861d --- /dev/null +++ b/todo.txt @@ -0,0 +1,15 @@ +find why MFC in flags causes an error + +add support for flags: WinMain, Managed, MFC, NoImportLib, Unsafe +add Link section to vcxproj +add ClInclude section +add LinkIncremental support +add ImportGroup section +support C +support Managed C++ +support C# +add X.vcxproj.filters +add X.vcxproj.user +find out why a unit test is failing + +No64BitChecks is removed after being deprciated in previous releases From 70a93c68bc06f0699189466cdfa99c03705d19df Mon Sep 17 00:00:00 2001 From: LiamDevine Date: Tue, 15 Jun 2010 23:29:56 +0100 Subject: [PATCH 05/19] vcxproj.filters done vcxproj.user done vcxproj nearly done --- src/actions/vstudio/_vstudio.lua | 13 +- src/actions/vstudio/vs2010_vcxproxj.lua | 285 ++++++++++-- tests/actions/vstudio/test_vs2010_filters.lua | 421 ++++++++++++++++++ tests/actions/vstudio/test_vs2010_links.lua | 153 +++++++ tests/actions/vstudio/test_vs2010_vcxproj.lua | 98 +++- tests/premake4.lua | 4 +- todo.txt | 23 +- 7 files changed, 943 insertions(+), 54 deletions(-) create mode 100644 tests/actions/vstudio/test_vs2010_filters.lua create mode 100644 tests/actions/vstudio/test_vs2010_links.lua diff --git a/src/actions/vstudio/_vstudio.lua b/src/actions/vstudio/_vstudio.lua index 6ba39af0..b6639218 100644 --- a/src/actions/vstudio/_vstudio.lua +++ b/src/actions/vstudio/_vstudio.lua @@ -421,9 +421,6 @@ oncleantarget = premake.vstudio.cleantarget } - - local function ignore() - end newaction { @@ -446,11 +443,13 @@ end, onproject = function(prj) - premake.generate(prj, "%%.vcxproj", premake.vs2010_vcxproj) + 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 = ignore, --premake.vstudio.cleansolution, - oncleanproject = ignore, --premake.vstudio.cleanproject, - oncleantarget = ignore --premake.vstudio.cleantarget + 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 index 5a30e812..c73615b0 100644 --- a/src/actions/vstudio/vs2010_vcxproxj.lua +++ b/src/actions/vstudio/vs2010_vcxproxj.lua @@ -50,7 +50,13 @@ premake.vstudio.vcxproj = { } _p(1,'') end end - + function incremental_link(cfg) + if optimisation(cfg) ~= "Disabled" then + return 'true' + else + return 'false' + end + end --needs revisiting for when there are dependency projects function intermediate_and_out_dirs(prj) _p(1,'') @@ -60,6 +66,9 @@ premake.vstudio.vcxproj = { } local cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform) _p(2,'%s', premake.esc(cfginfo.name),premake.esc(cfg.buildtarget.directory) ) _p(2,'%s', premake.esc(cfginfo.name), premake.esc(cfg.objectsdir)) + + _p(2,'%s',premake.esc(cfginfo.name),incremental_link(cfg)) + if cfg.flags.NoManifest then _p(2,'false',premake.esc(cfginfo.name)) end @@ -135,10 +144,10 @@ premake.vstudio.vcxproj = { } end function resource_compile(cfg) - _p(1,'') - preprocessor(2,cfg) - include_dirs(2,cfg) - _p(1,'') + _p(2,'') + preprocessor(3,cfg) + include_dirs(3,cfg) + _p(2,'') end @@ -153,8 +162,6 @@ premake.vstudio.vcxproj = { } function rtti(cfg) if cfg.flags.NoRTTI then _p(3,'false') - --elseif _ACTION > "vs2003" and cfg.flags.NoRTTI then - -- _p(3,'true') end end @@ -194,25 +201,28 @@ premake.vstudio.vcxproj = { } _p(3,'') end end - + + function minimal_build(cfg) + if cfg.flags.Symbols and not cfg.flags.NoMinimalRebuild then + _p(3,'true') + elseif cfg.flags.Symbols then + _p(3,'false') + end + end + function vs10_clcompile(cfg) _p(2,'') if #cfg.buildoptions > 0 then - _p(3,'%s %%(AdditionalOptions)',endtable.concat(premake.esc(cfg.buildoptions), " ")) + _p(3,'%s %%(AdditionalOptions)', + table.concat(premake.esc(cfg.buildoptions), " ")) end _p(3,'%s',optimisation(cfg)) include_dirs(3,cfg) - - preprocessor(3,cfg) - - if cfg.flags.Symbols and not cfg.flags.NoMinimalRebuild then - _p(3,'true') - elseif cfg.flags.Symbols then - _p(3,'false') - end + preprocessor(3,cfg) + minimal_build(cfg) if optimisation(cfg) == "Disabled" and not cfg.flags.Managed then _p(3,'EnableFastChecks') @@ -235,11 +245,6 @@ premake.vstudio.vcxproj = { } if cfg.flags.FatalWarnings then _p(3,'true') end - - - -- if (cfg.kind == "ConsoleApp" or cfg.kind == "WindowedApp") and not cfg.flags.WinMain then - -- _p(4,'EntryPointSymbol="mainCRTStartup"') - -- end exceptions(cfg) rtti(cfg) @@ -286,19 +291,198 @@ premake.vstudio.vcxproj = { } end end + function item_def_lib(cfg) + if cfg.kind == 'StaticLib' then + _p(1,'') + _p(2,'$(OutDir)%s.lib',"some_name") + _p(1,'') + 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,'%s', target) + end + + function item_link(cfg) + _p(2,'') + if #cfg.links > 0 then + _p(3,'%s;%%(AdditionalDependencies)', + table.concat(premake.getlinks(cfg, "all", "fullpath"), ";")) + end + _p(3,'$(OutDir)%s', cfg.buildtarget.name) + + _p(3,'%s%s%%(AdditionalLibraryDirectories)', + table.concat(premake.esc(path.translate(cfg.libdirs, '\\')) , ";"), + iif(cfg.libdirs and #cfg.libdirs >0,';','')) + + if cfg.flags.Symbols then + _p(3,'true') + else + _p(3,'false') + end + + _p(3,'%s',iif(cfg.kind == "ConsoleApp","Console", "Windows")) + + if optimisation(cfg) ~= "Disabled" then + _p(3,'true') + _p(3,'true') + end + + if (cfg.kind == "ConsoleApp" or cfg.kind == "WindowedApp") and not cfg.flags.WinMain then + _p(3,'mainCRTStartup') + end + _p(3,'%s', iif(cfg.platform == "x64", "MachineX64", "MachineX86")) + + _p(2,'') + 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,'',premake.esc(cfginfo.name)) - vs10_clcompile(cfg) + vs10_clcompile(cfg) + resource_compile(cfg) + item_def_lib(cfg) + item_link(cfg) _p(1,'') - resource_compile(cfg) - --link + event_hooks(cfg) end - 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 + + 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 ext = get_file_extension(current_file) + if ext then + local type = types[ext] + if type then + table.insert(sorted_container[type],current_file) + else + table.insert(sorted_container.None,current_file) + end + end + end + end + --[[ + 02 + 303 + 304 {8fd826f8-3739-44e6-8cc8-997122e53b8d} + 305 + 306 + + --]] + function write_file_type_block(files,group_type) + if #files > 0 then + _p(1,'') + for _, current_file in ipairs(files) do + _p(2,'<%s Include=\"%s\" />', group_type,path.translate(current_file, "\\")) + end + _p(1,'') + 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,'') + for _, dir in pairs(directories) do + _p(2,'',dir) + _p(3,'{%s}',os.uuid()) + _p(2,'') + end + _p(1,'') + end + end + function write_file_filter_block(files,group_type) + if #files > 0 then + _p(1,'') + 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,'%s',path_to_file) + _p(2,'',group_type) + else + _p(2,'<%s Include=\"%s\" />', group_type,path.translate(current_file, "\\")) + end + end + _p(1,'') + 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('') + _p('') + 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('') + end + +--[[ + + + + Create + Create + + +--]] function premake.vs2010_vcxproj(prj) io.eol = "\r\n" _p('') @@ -325,8 +509,51 @@ premake.vstudio.vcxproj = { } intermediate_and_out_dirs(prj) - item_definitions(prj) + item_definitions(prj) + vcxproj_files(prj) + + _p(1,'') + _p(1,'') + _p(1,'') _p('') - end \ No newline at end of file + end + + function premake.vs2010_vcxproj_user(prj) + _p('') + _p('') + _p('') + 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) + local fname = premake.project.getfilename(prj, "%%") + os.remove(fname .. '.vcxproj') + os.remove(fname .. '.vcxproj.user') + os.remove(fname .. '.vcxproj.filters') + --[[ + local userfiles = os.matchfiles(fname .. ".*.user") + for _, fname in ipairs(userfiles) 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/tests/actions/vstudio/test_vs2010_filters.lua b/tests/actions/vstudio/test_vs2010_filters.lua new file mode 100644 index 00000000..278ffc2b --- /dev/null +++ b/tests/actions/vstudio/test_vs2010_filters.lua @@ -0,0 +1,421 @@ + T.vs2010_filters = { } + local vs10_filters = T.vs2010_filters + + 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 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,"") + end + + function vs10_filters.oneInputFileYetNoDirectory_bufferDoesNotContainTagFilter() + files + { + "dontCare.h" + } + local buffer = get_buffer() + test.string_does_not_contain(buffer,"*.**.*") + end + + function vs10_filters.oneInputFileWithDirectory_bufferContainsTagFilterWithIncludeSetToFoo() + files + { + "foo/dontCare.h" + } + local buffer = get_buffer() + test.string_contains(buffer,'') + end + + function vs10_filters.clIncludeFilter_oneInputFile_bufferContainsTagClInclude() + files + { + "dontCare.h" + } + local buffer = get_buffer() + test.string_contains(buffer,'') + end + + function vs10_filters.clCompileFilter_oneInputFile_bufferContainsTagClCompile() + files + { + "dontCare.cpp" + } + local buffer = get_buffer() + test.string_contains(buffer,'*.*') + end + + function vs10_links.additionalDependancies_isInsideLinkBlock() + configuration("Debug") + links{"link_test"} + local buffer = get_buffer() + test.string_contains(buffer, + '*.**.*%%%(AdditionalDependencies%)*.*') + end + + function vs10_links.additionalDependancies_containsLinkTestDotLib() + configuration("Debug") + links{"link_test"} + local buffer = get_buffer() + test.string_contains(buffer, + 'link_test%.lib;%%%(AdditionalDependencies%)') + end + + function vs10_links.outPutFile_isEqualToOutDirMyProjectDotExe() + local buffer = get_buffer() + test.string_contains(buffer,'%$%(OutDir%)MyProject.exe') + end + + function vs10_links.additionalLibraryDirectories_inputNoDirectories_tagsAreEmpty() + local buffer = get_buffer() + test.string_contains(buffer, + '%%%(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, + ''..exspect..'%%%(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, + ''..exspect..'%%%(AdditionalLibraryDirectories%)') + end + + function vs10_links.generateDebugInformation_withoutSymbolsFlag_valueInTagsIsFalse() + local buffer = get_buffer() + test.string_contains(buffer,'false') + end + + function vs10_links.generateDebugInformation_withSymbolsFlag_valueInTagsIsTrue() + flags {"Symbols"} + local buffer = get_buffer() + test.string_contains(buffer,'true') + end + + function vs10_links.subSystem_consoleApp_valueInTagsIsConsole() + local buffer = get_buffer() + test.string_contains(buffer,'Console') + end + + function vs10_links.subSystem_StaticLib_valueInTagsIsWindows() + kind "StaticLib" + local buffer = get_buffer() + test.string_contains(buffer,'Windows') + 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,'true') + end + + function vs10_links.noOptimiseFlag_enableCOMDATFolding_valueInsideTagsIsTrue() + flags{"Optimize"} + local buffer = get_buffer() + test.string_contains(buffer,'EnableCOMDATFolding>truemainCRTStartup') + end + + function vs10_links.entryPointSymbol_noWimMainFlag_valueInTagsIsMainCrtStartUp() + local buffer = get_buffer() + test.string_contains(buffer,'mainCRTStartup') + end + + function vs10_links.entryPointSymbol_winMainFlag_doesNotContainEntryPointSymbol() + flags{"WinMain"} + local buffer = get_buffer() + test.string_does_not_contain(buffer,'') + end + + function vs10_links.targetMachine_default_valueInTagsIsMachineX86() + local buffer = get_buffer() + test.string_contains(buffer,'MachineX86') + end + + function vs10_links.targetMachine_x32_valueInTagsIsMachineX64() + platforms {"x32"} + local buffer = get_buffer() + test.string_contains(buffer,'MachineX86') + end + + function vs10_links.targetMachine_x64_valueInTagsIsMachineX64() + platforms {"x64"} + local buffer = get_buffer() + test.string_contains(buffer,'MachineX64') + 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 index 3281ae46..7b998f5f 100644 --- a/tests/actions/vstudio/test_vs2010_vcxproj.lua +++ b/tests/actions/vstudio/test_vs2010_vcxproj.lua @@ -22,16 +22,25 @@ include_directory, include_directory2 } + files + { + "foo/dummyHeader.h", + "foo/dummySource.cpp", + "../src/host/*h", + "../src/host/*.c" + } configuration("Release") - flags {"Optimize"} + flags {"Optimize"} + links{"foo","bar"} configuration("Debug") - defines {debug_define} + defines {debug_define} + links{"foo_d"} - end - + end + local function get_buffer() io.capture() premake.buildconfigs() @@ -126,12 +135,12 @@ buffer = get_buffer() test.string_contains(buffer,'*.*') end - --[[ - function vs10_vcxproj.containsAdditionalOptions() + + function vs10_vcxproj.containsAdditionalOptions() + buildoptions {"/Gm"} buffer = get_buffer() - test.string_contains(buffer,'*.*') + test.string_contains(buffer,'/Gm %%%(AdditionalOptions%)') end - --]] local function cl_compile_string(version) return '*.*' @@ -175,4 +184,75 @@ function vs10_vcxproj.releaseHasStringPoolingOn() buffer = get_buffer() test.string_contains(buffer,cl_compile_string('Release')..'*.*true') - end \ No newline at end of file + end + + function vs10_vcxproj.hasItemGroupSection() + buffer = get_buffer() + test.string_contains(buffer,'*.*') + end + --[[ + function vs10_vcxproj.itemGroupSection_hasHeaderListed() + buffer = get_buffer() + test.string_contains(buffer,'*.**.*') + 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 + diff --git a/tests/premake4.lua b/tests/premake4.lua index 041ada2f..32401465 100644 --- a/tests/premake4.lua +++ b/tests/premake4.lua @@ -67,7 +67,9 @@ 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_flags.lua") + dofile("actions/vstudio/test_vs2010_links.lua") + dofile("actions/vstudio/test_vs2010_filters.lua") -- Xcode tests diff --git a/todo.txt b/todo.txt index b05c861d..49663b3d 100644 --- a/todo.txt +++ b/todo.txt @@ -1,15 +1,22 @@ find why MFC in flags causes an error -add support for flags: WinMain, Managed, MFC, NoImportLib, Unsafe -add Link section to vcxproj -add ClInclude section -add LinkIncremental support -add ImportGroup section +add support for flags: Managed, MFC, NoImportLib, Unsafe + +NoImportLib +Prevent the generation of an import library for a Windows DLL. + if cfg.kind == "SharedLib" then + local implibname = cfg.linktarget.fullpath + _p(4,'ImportLibrary="%s"', iif(cfg.flags.NoImportLib, cfg.objectsdir .. "\\" .. path.getname(implibname), implibname)) + end + +add Link section to vcxproj -done +add LinkIncremental support if no optimization and and exe?if cfg.kind ~= "StaticLib" then +add ImportGroup section - which section????? +add X.vcxproj.filters -done mostly just need to convert to ms irectory slash '\\' + support C support Managed C++ support C# -add X.vcxproj.filters -add X.vcxproj.user -find out why a unit test is failing +find out why a unit test is failing No64BitChecks is removed after being deprciated in previous releases From b27b21ce82474df74fbcef2d3f38599fc64bac1f Mon Sep 17 00:00:00 2001 From: LiamDevine Date: Wed, 16 Jun 2010 00:35:41 +0100 Subject: [PATCH 06/19] changed path seperators to window specific \\ --- src/actions/vstudio/vs2010_vcxproxj.lua | 10 +- tests/actions/vstudio/test_vs2010_filters.lua | 111 +++++++++--------- todo.txt | 8 +- 3 files changed, 68 insertions(+), 61 deletions(-) diff --git a/src/actions/vstudio/vs2010_vcxproxj.lua b/src/actions/vstudio/vs2010_vcxproxj.lua index c73615b0..ad5cb380 100644 --- a/src/actions/vstudio/vs2010_vcxproxj.lua +++ b/src/actions/vstudio/vs2010_vcxproxj.lua @@ -364,6 +364,7 @@ premake.vstudio.vcxproj = { } end end + --also translates file paths from '/' to '\\' function sort_input_files(files,sorted_container) local types = { @@ -377,13 +378,14 @@ premake.vstudio.vcxproj = { } } for _, current_file in ipairs(files) do - local ext = get_file_extension(current_file) + 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],current_file) + table.insert(sorted_container[type],translated_path) else - table.insert(sorted_container.None,current_file) + table.insert(sorted_container.None,translated_path) end end end @@ -400,7 +402,7 @@ premake.vstudio.vcxproj = { } if #files > 0 then _p(1,'') for _, current_file in ipairs(files) do - _p(2,'<%s Include=\"%s\" />', group_type,path.translate(current_file, "\\")) + _p(2,'<%s Include=\"%s\" />', group_type,current_file) end _p(1,'') end diff --git a/tests/actions/vstudio/test_vs2010_filters.lua b/tests/actions/vstudio/test_vs2010_filters.lua index 278ffc2b..e0eaf386 100644 --- a/tests/actions/vstudio/test_vs2010_filters.lua +++ b/tests/actions/vstudio/test_vs2010_filters.lua @@ -2,14 +2,14 @@ local vs10_filters = T.vs2010_filters function remove_relative_path(file) - file = file:gsub("%.%./",'') - file = file:gsub("%./",'') + file = file:gsub("%.%.\\",'') + file = file:gsub("%.\\",'') return file end function file_path(file) file = remove_relative_path(file) - local path = string.find(file,'/[%w%.%_%-]+$') + local path = string.find(file,'\\[%w%.%_%-]+$') if path then return string.sub(file,1,path-1) else @@ -20,11 +20,11 @@ function list_of_directories_in_path(path) local list={} if path then - for dir in string.gmatch(path,"[%w%-%_]+/")do + 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) + list[#list +1] = list[#list] .."\\" ..dir:sub(1,#dir-1) end end end @@ -90,43 +90,43 @@ function vs10_filters.path_hasOneDirectoryPath_returnsIsFoo() local path = "foo" - local result = file_path(path .."/foo.h") + 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") + 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") + 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") + 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") + 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") + 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") + local result = file_path(path .."\\foo.h") test.isequal(nil,result) end @@ -137,19 +137,19 @@ end function vs10_filters.removeRelativePath_dotDotSlashFoo_returnsFoo() - local path = "../foo" + local path = "..\\foo" local result = remove_relative_path(path) test.isequal("foo",result) end function vs10_filters.removeRelativePath_dotDotSlashDotDotSlashFoo_returnsFoo() - local path = "../../foo" + local path = "..\\..\\foo" local result = remove_relative_path(path) test.isequal("foo",result) end function vs10_filters.removeRelativePath_DotSlashFoo_returnsFoo() - local path = "./foo" + local path = ".\\foo" local result = remove_relative_path(path) test.isequal("foo",result) end @@ -160,23 +160,23 @@ end function vs10_filters.listOfDirectories_oneDirectory_returnsSizeIsOne() - local result = list_of_directories_in_path("foo/bar.h") + 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") + 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") + 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]) + local result = list_of_directories_in_path("foo\\bar\\bar.h") + test.isequal("foo\\bar",result[2]) end function vs10_filters.tableOfFilters_emptyTable_returnsEmptyTable() @@ -197,7 +197,7 @@ function vs10_filters.tableOfFilters_tableHasOneDirectory_returnSizeIsOne() t = { - 'bar/foo.h' + 'bar\\foo.h' } local result = table_of_filters(t) test.isequal(1,#result) @@ -205,8 +205,8 @@ function vs10_filters.tableOfFilters_tableHasTwoDirectories_returnSizeIsOne() t = { - 'bar/foo.h', - 'baz/foo.h' + 'bar\\foo.h', + 'baz\\foo.h' } local result = table_of_filters(t) test.isequal(2,#result) @@ -214,8 +214,8 @@ function vs10_filters.tableOfFilters_tableHasTwoDirectories_firstEntryIsBar() t = { - 'bar/foo.h', - 'baz/foo.h' + 'bar\\foo.h', + 'baz\\foo.h' } local result = table_of_filters(t) test.isequal("bar",result[1]) @@ -223,8 +223,8 @@ function vs10_filters.tableOfFilters_tableHasTwoDirectories_secondEntryIsBaz() t = { - 'bar/foo.h', - 'baz/foo.h' + 'bar\\foo.h', + 'baz\\foo.h' } local result = table_of_filters(t) test.isequal("baz",result[2]) @@ -233,8 +233,8 @@ function vs10_filters.tableOfFilters_tableHasTwoSameDirectories_returnSizeIsOne() t = { - 'bar/foo.h', - 'bar/baz.h' + 'bar\\foo.h', + 'bar\\baz.h' } local result = table_of_filters(t) test.isequal(1,#result) @@ -243,7 +243,7 @@ function vs10_filters.tableOfFilters_tableEntryHasTwoDirectories_returnSizeIsTwo() t = { - 'bar/baz/foo.h' + 'bar\\baz\\foo.h' } local result = table_of_filters(t) test.isequal(2,#result) @@ -252,7 +252,7 @@ function vs10_filters.tableOfFilters_tableEntryHasTwoDirectories_firstEntryIsBarSlashBar() t = { - 'bar/baz/foo.h' + 'bar\\baz\\foo.h' } local result = table_of_filters(t) test.isequal('bar',result[1]) @@ -261,18 +261,18 @@ function vs10_filters.tableOfFilters_tableEntryHasTwoDirectories_secondEntryIsBarSlashBaz() t = { - 'bar/baz/foo.h' + 'bar\\baz\\foo.h' } local result = table_of_filters(t) - test.isequal('bar/baz',result[2]) + test.isequal('bar\\baz',result[2]) end function vs10_filters.tableOfFilters_tableEntryHasTwoDirectoriesSecondDirisAlsoInNextEntry_returnSizeIsThree() t = { - 'bar/baz/foo.h', - 'baz/foo.h' + 'bar\\baz\\foo.h', + 'baz\\foo.h' } local result = table_of_filters(t) test.isequal(3,#result) @@ -281,9 +281,9 @@ function vs10_filters.tableOfFileFilters_returnSizeIsTwo() local t = { - foo = {'foo/bar.h'}, - bar = {'foo/bar.h'}, - baz = {'baz/bar.h'} + foo = {'foo\\bar.h'}, + bar = {'foo\\bar.h'}, + baz = {'baz\\bar.h'} } local result = table_of_file_filters(t) test.isequal(2,#result) @@ -292,9 +292,9 @@ function vs10_filters.tableOfFileFilters_returnContainsFoo() local t = { - foo = {'foo/bar.h'}, - bar = {'foo/bar.h'}, - baz = {'baz/bar.h'} + foo = {'foo\\bar.h'}, + bar = {'foo\\bar.h'}, + baz = {'baz\\bar.h'} } local result = table_of_file_filters(t) --order is not defined @@ -304,9 +304,9 @@ function vs10_filters.tableOfFileFilters_returnContainsBaz() local t = { - foo = {'foo/bar.h'}, - bar = {'foo/bar.h'}, - baz = {'baz/bar.h'} + foo = {'foo\\bar.h'}, + bar = {'foo\\bar.h'}, + baz = {'baz\\bar.h'} } local result = table_of_file_filters(t) --order is not defined @@ -316,10 +316,10 @@ 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'} + 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 @@ -329,7 +329,7 @@ function vs10_filters.tableOfFileFilters_tableHasSubTableWithTwoEntries_returnSizeIsTwo() local t = { - foo = {'foo/bar.h','foo/bar/bar.h'} + foo = {'foo\\bar.h','foo\\bar\\bar.h'} } local result = table_of_file_filters(t) --order is not defined @@ -359,7 +359,7 @@ function vs10_filters.oneInputFileWithDirectory_bufferContainsTagFilter() files { - "dontCare/dontCare.h" + "dontCare\\dontCare.h" } local buffer = get_buffer() test.string_contains(buffer,"*.**.*") @@ -377,7 +377,7 @@ function vs10_filters.oneInputFileWithDirectory_bufferContainsTagFilterWithIncludeSetToFoo() files { - "foo/dontCare.h" + "foo\\dontCare.h" } local buffer = get_buffer() test.string_contains(buffer,'') @@ -418,4 +418,5 @@ local buffer = get_buffer() test.string_contains(buffer,' Date: Wed, 16 Jun 2010 18:21:29 +0100 Subject: [PATCH 07/19] the failed test has some how disapeared. removed link section when kind is a static lib --- src/actions/vstudio/vs2010_vcxproxj.lua | 7 +++-- tests/actions/vstudio/test_vs2010_links.lua | 8 +++-- .../vstudio/test_vs2010_project_kinds.lua | 29 +++++++++++++++++++ tests/premake4.lua | 2 +- todo.txt | 5 ++++ 5 files changed, 45 insertions(+), 6 deletions(-) create mode 100644 tests/actions/vstudio/test_vs2010_project_kinds.lua diff --git a/src/actions/vstudio/vs2010_vcxproxj.lua b/src/actions/vstudio/vs2010_vcxproxj.lua index ad5cb380..66496986 100644 --- a/src/actions/vstudio/vs2010_vcxproxj.lua +++ b/src/actions/vstudio/vs2010_vcxproxj.lua @@ -110,7 +110,8 @@ premake.vstudio.vcxproj = { } end end - --have a look at this and translate + --have a look at this and translate + --[[ function vs10_vcxproj_symbols(cfg) if (not cfg.flags.Symbols) then return 0 @@ -126,7 +127,7 @@ premake.vstudio.vcxproj = { } end end end - + --]] function preprocessor(indent,cfg) if #cfg.defines > 0 then _p(indent,'%s;%%(PreprocessorDefinitions)',premake.esc(table.concat(cfg.defines, ";"))) @@ -309,6 +310,7 @@ premake.vstudio.vcxproj = { } end function item_link(cfg) + if cfg.kind ~= 'StaticLib' then _p(2,'') if #cfg.links > 0 then _p(3,'%s;%%(AdditionalDependencies)', @@ -340,6 +342,7 @@ premake.vstudio.vcxproj = { } _p(3,'%s', iif(cfg.platform == "x64", "MachineX64", "MachineX86")) _p(2,'') + end end function item_definitions(prj) diff --git a/tests/actions/vstudio/test_vs2010_links.lua b/tests/actions/vstudio/test_vs2010_links.lua index c195955c..6558b7a2 100644 --- a/tests/actions/vstudio/test_vs2010_links.lua +++ b/tests/actions/vstudio/test_vs2010_links.lua @@ -84,18 +84,20 @@ local buffer = get_buffer() test.string_contains(buffer,'true') end - + --[[ + StaticLib does not have this section function vs10_links.subSystem_consoleApp_valueInTagsIsConsole() local buffer = get_buffer() test.string_contains(buffer,'Console') end - + function vs10_links.subSystem_StaticLib_valueInTagsIsWindows() kind "StaticLib" local buffer = get_buffer() test.string_contains(buffer,'Windows') end - + --]] + function vs10_links.noOptimiseFlag_optimizeReferences_isNotInBuffer() local buffer = get_buffer() test.string_does_not_contain(buffer,'OptimizeReferences') 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 00000000..44f9be82 --- /dev/null +++ b/tests/actions/vstudio/test_vs2010_project_kinds.lua @@ -0,0 +1,29 @@ + 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 + + function vs10_project_kinds.staticLib_doesNotContainLinkSection() + kind "StaticLib" + local buffer = get_buffer() + test.string_does_not_contain(buffer,'*.*') + end \ No newline at end of file diff --git a/tests/premake4.lua b/tests/premake4.lua index 32401465..c852ba8a 100644 --- a/tests/premake4.lua +++ b/tests/premake4.lua @@ -70,7 +70,7 @@ 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/todo.txt b/todo.txt index e4c07144..945ec43e 100644 --- a/todo.txt +++ b/todo.txt @@ -12,6 +12,11 @@ Prevent the generation of an import library for a Windows DLL. add LinkIncremental support if no optimization and and exe?if cfg.kind ~= "StaticLib" then add ImportGroup section - which section????? +fix ProgramDataBaseFileName tag currently at line 285 see note which states + this can not be converted when using the upgrade tool + added for now but it will removed or altered when I find out + what is the correct thing to do. + support C support Managed C++ support C# From 223b5429f045eef886b42a880c3ddc6bd9889422 Mon Sep 17 00:00:00 2001 From: LiamDevine Date: Wed, 16 Jun 2010 19:20:41 +0100 Subject: [PATCH 08/19] checked lib section for a static lib --- src/actions/vstudio/vs2010_vcxproxj.lua | 2 +- tests/actions/vstudio/test_vs2010_project_kinds.lua | 11 +++++++++++ todo.txt | 8 ++------ 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/actions/vstudio/vs2010_vcxproxj.lua b/src/actions/vstudio/vs2010_vcxproxj.lua index 66496986..c32ba654 100644 --- a/src/actions/vstudio/vs2010_vcxproxj.lua +++ b/src/actions/vstudio/vs2010_vcxproxj.lua @@ -295,7 +295,7 @@ premake.vstudio.vcxproj = { } function item_def_lib(cfg) if cfg.kind == 'StaticLib' then _p(1,'') - _p(2,'$(OutDir)%s.lib',"some_name") + _p(2,'$(OutDir)%s',cfg.buildtarget.name) _p(1,'') end end diff --git a/tests/actions/vstudio/test_vs2010_project_kinds.lua b/tests/actions/vstudio/test_vs2010_project_kinds.lua index 44f9be82..91eb932f 100644 --- a/tests/actions/vstudio/test_vs2010_project_kinds.lua +++ b/tests/actions/vstudio/test_vs2010_project_kinds.lua @@ -26,4 +26,15 @@ kind "StaticLib" local buffer = get_buffer() test.string_does_not_contain(buffer,'*.*') + end + + function vs10_project_kinds.staticLib_containsLibSection() + kind "StaticLib" + local buffer = get_buffer() + test.string_contains(buffer,'*.**.*') + end + function vs10_project_kinds.staticLib_libSection_containsProjectNameDotLib() + kind "StaticLib" + local buffer = get_buffer() + test.string_contains(buffer,'*.**.*MyProject.lib*.**.*') end \ No newline at end of file diff --git a/todo.txt b/todo.txt index 945ec43e..e5146499 100644 --- a/todo.txt +++ b/todo.txt @@ -16,16 +16,12 @@ fix ProgramDataBaseFileName tag currently at line 285 see note which states this can not be converted when using the upgrade tool added for now but it will removed or altered when I find out what is the correct thing to do. + +check why true is missing in a debug static lib build support C support Managed C++ support C# -find out why a unit test is failing -fails at the following test_os line 16 - function suite.findlib_FindSystemLib() - local libname = iif(os.is("windows"), "user32", "m") - test.istrue(os.findlib(libname)) - end No64BitChecks is removed after being deprciated in previous releases From e1ca7109f17a25369858714d674d13bf8aac08db Mon Sep 17 00:00:00 2001 From: LiamDevine Date: Wed, 16 Jun 2010 19:34:21 +0100 Subject: [PATCH 09/19] Identified problems which need fixing --- tests/actions/vstudio/test_vs2010_project_kinds.lua | 10 +++++++++- todo.txt | 12 ++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/tests/actions/vstudio/test_vs2010_project_kinds.lua b/tests/actions/vstudio/test_vs2010_project_kinds.lua index 91eb932f..392a0a8c 100644 --- a/tests/actions/vstudio/test_vs2010_project_kinds.lua +++ b/tests/actions/vstudio/test_vs2010_project_kinds.lua @@ -37,4 +37,12 @@ kind "StaticLib" local buffer = get_buffer() test.string_contains(buffer,'*.**.*MyProject.lib*.**.*') - end \ No newline at end of file + end + + function vs10_project_kinds.sharedLib_fail_asIDoNotKnowWhatItShouldLookLike_printsTheBufferSoICanCompare() + kind "SharedLib" + local buffer = get_buffer() + test.string_contains(buffer,'youWillNotFindThis') + end + + \ No newline at end of file diff --git a/todo.txt b/todo.txt index e5146499..2b394846 100644 --- a/todo.txt +++ b/todo.txt @@ -17,8 +17,16 @@ fix ProgramDataBaseFileName tag currently at line 285 see note which states added for now but it will removed or altered when I find out what is the correct thing to do. -check why true is missing in a debug static lib build - +check why true is missing in a debug static lib and shared lib build +check OutDir in debug it is showing "." +shared lib missing EditAndContinue in ClCompile section +shared lib incorrectly true to false in link section +shared lib missing ??? in link section when noInportLib not used +shared lib LinkIncremental set to incorrect value of false +check all configs %(AdditionalIncludeDirectories) missing before AdditionalIncludeDirectories end tag in ClCompile + + + support C support Managed C++ support C# From 5c4d3cd4788430ffac13fb5368ccf7cdfad8f36b Mon Sep 17 00:00:00 2001 From: LiamDevine Date: Wed, 16 Jun 2010 23:50:57 +0100 Subject: [PATCH 10/19] check why true is missing in a debug static lib and shared lib build --------Requires symbols to be set in flags shared lib missing EditAndContinue in ClCompile section --------Requires symbols to be set in flags shared lib incorrectly true to false in link section --------Requires symbols to be set in flags shared lib LinkIncremental set to incorrect value of false ---Fixed and tests wrote check all configs %(AdditionalIncludeDirectories) missing before AdditionalIncludeDirectories end tag in ClCompile ---Fixed if no include Directories supplied, this tag is not present --- src/actions/vstudio/vs2010_vcxproxj.lua | 58 +++++++--- tests/actions/vstudio/test_vs2010_links.lua | 14 +-- .../vstudio/test_vs2010_project_kinds.lua | 102 +++++++++++++++++- todo.txt | 26 ++--- 4 files changed, 160 insertions(+), 40 deletions(-) diff --git a/src/actions/vstudio/vs2010_vcxproxj.lua b/src/actions/vstudio/vs2010_vcxproxj.lua index c32ba654..fbc732f0 100644 --- a/src/actions/vstudio/vs2010_vcxproxj.lua +++ b/src/actions/vstudio/vs2010_vcxproxj.lua @@ -50,13 +50,29 @@ premake.vstudio.vcxproj = { } _p(1,'') end end - function incremental_link(cfg) - if optimisation(cfg) ~= "Disabled" then - return 'true' - else - return 'false' + --NOTE: check this is correct + function incremental_link(cfg,cfginfo) + if cfg.kind ~= "StaticLib" then + ShoudLinkIncrementally = 'false' + if optimisation(cfg) == "Disabled" then + ShoudLinkIncrementally = 'true' + end + + _p(2,'%s' + ,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,'%s' + ,premake.esc(cfginfo.name),shouldIgnore) end - end + end + --needs revisiting for when there are dependency projects function intermediate_and_out_dirs(prj) _p(1,'') @@ -66,9 +82,9 @@ premake.vstudio.vcxproj = { } local cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform) _p(2,'%s', premake.esc(cfginfo.name),premake.esc(cfg.buildtarget.directory) ) _p(2,'%s', premake.esc(cfginfo.name), premake.esc(cfg.objectsdir)) - - _p(2,'%s',premake.esc(cfginfo.name),incremental_link(cfg)) - + ignore_import_lib(cfg,cfginfo) + --_p(2,'%s',premake.esc(cfginfo.name),incremental_link(cfg)) + incremental_link(cfg,cfginfo) if cfg.flags.NoManifest then _p(2,'false',premake.esc(cfginfo.name)) end @@ -138,9 +154,8 @@ premake.vstudio.vcxproj = { } function include_dirs(indent,cfg) if #cfg.includedirs > 0 then - _p(indent,'%s;%%(AdditionalIncludeDirectories)',premake.esc(path.translate(table.concat(cfg.includedirs, ";"), '\\'))) - else - _p(indent,'') + _p(indent,'%s;%%(AdditionalIncludeDirectories)' + ,premake.esc(path.translate(table.concat(cfg.includedirs, ";"), '\\'))) end end @@ -309,6 +324,17 @@ premake.vstudio.vcxproj = { } _p(3,'%s', 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"', iif(cfg.flags.NoImportLib, cfg.objectsdir .. "\\" .. path.getname(implibname), implibname)) + _p(3,' nothing to see here') + end + end + + + function item_link(cfg) if cfg.kind ~= 'StaticLib' then _p(2,'') @@ -338,7 +364,9 @@ premake.vstudio.vcxproj = { } if (cfg.kind == "ConsoleApp" or cfg.kind == "WindowedApp") and not cfg.flags.WinMain then _p(3,'mainCRTStartup') end - + + import_lib(cfg) + _p(3,'%s', iif(cfg.platform == "x64", "MachineX64", "MachineX86")) _p(2,'') @@ -367,6 +395,8 @@ premake.vstudio.vcxproj = { } end end + + --also translates file paths from '/' to '\\' function sort_input_files(files,sorted_container) local types = @@ -442,6 +472,7 @@ premake.vstudio.vcxproj = { } _p(1,'') end end + function write_file_filter_block(files,group_type) if #files > 0 then _p(1,'') @@ -458,6 +489,7 @@ premake.vstudio.vcxproj = { } _p(1,'') end end + function vcxproj_filter_files(prj) local sorted = { diff --git a/tests/actions/vstudio/test_vs2010_links.lua b/tests/actions/vstudio/test_vs2010_links.lua index 6558b7a2..e8f17600 100644 --- a/tests/actions/vstudio/test_vs2010_links.lua +++ b/tests/actions/vstudio/test_vs2010_links.lua @@ -84,19 +84,7 @@ local buffer = get_buffer() test.string_contains(buffer,'true') end - --[[ - StaticLib does not have this section - function vs10_links.subSystem_consoleApp_valueInTagsIsConsole() - local buffer = get_buffer() - test.string_contains(buffer,'Console') - end - - function vs10_links.subSystem_StaticLib_valueInTagsIsWindows() - kind "StaticLib" - local buffer = get_buffer() - test.string_contains(buffer,'Windows') - end - --]] + function vs10_links.noOptimiseFlag_optimizeReferences_isNotInBuffer() local buffer = get_buffer() diff --git a/tests/actions/vstudio/test_vs2010_project_kinds.lua b/tests/actions/vstudio/test_vs2010_project_kinds.lua index 392a0a8c..cb6af8cf 100644 --- a/tests/actions/vstudio/test_vs2010_project_kinds.lua +++ b/tests/actions/vstudio/test_vs2010_project_kinds.lua @@ -38,11 +38,109 @@ local buffer = get_buffer() test.string_contains(buffer,'*.**.*MyProject.lib*.**.*') end - + --[[ function vs10_project_kinds.sharedLib_fail_asIDoNotKnowWhatItShouldLookLike_printsTheBufferSoICanCompare() kind "SharedLib" local buffer = get_buffer() test.string_contains(buffer,'youWillNotFindThis') end + --]] - \ No newline at end of file + --[[ +check OutDir in debug it is showing "." +shared lib missing ??? in link section when noInportLib not used + --]] + --check why true 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,'*.*true*.*') + end + function vs10_project_kinds.sharedLib_valueInMinimalRebuildIsTrue() + kind "SharedLib" + flags {"Symbols"} + local buffer = get_buffer() + test.string_contains(buffer,'*.*true*.*') + end + --shared lib missing EditAndContinue in ClCompile section + function vs10_project_kinds.sharedLib_valueDebugInformationFormatIsEditAndContinue() + kind "SharedLib" + flags {"Symbols"} + local buffer = get_buffer() + test.string_contains(buffer,'*.*EditAndContinue*.*') + end + function vs10_project_kinds.sharedLib_valueGenerateDebugInformationIsTrue() + kind "SharedLib" + flags {"Symbols"} + local buffer = get_buffer() + test.string_contains(buffer,'*.*true*.*') + end + function vs10_project_kinds.sharedLib_linkSectionContainsImportLibrary() + kind "SharedLib" + local buffer = get_buffer() + test.string_contains(buffer,'*.**.**.*') + 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,'*.**.**.*') + end + + function vs10_project_kinds.sharedLib_withOutNoImportLibraryFlag_propertyGroupSectionContainsIgnoreImportLibrary() + kind "SharedLib" + local buffer = get_buffer() + test.string_contains(buffer,'*.**.*') + end + + function vs10_project_kinds.sharedLib_withNoImportLibraryFlag_propertyGroupSectionContainsIgnoreImportLibrary() + kind "SharedLib" + flags{"NoImportLib"} + local buffer = get_buffer() + test.string_contains(buffer,'*.**.*') + end + + function vs10_project_kinds.sharedLib_withOutNoImportLibraryFlag_ignoreImportLibraryValueIsFalse() + kind "SharedLib" + local buffer = get_buffer() + test.string_contains(buffer,'*.**.*') + end + + function vs10_project_kinds.sharedLib_withNoImportLibraryFlag_ignoreImportLibraryValueIsTrue() + kind "SharedLib" + flags{"NoImportLib"} + local buffer = get_buffer() + test.string_contains(buffer,'*.**.*') + 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,'') + end + + function vs10_project_kinds.sharedLib_withoutOptimisation_linkIncrementalValueIsTrue() + kind "SharedLib" + local buffer = get_buffer() + test.string_contains(buffer,'') + end + + function vs10_project_kinds.sharedLib_withOptimisation_linkIncrementalValueIsFalse() + kind "SharedLib" + flags{"Optimize"} + local buffer = get_buffer() + test.string_contains(buffer,'') + 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,'*.**.*') + end + \ No newline at end of file diff --git a/todo.txt b/todo.txt index 2b394846..ccca4aec 100644 --- a/todo.txt +++ b/todo.txt @@ -1,15 +1,9 @@ find why MFC in flags causes an error -add support for flags: Managed, MFC, NoImportLib, Unsafe +add support for flags: Managed, MFC, Unsafe -NoImportLib -Prevent the generation of an import library for a Windows DLL. - if cfg.kind == "SharedLib" then - local implibname = cfg.linktarget.fullpath - _p(4,'ImportLibrary="%s"', iif(cfg.flags.NoImportLib, cfg.objectsdir .. "\\" .. path.getname(implibname), implibname)) - end -add LinkIncremental support if no optimization and and exe?if cfg.kind ~= "StaticLib" then + add ImportGroup section - which section????? fix ProgramDataBaseFileName tag currently at line 285 see note which states @@ -18,14 +12,22 @@ fix ProgramDataBaseFileName tag currently at line 285 see note which states what is the correct thing to do. check why true is missing in a debug static lib and shared lib build -check OutDir in debug it is showing "." +--------Requires symbols to be set in flags shared lib missing EditAndContinue in ClCompile section +--------Requires symbols to be set in flags shared lib incorrectly true to false in link section -shared lib missing ??? in link section when noInportLib not used -shared lib LinkIncremental set to incorrect value of false +--------Requires symbols to be set in flags + + +shared lib LinkIncremental set to incorrect value of false + ---Fixed and tests wrote + check all configs %(AdditionalIncludeDirectories) missing before AdditionalIncludeDirectories end tag in ClCompile + ---Fixed if no include Directories supplied, this tag is not present - +check OutDir in debug it is showing "." --is this because no obj directory is supplied??? +shared lib missing ??? in link section when a static lib + ---I am confused at what the value should be support C support Managed C++ From b96a354abaef68d1232c7f0e35a9968f4602b8e4 Mon Sep 17 00:00:00 2001 From: LiamDevine Date: Thu, 17 Jun 2010 00:30:14 +0100 Subject: [PATCH 11/19] Moved filter functions into core from test file --- src/actions/vstudio/vs2010_vcxproxj.lua | 65 ++++++++++++++++++++- tests/actions/vstudio/test_vs2010_flags.lua | 2 +- todo.txt | 32 ++-------- 3 files changed, 71 insertions(+), 28 deletions(-) diff --git a/src/actions/vstudio/vs2010_vcxproxj.lua b/src/actions/vstudio/vs2010_vcxproxj.lua index fbc732f0..8eacf2b4 100644 --- a/src/actions/vstudio/vs2010_vcxproxj.lua +++ b/src/actions/vstudio/vs2010_vcxproxj.lua @@ -1,7 +1,70 @@ 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) for _, cfginfo in ipairs(prj.solution.vstudio_configs) do _p(1,'') diff --git a/tests/actions/vstudio/test_vs2010_flags.lua b/tests/actions/vstudio/test_vs2010_flags.lua index 1584906a..65df24c2 100644 --- a/tests/actions/vstudio/test_vs2010_flags.lua +++ b/tests/actions/vstudio/test_vs2010_flags.lua @@ -218,7 +218,7 @@ function vs10_flags.mfc_useOfMfc_setToStatic() flags{"MFC"} buffer = get_buffer() - --test.string_contains(buffer,'Static') + test.string_contains(buffer,'Static') end --]] diff --git a/todo.txt b/todo.txt index ccca4aec..ce12f609 100644 --- a/todo.txt +++ b/todo.txt @@ -1,37 +1,17 @@ -find why MFC in flags causes an error - -add support for flags: Managed, MFC, Unsafe - - - -add ImportGroup section - which section????? - -fix ProgramDataBaseFileName tag currently at line 285 see note which states - this can not be converted when using the upgrade tool - added for now but it will removed or altered when I find out - what is the correct thing to do. - -check why true is missing in a debug static lib and shared lib build ---------Requires symbols to be set in flags -shared lib missing EditAndContinue in ClCompile section ---------Requires symbols to be set in flags -shared lib incorrectly true to false in link section ---------Requires symbols to be set in flags - - -shared lib LinkIncremental set to incorrect value of false - ---Fixed and tests wrote - -check all configs %(AdditionalIncludeDirectories) missing before AdditionalIncludeDirectories end tag in ClCompile - ---Fixed if no include Directories supplied, this tag is not present check OutDir in debug it is showing "." --is this because no obj directory is supplied??? shared lib missing ??? in link section when a static lib ---I am confused at what the value should be +add support for flags: Managed, MFC, Unsafe support C support Managed C++ support C# No64BitChecks is removed after being deprciated in previous releases +find why MFC in flags causes an error +fix ProgramDataBaseFileName tag currently at line 285 see note which states + this can not be converted when using the upgrade tool + added for now but it will removed or altered when I find out + what is the correct thing to do. \ No newline at end of file From 917217bc8f226e13afa56310d771214aa27d07a5 Mon Sep 17 00:00:00 2001 From: LiamDevine Date: Thu, 17 Jun 2010 00:30:52 +0100 Subject: [PATCH 12/19] Never saved before commit oops --- tests/actions/vstudio/test_vs2010_filters.lua | 59 ------------------- 1 file changed, 59 deletions(-) diff --git a/tests/actions/vstudio/test_vs2010_filters.lua b/tests/actions/vstudio/test_vs2010_filters.lua index e0eaf386..d4e7b847 100644 --- a/tests/actions/vstudio/test_vs2010_filters.lua +++ b/tests/actions/vstudio/test_vs2010_filters.lua @@ -1,66 +1,7 @@ T.vs2010_filters = { } local vs10_filters = T.vs2010_filters - 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 sln, prj function vs10_filters.setup() From db0f215e9586a10f4577ea813b381bc37b3487f0 Mon Sep 17 00:00:00 2001 From: LiamDevine Date: Thu, 17 Jun 2010 00:47:45 +0100 Subject: [PATCH 13/19] added failing test for ImportLibrary to remind me there is an unknown --- tests/actions/vstudio/test_vs2010_project_kinds.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/actions/vstudio/test_vs2010_project_kinds.lua b/tests/actions/vstudio/test_vs2010_project_kinds.lua index cb6af8cf..2965f1d4 100644 --- a/tests/actions/vstudio/test_vs2010_project_kinds.lua +++ b/tests/actions/vstudio/test_vs2010_project_kinds.lua @@ -81,6 +81,12 @@ shared lib missing ??? in link section when noIn local buffer = get_buffer() test.string_contains(buffer,'*.**.**.*') end + + function vs10_project_kinds.sharedLib_ImportLibraryTestWillFail_IDoNotKnowWhatShouldBeInsideTheTags() + kind "SharedLib" + local buffer = get_buffer() + test.string_contains(buffer,'*.*You will not see this*.*') + end --should this go in vs2010_flags??? function vs10_project_kinds.sharedLib_withNoImportLibraryFlag_linkSectionContainsImportLibrary() From f00217f741d583a8c9bb604ea1464ee01f5c7a6b Mon Sep 17 00:00:00 2001 From: LiamDevine Date: Fri, 18 Jun 2010 00:27:34 +0100 Subject: [PATCH 14/19] removed invalid assumptions which were checked in unit tests added link section even when a static lib added ProgramDatabaseFile to link section --- src/actions/vstudio/vs2010_vcxproxj.lua | 31 +++++++++--- tests/actions/vstudio/test_vs2010_flags.lua | 3 +- .../vstudio/test_vs2010_project_kinds.lua | 8 +-- todo.txt | 50 +++++++++++++++++-- 4 files changed, 79 insertions(+), 13 deletions(-) diff --git a/src/actions/vstudio/vs2010_vcxproxj.lua b/src/actions/vstudio/vs2010_vcxproxj.lua index 8eacf2b4..a26cf18b 100644 --- a/src/actions/vstudio/vs2010_vcxproxj.lua +++ b/src/actions/vstudio/vs2010_vcxproxj.lua @@ -390,17 +390,32 @@ premake.vstudio.vcxproj = { } 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 + local implibname = cfg.linktarget.fullpath --_p(3,'ImportLibrary="%s"', iif(cfg.flags.NoImportLib, cfg.objectsdir .. "\\" .. path.getname(implibname), implibname)) - _p(3,' nothing to see here') + _p(3,'%s',iif(cfg.flags.NoImportLib, cfg.objectsdir .. "\\" .. path.getname(implibname), implibname)) end end + function common_link_section(cfg) + _p(3,'%s',iif(cfg.kind == "ConsoleApp","Console", "Windows")) + + if cfg.flags.Symbols then + _p(3,'true') + else + _p(3,'false') + end + + if optimisation(cfg) ~= "Disabled" then + _p(3,'true') + _p(3,'true') + end + end function item_link(cfg) - if cfg.kind ~= 'StaticLib' then _p(2,'') + if cfg.kind ~= 'StaticLib' then + if #cfg.links > 0 then _p(3,'%s;%%(AdditionalDependencies)', table.concat(premake.getlinks(cfg, "all", "fullpath"), ";")) @@ -410,7 +425,7 @@ premake.vstudio.vcxproj = { } _p(3,'%s%s%%(AdditionalLibraryDirectories)', table.concat(premake.esc(path.translate(cfg.libdirs, '\\')) , ";"), iif(cfg.libdirs and #cfg.libdirs >0,';','')) - + --[[ if cfg.flags.Symbols then _p(3,'true') else @@ -423,7 +438,8 @@ premake.vstudio.vcxproj = { } _p(3,'true') _p(3,'true') end - + --]] + common_link_section(cfg) if (cfg.kind == "ConsoleApp" or cfg.kind == "WindowedApp") and not cfg.flags.WinMain then _p(3,'mainCRTStartup') end @@ -432,8 +448,11 @@ premake.vstudio.vcxproj = { } _p(3,'%s', iif(cfg.platform == "x64", "MachineX64", "MachineX86")) - _p(2,'') + else + common_link_section(cfg) end + + _p(2,'') end function item_definitions(prj) diff --git a/tests/actions/vstudio/test_vs2010_flags.lua b/tests/actions/vstudio/test_vs2010_flags.lua index 65df24c2..fdc54a57 100644 --- a/tests/actions/vstudio/test_vs2010_flags.lua +++ b/tests/actions/vstudio/test_vs2010_flags.lua @@ -246,10 +246,11 @@ end --[[ this causes a problem when a project is updated with the command line tool yet it is here until the correct course of action is found +moving to Link section --]] function vs10_flags.programDataBaseFile() buffer = get_buffer() - test.string_contains(buffer,'%$%(OutDir%)MyProject%.pdb') + test.string_contains(buffer,'*.*%$%(OutDir%)MyProject%.pdb*.*') end diff --git a/tests/actions/vstudio/test_vs2010_project_kinds.lua b/tests/actions/vstudio/test_vs2010_project_kinds.lua index 2965f1d4..e6f2abf6 100644 --- a/tests/actions/vstudio/test_vs2010_project_kinds.lua +++ b/tests/actions/vstudio/test_vs2010_project_kinds.lua @@ -21,12 +21,14 @@ 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,'*.*') end + --]] function vs10_project_kinds.staticLib_containsLibSection() kind "StaticLib" @@ -82,10 +84,10 @@ shared lib missing ??? in link section when noIn test.string_contains(buffer,'*.**.**.*') end - function vs10_project_kinds.sharedLib_ImportLibraryTestWillFail_IDoNotKnowWhatShouldBeInsideTheTags() + function vs10_project_kinds.sharedLib_bufferContainsImportLibrary() kind "SharedLib" local buffer = get_buffer() - test.string_contains(buffer,'*.*You will not see this*.*') + test.string_contains(buffer,'*.*MyProject.lib*.*') end --should this go in vs2010_flags??? diff --git a/todo.txt b/todo.txt index ce12f609..c8df9149 100644 --- a/todo.txt +++ b/todo.txt @@ -2,16 +2,60 @@ check OutDir in debug it is showing "." --is this because no obj directory is supplied??? shared lib missing ??? in link section when a static lib ---I am confused at what the value should be + --as explain by starkos this is to hide the lib in the obj directory which seems to + --still be the valid thing to do with vs2010 add support for flags: Managed, MFC, Unsafe support C support Managed C++ support C# - +find why MFC in flags causes an error --pull the latest stable/vs2010 branch for MFC patch + No64BitChecks is removed after being deprciated in previous releases -find why MFC in flags causes an error + fix ProgramDataBaseFileName tag currently at line 285 see note which states this can not be converted when using the upgrade tool added for now but it will removed or altered when I find out - what is the correct thing to do. \ No newline at end of file + what is the correct thing to do. + + $(TargetDir)$(TargetName).pdb + ----------Needs moving to link section for vs2010(dll checked- yet probably all) + =======Done + + + Link is ignored for static libs and this is incorrect + ======Done + + Hmm should the project define DEBUG and NDEBUG depending on if debugging info is on?? + should the project define _WINDOWS when using WinMain? + + + + + DynamicLibrary + false--missing + is this used when there are symbols + hmm profiling uses symbols does it not??? + + + currently the below format is not generated yet it uses the format from when + a vs upgrade is done. change this + + true + false + false + + + false + + + dll + + true + \ No newline at end of file From ff650b85cf72b5fe0bec7a9a678ec7f97d7e0d60 Mon Sep 17 00:00:00 2001 From: LiamDevine Date: Fri, 18 Jun 2010 00:49:48 +0100 Subject: [PATCH 15/19] faulty test was passing. fixed --- src/actions/vstudio/vs2010_vcxproxj.lua | 12 ++++-------- tests/actions/vstudio/test_vs2010_flags.lua | 8 ++------ 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/src/actions/vstudio/vs2010_vcxproxj.lua b/src/actions/vstudio/vs2010_vcxproxj.lua index a26cf18b..cb908fca 100644 --- a/src/actions/vstudio/vs2010_vcxproxj.lua +++ b/src/actions/vstudio/vs2010_vcxproxj.lua @@ -332,14 +332,7 @@ premake.vstudio.vcxproj = { } floating_point(cfg) debug_info(cfg) - --[[ - NOTE: TODO: - this can not be converted when using the upgrade tool - added for now but it will removed or altered when I find out - what is the correct thing to do. - --]] - _p(3,'$(OutDir)%s.pdb', path.getbasename(cfg.buildtarget.name)) - + if cfg.flags.NoFramePointer then _p(3,'true') end @@ -410,6 +403,9 @@ premake.vstudio.vcxproj = { } _p(3,'true') _p(3,'true') end + + _p(3,'$(OutDir)%s.pdb', path.getbasename(cfg.buildtarget.name)) + end function item_link(cfg) diff --git a/tests/actions/vstudio/test_vs2010_flags.lua b/tests/actions/vstudio/test_vs2010_flags.lua index fdc54a57..f66c2211 100644 --- a/tests/actions/vstudio/test_vs2010_flags.lua +++ b/tests/actions/vstudio/test_vs2010_flags.lua @@ -243,14 +243,10 @@ function vs10_flags.noManifest_GenerateManifest_setToFalse() test.string_contains(buffer,'false') end ---[[ -this causes a problem when a project is updated with the command line tool -yet it is here until the correct course of action is found -moving to Link section ---]] + function vs10_flags.programDataBaseFile() buffer = get_buffer() - test.string_contains(buffer,'*.*%$%(OutDir%)MyProject%.pdb*.*') + test.string_contains(buffer,'.*%$%(OutDir%)MyProject%.pdb.*') end From 2e6b86c1c06e533986d8182eda1ce491b39aa205 Mon Sep 17 00:00:00 2001 From: LiamDevine Date: Sun, 20 Jun 2010 01:07:39 +0100 Subject: [PATCH 16/19] changed any comments to line from blocks as parser failed addded postfix slashes to int and out dirs removed quotes from event hooks moved event hooks to correct location added target name to prevent warnings due to changes in vs using MSBuild changed errors in wildcard searches that for some reason I was using through out Found error in that a clean operation was registered within actions yet another function is called. Can currently generate sln and proj files for C++ using most configs and compile then, see todo for exceptions --- src/actions/vstudio/_vstudio.lua | 3 +- src/actions/vstudio/vs2010_vcxproxj.lua | 163 ++++++++++-------- src/host/scripts.c | 40 ++++- tests/actions/vstudio/test_vs2010_filters.lua | 2 +- tests/actions/vstudio/test_vs2010_links.lua | 4 +- .../vstudio/test_vs2010_project_kinds.lua | 36 ++-- tests/actions/vstudio/test_vs2010_vcxproj.lua | 126 ++++++++++---- todo.txt | 24 +-- 8 files changed, 244 insertions(+), 154 deletions(-) diff --git a/src/actions/vstudio/_vstudio.lua b/src/actions/vstudio/_vstudio.lua index b6639218..3cde3b38 100644 --- a/src/actions/vstudio/_vstudio.lua +++ b/src/actions/vstudio/_vstudio.lua @@ -154,7 +154,8 @@ premake.clean.file(sln, "%%.usertasks") end - function premake.vstudio.cleanproject(prj) + function premake.vstudio.cleanproject(prj) + io.write("generic vs clean project") local fext = iif(premake.isdotnetproject(prj), ".csproj", ".vcproj") local fname = premake.project.getfilename(prj, "%%") diff --git a/src/actions/vstudio/vs2010_vcxproxj.lua b/src/actions/vstudio/vs2010_vcxproxj.lua index cb908fca..d5dee0c0 100644 --- a/src/actions/vstudio/vs2010_vcxproxj.lua +++ b/src/actions/vstudio/vs2010_vcxproxj.lua @@ -68,7 +68,7 @@ premake.vstudio.vcxproj = { } local function vs2010_config(prj) for _, cfginfo in ipairs(prj.solution.vstudio_configs) do _p(1,'') - _p(2,'', premake.esc(cfginfo.name)) _p(3,'%s',cfginfo.buildcfg) _p(3,'%s',cfginfo.platform) _p(2,'') @@ -143,8 +143,9 @@ premake.vstudio.vcxproj = { } for _, cfginfo in ipairs(prj.solution.vstudio_configs) do local cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform) - _p(2,'%s', premake.esc(cfginfo.name),premake.esc(cfg.buildtarget.directory) ) - _p(2,'%s', premake.esc(cfginfo.name), premake.esc(cfg.objectsdir)) + _p(2,'%s\\', premake.esc(cfginfo.name),premake.esc(cfg.buildtarget.directory) ) + _p(2,'%s\\', premake.esc(cfginfo.name), premake.esc(cfg.objectsdir)) + _p(2,'%s',premake.esc(cfginfo.name),path.getbasename(cfg.buildtarget.name)) ignore_import_lib(cfg,cfginfo) --_p(2,'%s',premake.esc(cfginfo.name),incremental_link(cfg)) incremental_link(cfg,cfginfo) @@ -190,23 +191,23 @@ premake.vstudio.vcxproj = { } end --have a look at this and translate - --[[ - function vs10_vcxproj_symbols(cfg) - if (not cfg.flags.Symbols) then - return 0 - else + -- + --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 - --]] + -- 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,'%s;%%(PreprocessorDefinitions)',premake.esc(table.concat(cfg.defines, ";"))) @@ -269,11 +270,11 @@ premake.vstudio.vcxproj = { } end function debug_info(cfg) - --[[ - EditAndContinue /ZI - ProgramDatabase /Zi - OldStyle C7 Compatable /Z7 - --]] + -- + -- EditAndContinue /ZI + -- ProgramDatabase /Zi + -- OldStyle C7 Compatable /Z7 + -- if cfg.flags.Symbols and not cfg.flags.NoEditAndContinue then _p(3,'EditAndContinue') else @@ -345,21 +346,21 @@ premake.vstudio.vcxproj = { } function event_hooks(cfg) if #cfg.postbuildcommands> 0 then - _p(1,'') - _p(2,'"%s"',premake.esc(table.implode(cfg.postbuildcommands, "", "", "\r\n"))) - _p(1,'') + _p(2,'') + _p(3,'%s',premake.esc(table.implode(cfg.postbuildcommands, "", "", "\r\n"))) + _p(2,'') end if #cfg.prebuildcommands> 0 then - _p(1,'') - _p(2,'"%s"',premake.esc(table.implode(cfg.prebuildcommands, "", "", "\r\n"))) - _p(1,'') + _p(2,'') + _p(3,'%s',premake.esc(table.implode(cfg.prebuildcommands, "", "", "\r\n"))) + _p(2,'') end if #cfg.prelinkcommands> 0 then - _p(1,'') - _p(2,'"%s"',premake.esc(table.implode(cfg.prelinkcommands, "", "", "\r\n"))) - _p(1,'') + _p(2,'') + _p(3,'%s',premake.esc(table.implode(cfg.prelinkcommands, "", "", "\r\n"))) + _p(2,'') end end @@ -421,20 +422,20 @@ premake.vstudio.vcxproj = { } _p(3,'%s%s%%(AdditionalLibraryDirectories)', table.concat(premake.esc(path.translate(cfg.libdirs, '\\')) , ";"), iif(cfg.libdirs and #cfg.libdirs >0,';','')) - --[[ - if cfg.flags.Symbols then - _p(3,'true') - else - _p(3,'false') - end + -- + --if cfg.flags.Symbols then + -- _p(3,'true') + --else + -- _p(3,'false') + --end - _p(3,'%s',iif(cfg.kind == "ConsoleApp","Console", "Windows")) + -- _p(3,'%s',iif(cfg.kind == "ConsoleApp","Console", "Windows")) - if optimisation(cfg) ~= "Disabled" then - _p(3,'true') - _p(3,'true') - end - --]] + --if optimisation(cfg) ~= "Disabled" then + -- _p(3,'true') + -- _p(3,'true') + --end + -- common_link_section(cfg) if (cfg.kind == "ConsoleApp" or cfg.kind == "WindowedApp") and not cfg.flags.WinMain then _p(3,'mainCRTStartup') @@ -458,10 +459,11 @@ premake.vstudio.vcxproj = { } vs10_clcompile(cfg) resource_compile(cfg) item_def_lib(cfg) - item_link(cfg) + item_link(cfg) + event_hooks(cfg) _p(1,'') - event_hooks(cfg) + end end @@ -501,14 +503,14 @@ premake.vstudio.vcxproj = { } end end end - --[[ - 02 - 303 - 304 {8fd826f8-3739-44e6-8cc8-997122e53b8d} - 305 - 306 - - --]] + -- + -- + -- + -- {8fd826f8-3739-44e6-8cc8-997122e53b8d} + -- + -- + -- + function write_file_type_block(files,group_type) if #files > 0 then _p(1,'') @@ -589,15 +591,15 @@ premake.vstudio.vcxproj = { } _p('') end ---[[ - - - - Create - Create - - ---]] +-- + -- + -- + -- + -- Create + -- Create + -- + -- +-- function premake.vs2010_vcxproj(prj) io.eol = "\r\n" _p('') @@ -648,20 +650,39 @@ premake.vstudio.vcxproj = { } function premake.vs2010_cleansolution(sln) premake.clean.file(sln, "%%.sln") premake.clean.file(sln, "%%.suo") - premake.clean.file(sln, "%%.sdf") + --premake.clean.file(sln, "%%.sdf") end - function premake.vs2010_cleanproject(prj) - local fname = premake.project.getfilename(prj, "%%") + 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') - --[[ - local userfiles = os.matchfiles(fname .. ".*.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) diff --git a/src/host/scripts.c b/src/host/scripts.c index 5f11b872..07be9b0f 100644 --- a/src/host/scripts.c +++ b/src/host/scripts.c @@ -161,14 +161,14 @@ const char* builtin_scripts[] = { /* actions/vstudio/_vstudio.lua */ "_VS = { } -- deprecated, will remove eventually\npremake.vstudio = { }\nlocal vstudio = premake.vstudio\npremake.vstudio_platforms = { \nany = \"Any CPU\", \nmixed = \"Mixed Platforms\", \nNative = \"Win32\",\nx32 = \"Win32\", \nx64 = \"x64\",\nPS3 = \"PS3\",\nXbox360 = \"Xbox 360\",\n}\nfunction _VS.arch(prj)\nif (prj.language == \"C#\") then\nif (_ACTION < \"vs2005\") then\nreturn \".NET\"\nelse\nreturn \"Any CPU\"\nend\nelse\nreturn \"Win32\"\nend\nend\nfunction _VS.bool(value)\nif (_ACTION < \"vs2005\") then\nreturn iif(value, \"TRUE\", \"FALSE\")\nelse\nreturn iif(value, \"true\", \"false\")\nend\nend\nfunction premake.vstudio_buildconfigs(sln)\nlocal cfgs = { }\nlocal platforms = premake.filterplatforms(sln, premake.vstudio_platforms, \"Native\")\nlocal hascpp = premake.hascppproject(sln)\nlocal hasdotnet = premake.hasdotnetproject(sln)\nif hasdotnet then\ntable.insert(platforms, 1, \"any\")\nend\nif hasdotnet and hascpp then\ntable.insert(platforms, 2, \"mixed\")\nend\nfor _, buil" - "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, \"\")\nelseif (state == \"GroupEnd\") then\noutput(indent, \"\")\nelse\nou" - "tput(indent, \"\")\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\")\noutput(indent, \"\\t\\t\")\noutput(indent, \"\\t\")\nend\nend\nend\noutput(indent, \"\")\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", + "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)\nio.write(\"generic vs clean project\")\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, \"\")\nelseif (state == \"GroupEnd\") then" + "\noutput(indent, \"\")\nelse\noutput(indent, \"\")\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\")\noutput(indent, \"\\t\\t\")\noutput(indent, \"\\t\")\nend\nend\nend\noutput(indent, \"\")\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\nend\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\"\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\", prema" + "ke.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)\nif premake.isdotnetproject(prj) then\npremake.gene" + "rate(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.vs200" + "5_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,\noncleansol" + "ution = 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++\"},\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 = premake.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 +223,30 @@ const char* builtin_scripts[] = { /* actions/vstudio/vs2005_csproj_user.lua */ "function premake.vs2005_csproj_user(prj)\nio.eol = \"\\r\\n\"\n_p('')\n_p(' ')\nlocal refpaths = table.translate(prj.libdirs, function(v) return path.getabsolute(prj.location .. \"/\" .. v) end)\n_p(' %s', path.translate(table.concat(refpaths, \";\"), \"\\\\\"))\n_p(' ')\n_p('')\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) d" + "o\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)\nfor _, cfginfo in ipairs(prj.solution.vstudio_configs) do\n_p(1,'')\n_p(2,'', premake.esc(cfginfo.name))\n_p(3,'%s',cfginfo.buildcfg)\n_p(3,'%s',cfginfo.platform)\n_p(2,'')\n_p(1,'')\nend\nend\nlocal function vs2010_globals(prj)\n_p(1,'')\n_p(2,'{%s}',prj.uuid)\n_p(2,'%s',prj.name)\n_p(2,'Win32Proj')\n_p(1,'')\nend\nfunction config_type(config)\nlocal t =\n{\nSharedLib = \"DynamicLibrary\",\nStaticLib = \"StaticLibrary\",\nConsoleApp = \"Application\",\n}\nreturn t[config.kind]\nend\nfunctio" + "n 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,'', premake.esc(cfginfo.name))\n_p(2,'%s',config_type(cfg))\n_p(2,'%s',iif(cfg.flags.Unicode,\"Unicode\",\"MultiByte\"))\n_p(1,'')\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,'',premake.esc(cfginfo.name))\n_p(2,'')\n_p(1,'')\nend\ne" + "nd\nfunction incremental_link(cfg,cfginfo)\nif cfg.kind ~= \"StaticLib\" then\nShoudLinkIncrementally = 'false'\nif optimisation(cfg) == \"Disabled\" then\nShoudLinkIncrementally = 'true'\nend\n_p(2,'%s'\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,'%s'\n,premake.esc(cfginfo.name),shouldIgnore)\nend\nend\nfunction intermediate_and_out_dirs(prj)\n_p(1,'')\n_p(2,'<_ProjectFileVersion>10.0.30319.1')\nfor _, cfginfo in ipairs(prj.solution.vstudio_configs) do\nlocal cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform)\n_p(2,'%s\\\\', premake.esc(cfginfo.name),premake.esc(cfg.buildtarget.directory) )\n_p(2,'%s\\\\', premake.esc(cfginfo.name), premake.esc(cfg.objectsdir))\n_p(2,'%s',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,'false',premake.esc(cfginfo.name))\nend\nend\n_p(1,'')\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 c" + "fg.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,'Use')\n_p(3,'%s', path.getname(cfg.pchheader))\nelse\n_p(3,'')\nend\nend\nfunction preprocessor(indent,cfg)\nif #cfg.defines > 0 then\n_p(indent,'%s;%%(PreprocessorDefinitions)',premake.esc(table.concat(cfg.defines, \";\")))\nelse\n_p(indent,'')\nend\nend\nfunction include_dirs(indent,cfg)\nif #cfg.includedirs > 0 then\n_p(indent,'%s;%%(AdditionalIncludeDirectories)'\n,premake.esc(path.translate(table.concat(cfg.includedi" + "rs, \";\"), '\\\\')))\nend\nend\nfunction resource_compile(cfg)\n_p(2,'')\npreprocessor(3,cfg)\ninclude_dirs(3,cfg)\n_p(2,'')\nend\nfunction exceptions(cfg)\nif cfg.flags.NoExceptions then\n_p(2,'false')\nelseif cfg.flags.SEH then\n_p(2,'Async')\nend\nend\nfunction rtti(cfg)\nif cfg.flags.NoRTTI then\n_p(3,'false')\nend\nend\nfunction wchar_t_buildin(cfg)\nif cfg.flags.NativeWChar then\n_p(3,'true')\nelseif cfg.flags.NoNativeWChar then\n_p(3,'false')\nend\nend\nfunction sse(cfg)\nif cfg.flags.EnableSSE then\n_p(3,'StreamingSIMDExtensions')\nelseif cfg.flags.EnableSSE2 then\n_p(3,'StreamingSIMDExtensions2')\nend\nend\nfunction floating_po" + "int(cfg)\n if cfg.flags.FloatFast then\n_p(3,'Fast')\nelseif cfg.flags.FloatStrict then\n_p(3,'Strict')\nend\nend\nfunction debug_info(cfg)\nif cfg.flags.Symbols and not cfg.flags.NoEditAndContinue then\n_p(3,'EditAndContinue')\nelse\n_p(3,'')\nend\nend\nfunction minimal_build(cfg)\nif cfg.flags.Symbols and not cfg.flags.NoMinimalRebuild then\n_p(3,'true')\nelseif cfg.flags.Symbols then\n_p(3,'false')\nend\nend\nfunction vs10_clcompile(cfg)\n_p(2,'')\nif #cfg.buildoptions > 0 then\n_p(3,'%s %%(AdditionalOptions)',\ntable.concat(premake.esc(cfg.buildoptions), \" \"))\nend\n_p(3,'%s',optimisation(cfg))\ninclude_dirs(3,cfg)\npreprocessor(3,cfg)\nminimal_build(cfg)\nif optimisation(cfg) == " + "\"Disabled\" and not cfg.flags.Managed then\n_p(3,'EnableFastChecks')\nend\nif optimisation(cfg) ~= \"Disabled\" then\n_p(3,'true')\nend\n_p(3,'%s', runtime(cfg))\n_p(3,'true')\nprecompiled_header(cfg)\n_p(3,'Level%s', iif(cfg.flags.ExtraWarnings, 4, 3))\nif cfg.flags.FatalWarnings then\n_p(3,'true')\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,'true')\nend\n_p(2,'')\nend\nfunction event_hooks(cfg)\nif #cfg.postbuildcommands> 0 then\n _p(2,'')\n_p(3,'%s',premake.esc(table.implode(cfg.postbuildcommands, \"\", \"\", \"\\r\\n\")))\n_p(2,'')\nend\nif #cfg.prebuildcommands> 0 then\n _p(2,'')\n_p(3,'%s',premake.esc(table.implode(cfg.prebuildcommands, \"\", \"\", \"\\r\\n\")))\n_p(2,'')\nend\nif #cfg.prelinkcommands> 0 then\n _p(2,'')\n_p(3,'%s',premake.esc(table.implode(cfg.prelinkcommands, \"\", \"\", \"\\r\\n\")))\n_p(2,'')\nend\nend\nfunction item_def_lib(cfg)\nif cfg.kind == 'StaticLib' then\n_p(1,'')\n_p(2,'$(OutDir)%s',cfg.buildtarget.name)\n_p(1,'')\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,'%s', target)\nend\nfunction import_lib(cfg)\nif cfg.kind == \"SharedLib\" then\nlocal implibname = cfg.linktarget.fullpath\n_p(3,'%s',iif(cfg.flags.NoImportLib, cfg.objectsdir .. \"\\\\\" .. path.getname(implibname), implibname))\nend\nend\nfuncti" + "on common_link_section(cfg)\n_p(3,'%s',iif(cfg.kind == \"ConsoleApp\",\"Console\", \"Windows\"))\nif cfg.flags.Symbols then \n_p(3,'true')\nelse\n_p(3,'false')\nend\nif optimisation(cfg) ~= \"Disabled\" then\n_p(3,'true')\n_p(3,'true')\nend\n_p(3,'$(OutDir)%s.pdb', path.getbasename(cfg.buildtarget.name))\nend\nfunction item_link(cfg)\n_p(2,'')\nif cfg.kind ~= 'StaticLib' then\nif #cfg.links > 0 then\n_p(3,'%s;%%(AdditionalDependencies)',\ntable.concat(premake.getlinks(cfg, \"all\", \"fullpath\"), \";\"))\nend\n_p(3,'$(OutDir)%s', cfg.buildtarget.name)\n_p(3,'%s%s%%(AdditionalLibraryDirectories)',\ntable.concat(pr" + "emake.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,'mainCRTStartup')\nend\nimport_lib(cfg)\n_p(3,'%s', iif(cfg.platform == \"x64\", \"MachineX64\", \"MachineX86\"))\nelse\ncommon_link_section(cfg)\nend\n_p(2,'')\nend\n \nfunction item_definitions(prj)\nfor _, cfginfo in ipairs(prj.solution.vstudio_configs) do\nlocal cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform)\n_p(1,'',premake.esc(cfginfo.name))\nvs10_clcompile(cfg)\nresource_compile(cfg)\nitem_def_lib(cfg)\nitem_link(cfg)\nevent_hooks(cfg)\n_p(1,'')\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_container[type],translated_path)\nelse\ntable.insert(sorted_container.None,translated_path)\nend\nend\nend\nend\n -- \n -- {8fd826f8-3739-44e6-8cc8-997122e53b8d}\n -- \n -- \nfunction write_file_type_block(files,group_type)\nif #files > 0 then\n_p(1,'')\nfor _, current_file in ipairs(files) do\n_p(2,'<%s Include=\\\"%s\\\" />', group_type,current_file)\nend\n_p(1,'')\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,'')\nfor _, dir in pairs(directories) do\n_p(2,'',dir)\n_p(3,'{%s}',os.uuid())\n_p(2,'')\nend\n_p(1,'')\nend\nend\nfunction write_file_filter_block(files,group_type)\nif #files > 0 then\n_p(1,'')\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,'%s',path_to_file)\n_p(2,'',group_type)\nelse\n_p(2,'<%s Include=\\\"%s\\\" " + "/>', group_type,path.translate(current_file, \"\\\\\"))\nend\nend\n_p(1,'')\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('')\n_p('')\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('')\nend\n -- \n -- \n -- \n -- Create\n -- Create\n --\n --" + "\nfunction premake.vs2010_vcxproj(prj)\nio.eol = \"\\r\\n\"\n_p('')\n_p('')\nvs2010_config(prj)\nvs2010_globals(prj)\n_p(1,'')\nconfig_type_block(prj)\n_p(1,'')\n_p(1,'')\n_p(1,'')\nimport_props(prj)\n_p(1,'')\nintermediate_and_out_dirs(prj)\nitem_definitions(prj)\nvcxproj_files(prj)\n_p(1,'')\n_p(1,'')\n_p(1,'')\n_p('')\nend\nfunction premake.vs2010_vcxproj_user(prj)\n_p('')\n_p('')\n_p('')\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.r" + "emove(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", diff --git a/tests/actions/vstudio/test_vs2010_filters.lua b/tests/actions/vstudio/test_vs2010_filters.lua index d4e7b847..c26c8ca7 100644 --- a/tests/actions/vstudio/test_vs2010_filters.lua +++ b/tests/actions/vstudio/test_vs2010_filters.lua @@ -312,7 +312,7 @@ "dontCare\\dontCare.h" } local buffer = get_buffer() - test.string_contains(buffer,"*.**.*") + test.string_contains(buffer,".*.*") end function vs10_filters.oneInputFileWithDirectory_bufferContainsTagFilterWithIncludeSetToFoo() diff --git a/tests/actions/vstudio/test_vs2010_links.lua b/tests/actions/vstudio/test_vs2010_links.lua index e8f17600..0d6b1282 100644 --- a/tests/actions/vstudio/test_vs2010_links.lua +++ b/tests/actions/vstudio/test_vs2010_links.lua @@ -26,7 +26,7 @@ function vs10_links.hasLinkBlock() local buffer = get_buffer() - test.string_contains(buffer,'*.*') + test.string_contains(buffer,'.*') end function vs10_links.additionalDependancies_isInsideLinkBlock() @@ -34,7 +34,7 @@ links{"link_test"} local buffer = get_buffer() test.string_contains(buffer, - '*.**.*%%%(AdditionalDependencies%)*.*') + '.*.*%%%(AdditionalDependencies%).*') end function vs10_links.additionalDependancies_containsLinkTestDotLib() diff --git a/tests/actions/vstudio/test_vs2010_project_kinds.lua b/tests/actions/vstudio/test_vs2010_project_kinds.lua index e6f2abf6..0a19b491 100644 --- a/tests/actions/vstudio/test_vs2010_project_kinds.lua +++ b/tests/actions/vstudio/test_vs2010_project_kinds.lua @@ -26,19 +26,19 @@ function vs10_project_kinds.staticLib_doesNotContainLinkSection() kind "StaticLib" local buffer = get_buffer() - test.string_does_not_contain(buffer,'*.*') + test.string_does_not_contain(buffer,'.*') end --]] function vs10_project_kinds.staticLib_containsLibSection() kind "StaticLib" local buffer = get_buffer() - test.string_contains(buffer,'*.**.*') + test.string_contains(buffer,'.*.*') end function vs10_project_kinds.staticLib_libSection_containsProjectNameDotLib() kind "StaticLib" local buffer = get_buffer() - test.string_contains(buffer,'*.**.*MyProject.lib*.**.*') + test.string_contains(buffer,'.*.*MyProject.lib.*.*') end --[[ function vs10_project_kinds.sharedLib_fail_asIDoNotKnowWhatItShouldLookLike_printsTheBufferSoICanCompare() @@ -57,37 +57,37 @@ shared lib missing ??? in link section when noIn kind "StaticLib" flags {"Symbols"} local buffer = get_buffer() - test.string_contains(buffer,'*.*true*.*') + test.string_contains(buffer,'.*true.*') end function vs10_project_kinds.sharedLib_valueInMinimalRebuildIsTrue() kind "SharedLib" flags {"Symbols"} local buffer = get_buffer() - test.string_contains(buffer,'*.*true*.*') + test.string_contains(buffer,'.*true.*') end --shared lib missing EditAndContinue in ClCompile section function vs10_project_kinds.sharedLib_valueDebugInformationFormatIsEditAndContinue() kind "SharedLib" flags {"Symbols"} local buffer = get_buffer() - test.string_contains(buffer,'*.*EditAndContinue*.*') + test.string_contains(buffer,'.*EditAndContinue.*') end function vs10_project_kinds.sharedLib_valueGenerateDebugInformationIsTrue() kind "SharedLib" flags {"Symbols"} local buffer = get_buffer() - test.string_contains(buffer,'*.*true*.*') + test.string_contains(buffer,'.*true.*') end function vs10_project_kinds.sharedLib_linkSectionContainsImportLibrary() kind "SharedLib" local buffer = get_buffer() - test.string_contains(buffer,'*.**.**.*') + test.string_contains(buffer,'.*.*.*') end function vs10_project_kinds.sharedLib_bufferContainsImportLibrary() kind "SharedLib" local buffer = get_buffer() - test.string_contains(buffer,'*.*MyProject.lib*.*') + test.string_contains(buffer,'.*MyProject.lib.*') end --should this go in vs2010_flags??? @@ -95,33 +95,33 @@ shared lib missing ??? in link section when noIn kind "SharedLib" flags{"NoImportLib"} local buffer = get_buffer() - test.string_contains(buffer,'*.**.**.*') + test.string_contains(buffer,'.*.*.*') end function vs10_project_kinds.sharedLib_withOutNoImportLibraryFlag_propertyGroupSectionContainsIgnoreImportLibrary() kind "SharedLib" local buffer = get_buffer() - test.string_contains(buffer,'*.**.*') + test.string_contains(buffer,'.*.*') end function vs10_project_kinds.sharedLib_withNoImportLibraryFlag_propertyGroupSectionContainsIgnoreImportLibrary() kind "SharedLib" flags{"NoImportLib"} local buffer = get_buffer() - test.string_contains(buffer,'*.**.*') + test.string_contains(buffer,'.*.*') end function vs10_project_kinds.sharedLib_withOutNoImportLibraryFlag_ignoreImportLibraryValueIsFalse() kind "SharedLib" local buffer = get_buffer() - test.string_contains(buffer,'*.**.*') + test.string_contains(buffer,'.*.*') end function vs10_project_kinds.sharedLib_withNoImportLibraryFlag_ignoreImportLibraryValueIsTrue() kind "SharedLib" flags{"NoImportLib"} local buffer = get_buffer() - test.string_contains(buffer,'*.**.*') + test.string_contains(buffer,'.*.*') end --shared lib LinkIncremental set to incorrect value of false @@ -129,26 +129,26 @@ shared lib missing ??? in link section when noIn kind "StaticLib" flags {"Symbols"} local buffer = get_buffer() - test.string_does_not_contain(buffer,'') + test.string_does_not_contain(buffer,'') end function vs10_project_kinds.sharedLib_withoutOptimisation_linkIncrementalValueIsTrue() kind "SharedLib" local buffer = get_buffer() - test.string_contains(buffer,'') + test.string_contains(buffer,'') end function vs10_project_kinds.sharedLib_withOptimisation_linkIncrementalValueIsFalse() kind "SharedLib" flags{"Optimize"} local buffer = get_buffer() - test.string_contains(buffer,'') + test.string_contains(buffer,'') 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,'*.**.*') + test.string_does_not_contain(buffer,'.*.*') 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 index 7b998f5f..c412554f 100644 --- a/tests/actions/vstudio/test_vs2010_vcxproj.lua +++ b/tests/actions/vstudio/test_vs2010_vcxproj.lua @@ -57,32 +57,32 @@ function vs10_vcxproj.projectBlocksArePresent() buffer = get_buffer() - test.string_contains(buffer,'') + test.string_contains(buffer,'') end function vs10_vcxproj.projectOpenTagIsCorrect() buffer = get_buffer() - test.string_contains(buffer,'*.*') + test.string_contains(buffer,'.*') end function vs10_vcxproj.configItemGroupPresent() buffer = get_buffer() - test.string_contains(buffer,'*.*') + test.string_contains(buffer,'.*') end function vs10_vcxproj.configBlocksArePresent() buffer = get_buffer() - test.string_contains(buffer,'') + test.string_contains(buffer,'') end function vs10_vcxproj.configTypeBlockPresent() buffer = get_buffer() - test.string_contains(buffer,'*.*') + test.string_contains(buffer,'.*') end function vs10_vcxproj.twoConfigTypeBlocksPresent() buffer = get_buffer() - test.string_contains(buffer,'*.*') + test.string_contains(buffer,'.*') end function vs10_vcxproj.propsDefaultForCppProjArePresent() @@ -98,7 +98,7 @@ function vs10_vcxproj.extensionSettingArePresent() buffer = get_buffer() - test.string_contains(buffer,'*.*') + test.string_contains(buffer,'.*') end function vs10_vcxproj.userMacrosPresent() @@ -108,32 +108,32 @@ function vs10_vcxproj.intermediateAndOutDirsPropertyGroupWithMagicNumber() buffer = get_buffer() - test.string_contains(buffer,'*.*<_ProjectFileVersion>10%.0%.30319%.1') + test.string_contains(buffer,'.*<_ProjectFileVersion>10%.0%.30319%.1') end function vs10_vcxproj.outDirPresent() buffer = get_buffer() - test.string_contains(buffer,'*.*') + test.string_contains(buffer,'') end function vs10_vcxproj.initDirPresent() buffer = get_buffer() - test.string_contains(buffer,'*.*') + test.string_contains(buffer,'') end function vs10_vcxproj.projectWithDebugAndReleaseConfig_twoOutDirsAndTwoIntDirs() buffer = get_buffer() - test.string_contains(buffer,'*.**.**.**.**.**.**.*') + test.string_contains(buffer,'.*.*.*') end function vs10_vcxproj.containsItemDefinition() buffer = get_buffer() - test.string_contains(buffer,'*.*') + test.string_contains(buffer,'.*') end function vs10_vcxproj.containsClCompileBlock() buffer = get_buffer() - test.string_contains(buffer,'*.*') + test.string_contains(buffer,'.*') end function vs10_vcxproj.containsAdditionalOptions() @@ -143,60 +143,53 @@ end local function cl_compile_string(version) - return '*.*' + return '.*' end function vs10_vcxproj.debugHasNoOptimisation() buffer = get_buffer() - test.string_contains(buffer, cl_compile_string('Debug').. '*.*Disabled*.*') + test.string_contains(buffer, cl_compile_string('Debug').. '.*Disabled.*') end function vs10_vcxproj.releaseHasFullOptimisation() buffer = get_buffer() - test.string_contains(buffer, cl_compile_string('Release').. '*.*Full*.*') + test.string_contains(buffer, cl_compile_string('Release').. '.*Full.*') end function vs10_vcxproj.includeDirectories_debugEntryContains_include_directory() buffer = get_buffer() - test.string_contains(buffer,cl_compile_string('Debug').. '*.*'.. path.translate(include_directory, '\\') ..'*.*') + test.string_contains(buffer,cl_compile_string('Debug').. '.*'.. path.translate(include_directory, '\\') ..'.*') end function vs10_vcxproj.includeDirectories_debugEntryContains_include_directory2PrefixWithSemiColon() buffer = get_buffer() - test.string_contains(buffer,cl_compile_string('Debug').. '*.**.*;'.. path.translate(include_directory2, '\\') ..'*.*') + test.string_contains(buffer,cl_compile_string('Debug').. '.*.*;'.. path.translate(include_directory2, '\\') ..'.*') end function vs10_vcxproj.includeDirectories_debugEntryContains_include_directory2PostfixWithSemiColon() buffer = get_buffer() - test.string_contains(buffer,cl_compile_string('Debug').. '*.**.*'.. path.translate(include_directory2, '\\') ..';*.*') + test.string_contains(buffer,cl_compile_string('Debug').. '.*.*'.. path.translate(include_directory2, '\\') ..';.*') end function vs10_vcxproj.debugContainsPreprossorBlock() buffer = get_buffer() - test.string_contains(buffer,cl_compile_string('Debug').. '*.**.*') + test.string_contains(buffer,cl_compile_string('Debug').. '.*.*') end function vs10_vcxproj.debugHasDebugDefine() buffer = get_buffer() - test.string_contains(buffer,cl_compile_string('Debug')..'*.**.*'..debug_define..'*.*') + test.string_contains(buffer,cl_compile_string('Debug')..'.*.*'..debug_define..'.*') end function vs10_vcxproj.releaseHasStringPoolingOn() buffer = get_buffer() - test.string_contains(buffer,cl_compile_string('Release')..'*.*true') + test.string_contains(buffer,cl_compile_string('Release')..'.*true') end function vs10_vcxproj.hasItemGroupSection() buffer = get_buffer() - test.string_contains(buffer,'*.*') + test.string_contains(buffer,'.*') end - --[[ - function vs10_vcxproj.itemGroupSection_hasHeaderListed() - buffer = get_buffer() - test.string_contains(buffer,'*.**.*') - end - --]] - function vs10_vcxproj.fileExtension_extEqualH() local ext = get_file_extension('foo.h') @@ -256,3 +249,76 @@ test.isequal(file, sorted.None) end + function vs10_vcxproj.itemGroupSection_hasHeaderListed() + buffer = get_buffer() + test.string_contains(buffer,'.*.*') + end + + function vs10_vcxproj.checkProjectConfigurationOpeningTag_hasACloseingAngleBracket() + local buffer = get_buffer() + test.string_contains(buffer,'') + end + + function vs10_vcxproj.postBuildEvent_isPresent() + postbuildcommands { "doSomeThing" } + local buffer = get_buffer() + test.string_contains(buffer,'.*.*.*') + end + + function vs10_vcxproj.postBuildEvent_containsCorrectInformationBetweenCommandTag() + postbuildcommands { "doSomeThing" } + local buffer = get_buffer() + test.string_contains(buffer,'.*doSomeThing.*') + end + + function vs10_vcxproj.postBuildEvent_eventEncloseByQuotes_containsCorrectInformationBetweenCommandTag() + postbuildcommands { "\"doSomeThing\"" } + local buffer = get_buffer() + test.string_contains(buffer,'.*"doSomeThing".*') + end + + function vs10_vcxproj.outDir_directorySuppliedIsNotSlashPostFixed_bufferContainsOutDirSlashPostFixed() + targetdir("dir") + local buffer = get_buffer() + test.string_contains(buffer,'dir\\') + 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,'dir\\') + end + + function vs10_vcxproj.outDir_directorySuppliedWhichIsWindowsSlashPostFixed_bufferContainsOutDirSlashPostFixed() + targetdir("dir\\") + local buffer = get_buffer() + test.string_contains(buffer,'dir\\') + end + + function vs10_vcxproj.objectDir_directorySuppliedIsNotSlashPostFixed_bufferContainsIntermediateDirSlashPostFixed() + objdir ("dir") + + local buffer = get_buffer() + test.string_contains(buffer,'dir\\') + 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,'dir\\') + end + + function vs10_vcxproj.objectDir_directorySuppliedWhichIsWindowsSlashPostFixed_bufferContainsIntermediateDirSlashPostFixed() + objdir ("dir\\") + local buffer = get_buffer() + test.string_contains(buffer,'dir\\') + end + function vs10_vcxproj.targetName() + configuration("Debug") + targetname ("foo_d") + local buffer = get_buffer() + test.string_contains(buffer,'foo_d') + end diff --git a/todo.txt b/todo.txt index c8df9149..ac6dd4f6 100644 --- a/todo.txt +++ b/todo.txt @@ -1,34 +1,12 @@ -check OutDir in debug it is showing "." --is this because no obj directory is supplied??? -shared lib missing ??? in link section when a static lib - ---I am confused at what the value should be - --as explain by starkos this is to hide the lib in the obj directory which seems to - --still be the valid thing to do with vs2010 add support for flags: Managed, MFC, Unsafe support C support Managed C++ support C# -find why MFC in flags causes an error --pull the latest stable/vs2010 branch for MFC patch -No64BitChecks is removed after being deprciated in previous releases - -fix ProgramDataBaseFileName tag currently at line 285 see note which states - this can not be converted when using the upgrade tool - added for now but it will removed or altered when I find out - what is the correct thing to do. - - $(TargetDir)$(TargetName).pdb - ----------Needs moving to link section for vs2010(dll checked- yet probably all) - =======Done - - - Link is ignored for static libs and this is incorrect - ======Done - - Hmm should the project define DEBUG and NDEBUG depending on if debugging info is on?? - should the project define _WINDOWS when using WinMain? +Should the project define DEBUG and NDEBUG depending on if debugging info is on?? From 947c13faea6ad4372fd6b2df6d13d1eeec20a9a5 Mon Sep 17 00:00:00 2001 From: LiamDevine Date: Mon, 21 Jun 2010 14:33:48 +0100 Subject: [PATCH 17/19] UseDebugLibraries --added to config whole program optimisation --added added--- SmallerTypeCheck set to true when flags contain extra warnings and no optimisation --- src/actions/clean/_clean.lua | 8 ++ src/actions/vstudio/_vstudio.lua | 3 +- src/actions/vstudio/vs2010_vcxproxj.lua | 98 +++++++++++-------- src/host/scripts.c | 53 +++++----- tests/actions/vstudio/test_vs2010_vcxproj.lua | 19 ++++ todo.txt | 28 ++---- 6 files changed, 118 insertions(+), 91 deletions(-) diff --git a/src/actions/clean/_clean.lua b/src/actions/clean/_clean.lua index 0e0ead03..c40c56a3 100644 --- a/src/actions/clean/_clean.lua +++ b/src/actions/clean/_clean.lua @@ -59,6 +59,14 @@ 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') + else + io.write('vs2010 does not have an on clean') + 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 3cde3b38..b6639218 100644 --- a/src/actions/vstudio/_vstudio.lua +++ b/src/actions/vstudio/_vstudio.lua @@ -154,8 +154,7 @@ premake.clean.file(sln, "%%.usertasks") end - function premake.vstudio.cleanproject(prj) - io.write("generic vs clean project") + function premake.vstudio.cleanproject(prj) local fext = iif(premake.isdotnetproject(prj), ".csproj", ".vcproj") local fname = premake.project.getfilename(prj, "%%") diff --git a/src/actions/vstudio/vs2010_vcxproxj.lua b/src/actions/vstudio/vs2010_vcxproxj.lua index d5dee0c0..26bc214b 100644 --- a/src/actions/vstudio/vs2010_vcxproxj.lua +++ b/src/actions/vstudio/vs2010_vcxproxj.lua @@ -93,13 +93,27 @@ premake.vstudio.vcxproj = { } } 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,'', premake.esc(cfginfo.name)) + local cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform) + _p(1,'' + , premake.esc(cfginfo.name)) _p(2,'%s',config_type(cfg)) _p(2,'%s',iif(cfg.flags.Unicode,"Unicode","MultiByte")) + + local use_debug = "false" + if optimisation(cfg) == "Disabled" then + use_debug = "true" + else + _p(2,'true') + end + _p(2,'%s',use_debug) + _p(1,'') end end @@ -108,12 +122,13 @@ premake.vstudio.vcxproj = { } 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,'',premake.esc(cfginfo.name)) + _p(1,'' + ,premake.esc(cfginfo.name)) _p(2,'') _p(1,'') end end - --NOTE: check this is correct + function incremental_link(cfg,cfginfo) if cfg.kind ~= "StaticLib" then ShoudLinkIncrementally = 'false' @@ -121,7 +136,7 @@ premake.vstudio.vcxproj = { } ShoudLinkIncrementally = 'true' end - _p(2,'%s' + _p(2,'%s' ,premake.esc(cfginfo.name),ShoudLinkIncrementally) end end @@ -131,26 +146,30 @@ premake.vstudio.vcxproj = { } if cfg.kind == "SharedLib" then local shouldIgnore = "false" if cfg.flags.NoImportLib then shouldIgnore = "true" end - _p(2,'%s' + _p(2,'%s' ,premake.esc(cfginfo.name),shouldIgnore) end end + ---needs revisiting for when there are dependency projects function intermediate_and_out_dirs(prj) _p(1,'') _p(2,'<_ProjectFileVersion>10.0.30319.1') for _, cfginfo in ipairs(prj.solution.vstudio_configs) do local cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform) - _p(2,'%s\\', premake.esc(cfginfo.name),premake.esc(cfg.buildtarget.directory) ) - _p(2,'%s\\', premake.esc(cfginfo.name), premake.esc(cfg.objectsdir)) - _p(2,'%s',premake.esc(cfginfo.name),path.getbasename(cfg.buildtarget.name)) + _p(2,'%s\\' + , premake.esc(cfginfo.name),premake.esc(cfg.buildtarget.directory) ) + _p(2,'%s\\' + , premake.esc(cfginfo.name), premake.esc(cfg.objectsdir)) + _p(2,'%s' + ,premake.esc(cfginfo.name),path.getbasename(cfg.buildtarget.name)) + ignore_import_lib(cfg,cfginfo) - --_p(2,'%s',premake.esc(cfginfo.name),incremental_link(cfg)) incremental_link(cfg,cfginfo) if cfg.flags.NoManifest then - _p(2,'false',premake.esc(cfginfo.name)) + _p(2,'false' + ,premake.esc(cfginfo.name)) end end @@ -210,7 +229,8 @@ premake.vstudio.vcxproj = { } -- function preprocessor(indent,cfg) if #cfg.defines > 0 then - _p(indent,'%s;%%(PreprocessorDefinitions)',premake.esc(table.concat(cfg.defines, ";"))) + _p(indent,'%s;%%(PreprocessorDefinitions)' + ,premake.esc(table.concat(cfg.defines, ";"))) else _p(indent,'') end @@ -304,11 +324,13 @@ premake.vstudio.vcxproj = { } preprocessor(3,cfg) minimal_build(cfg) - if optimisation(cfg) == "Disabled" and not cfg.flags.Managed then - _p(3,'EnableFastChecks') - end - - if optimisation(cfg) ~= "Disabled" then + if optimisation(cfg) == "Disabled" then + _p(3,'EnableFastChecks') + if cfg.flags.ExtraWarnings then + _p(3,'true') + end + else + --if optimisation(cfg) ~= "Disabled" then _p(3,'true') end @@ -318,10 +340,15 @@ premake.vstudio.vcxproj = { } precompiled_header(cfg) - _p(3,'Level%s', iif(cfg.flags.ExtraWarnings, 4, 3)) - - - + if cfg.flags.ExtraWarnings then + _p(3,'Level4') + --if optimisation(cfg) == "Disabled" then + -- _p(3,'true') + --end + else + _p(3,'Level3') + end + if cfg.flags.FatalWarnings then _p(3,'true') end @@ -385,7 +412,6 @@ premake.vstudio.vcxproj = { } --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"', iif(cfg.flags.NoImportLib, cfg.objectsdir .. "\\" .. path.getname(implibname), implibname)) _p(3,'%s',iif(cfg.flags.NoImportLib, cfg.objectsdir .. "\\" .. path.getname(implibname), implibname)) end end @@ -405,7 +431,8 @@ premake.vstudio.vcxproj = { } _p(3,'true') end - _p(3,'$(OutDir)%s.pdb', path.getbasename(cfg.buildtarget.name)) + _p(3,'$(OutDir)%s.pdb' + , path.getbasename(cfg.buildtarget.name)) end @@ -422,21 +449,9 @@ premake.vstudio.vcxproj = { } _p(3,'%s%s%%(AdditionalLibraryDirectories)', table.concat(premake.esc(path.translate(cfg.libdirs, '\\')) , ";"), iif(cfg.libdirs and #cfg.libdirs >0,';','')) - -- - --if cfg.flags.Symbols then - -- _p(3,'true') - --else - -- _p(3,'false') - --end - - -- _p(3,'%s',iif(cfg.kind == "ConsoleApp","Console", "Windows")) - - --if optimisation(cfg) ~= "Disabled" then - -- _p(3,'true') - -- _p(3,'true') - --end - -- - common_link_section(cfg) + + common_link_section(cfg) + if (cfg.kind == "ConsoleApp" or cfg.kind == "WindowedApp") and not cfg.flags.WinMain then _p(3,'mainCRTStartup') end @@ -455,7 +470,8 @@ premake.vstudio.vcxproj = { } 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,'',premake.esc(cfginfo.name)) + _p(1,'' + ,premake.esc(cfginfo.name)) vs10_clcompile(cfg) resource_compile(cfg) item_def_lib(cfg) diff --git a/src/host/scripts.c b/src/host/scripts.c index 07be9b0f..6076e476 100644 --- a/src/host/scripts.c +++ b/src/host/scripts.c @@ -161,14 +161,14 @@ const char* builtin_scripts[] = { /* actions/vstudio/_vstudio.lua */ "_VS = { } -- deprecated, will remove eventually\npremake.vstudio = { }\nlocal vstudio = premake.vstudio\npremake.vstudio_platforms = { \nany = \"Any CPU\", \nmixed = \"Mixed Platforms\", \nNative = \"Win32\",\nx32 = \"Win32\", \nx64 = \"x64\",\nPS3 = \"PS3\",\nXbox360 = \"Xbox 360\",\n}\nfunction _VS.arch(prj)\nif (prj.language == \"C#\") then\nif (_ACTION < \"vs2005\") then\nreturn \".NET\"\nelse\nreturn \"Any CPU\"\nend\nelse\nreturn \"Win32\"\nend\nend\nfunction _VS.bool(value)\nif (_ACTION < \"vs2005\") then\nreturn iif(value, \"TRUE\", \"FALSE\")\nelse\nreturn iif(value, \"true\", \"false\")\nend\nend\nfunction premake.vstudio_buildconfigs(sln)\nlocal cfgs = { }\nlocal platforms = premake.filterplatforms(sln, premake.vstudio_platforms, \"Native\")\nlocal hascpp = premake.hascppproject(sln)\nlocal hasdotnet = premake.hasdotnetproject(sln)\nif hasdotnet then\ntable.insert(platforms, 1, \"any\")\nend\nif hasdotnet and hascpp then\ntable.insert(platforms, 2, \"mixed\")\nend\nfor _, buil" - "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)\nio.write(\"generic vs clean project\")\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, \"\")\nelseif (state == \"GroupEnd\") then" - "\noutput(indent, \"\")\nelse\noutput(indent, \"\")\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\")\noutput(indent, \"\\t\\t\")\noutput(indent, \"\\t\")\nend\nend\nend\noutput(indent, \"\")\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\nend\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\"\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\", prema" - "ke.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)\nif premake.isdotnetproject(prj) then\npremake.gene" - "rate(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.vs200" - "5_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,\noncleansol" - "ution = 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++\"},\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 = premake.vs2010_cleantarget\n}", + "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, \"\")\nelseif (state == \"GroupEnd\") then\noutput(indent, \"\")\nelse\nou" + "tput(indent, \"\")\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\")\noutput(indent, \"\\t\\t\")\noutput(indent, \"\\t\")\nend\nend\nend\noutput(indent, \"\")\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\"\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 = function(sln)\npremake.generate(sln, \"%%.sln\", premake.vs2002_solution)\nend,\nonproject = fu" + "nction(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)\nif premake.isdotnetproject(prj) then\npremake.generate(prj, \"%%.csproj\", premake.vs2002_c" + "sproj)\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(pr" + "j, \"%%.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,\no" + "ncleanproject = 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++\"},\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 = premake.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(" @@ -230,22 +230,22 @@ const char* builtin_scripts[] = { /* 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) d" "o\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)\nfor _, cfginfo in ipairs(prj.solution.vstudio_configs) do\n_p(1,'')\n_p(2,'', premake.esc(cfginfo.name))\n_p(3,'%s',cfginfo.buildcfg)\n_p(3,'%s',cfginfo.platform)\n_p(2,'')\n_p(1,'')\nend\nend\nlocal function vs2010_globals(prj)\n_p(1,'')\n_p(2,'{%s}',prj.uuid)\n_p(2,'%s',prj.name)\n_p(2,'Win32Proj')\n_p(1,'')\nend\nfunction config_type(config)\nlocal t =\n{\nSharedLib = \"DynamicLibrary\",\nStaticLib = \"StaticLibrary\",\nConsoleApp = \"Application\",\n}\nreturn t[config.kind]\nend\nfunctio" - "n 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,'', premake.esc(cfginfo.name))\n_p(2,'%s',config_type(cfg))\n_p(2,'%s',iif(cfg.flags.Unicode,\"Unicode\",\"MultiByte\"))\n_p(1,'')\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,'',premake.esc(cfginfo.name))\n_p(2,'')\n_p(1,'')\nend\ne" - "nd\nfunction incremental_link(cfg,cfginfo)\nif cfg.kind ~= \"StaticLib\" then\nShoudLinkIncrementally = 'false'\nif optimisation(cfg) == \"Disabled\" then\nShoudLinkIncrementally = 'true'\nend\n_p(2,'%s'\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,'%s'\n,premake.esc(cfginfo.name),shouldIgnore)\nend\nend\nfunction intermediate_and_out_dirs(prj)\n_p(1,'')\n_p(2,'<_ProjectFileVersion>10.0.30319.1')\nfor _, cfginfo in ipairs(prj.solution.vstudio_configs) do\nlocal cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform)\n_p(2,'%s\\\\', premake.esc(cfginfo.name),premake.esc(cfg.buildtarget.directory) )\n_p(2,'%s\\\\', premake.esc(cfginfo.name), premake.esc(cfg.objectsdir))\n_p(2,'%s',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,'false',premake.esc(cfginfo.name))\nend\nend\n_p(1,'')\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 c" - "fg.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,'Use')\n_p(3,'%s', path.getname(cfg.pchheader))\nelse\n_p(3,'')\nend\nend\nfunction preprocessor(indent,cfg)\nif #cfg.defines > 0 then\n_p(indent,'%s;%%(PreprocessorDefinitions)',premake.esc(table.concat(cfg.defines, \";\")))\nelse\n_p(indent,'')\nend\nend\nfunction include_dirs(indent,cfg)\nif #cfg.includedirs > 0 then\n_p(indent,'%s;%%(AdditionalIncludeDirectories)'\n,premake.esc(path.translate(table.concat(cfg.includedi" - "rs, \";\"), '\\\\')))\nend\nend\nfunction resource_compile(cfg)\n_p(2,'')\npreprocessor(3,cfg)\ninclude_dirs(3,cfg)\n_p(2,'')\nend\nfunction exceptions(cfg)\nif cfg.flags.NoExceptions then\n_p(2,'false')\nelseif cfg.flags.SEH then\n_p(2,'Async')\nend\nend\nfunction rtti(cfg)\nif cfg.flags.NoRTTI then\n_p(3,'false')\nend\nend\nfunction wchar_t_buildin(cfg)\nif cfg.flags.NativeWChar then\n_p(3,'true')\nelseif cfg.flags.NoNativeWChar then\n_p(3,'false')\nend\nend\nfunction sse(cfg)\nif cfg.flags.EnableSSE then\n_p(3,'StreamingSIMDExtensions')\nelseif cfg.flags.EnableSSE2 then\n_p(3,'StreamingSIMDExtensions2')\nend\nend\nfunction floating_po" - "int(cfg)\n if cfg.flags.FloatFast then\n_p(3,'Fast')\nelseif cfg.flags.FloatStrict then\n_p(3,'Strict')\nend\nend\nfunction debug_info(cfg)\nif cfg.flags.Symbols and not cfg.flags.NoEditAndContinue then\n_p(3,'EditAndContinue')\nelse\n_p(3,'')\nend\nend\nfunction minimal_build(cfg)\nif cfg.flags.Symbols and not cfg.flags.NoMinimalRebuild then\n_p(3,'true')\nelseif cfg.flags.Symbols then\n_p(3,'false')\nend\nend\nfunction vs10_clcompile(cfg)\n_p(2,'')\nif #cfg.buildoptions > 0 then\n_p(3,'%s %%(AdditionalOptions)',\ntable.concat(premake.esc(cfg.buildoptions), \" \"))\nend\n_p(3,'%s',optimisation(cfg))\ninclude_dirs(3,cfg)\npreprocessor(3,cfg)\nminimal_build(cfg)\nif optimisation(cfg) == " - "\"Disabled\" and not cfg.flags.Managed then\n_p(3,'EnableFastChecks')\nend\nif optimisation(cfg) ~= \"Disabled\" then\n_p(3,'true')\nend\n_p(3,'%s', runtime(cfg))\n_p(3,'true')\nprecompiled_header(cfg)\n_p(3,'Level%s', iif(cfg.flags.ExtraWarnings, 4, 3))\nif cfg.flags.FatalWarnings then\n_p(3,'true')\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,'true')\nend\n_p(2,'')\nend\nfunction event_hooks(cfg)\nif #cfg.postbuildcommands> 0 then\n _p(2,'')\n_p(3,'%s',premake.esc(table.implode(cfg.postbuildcommands, \"\", \"\", \"\\r\\n\")))\n_p(2,'')\nend\nif #cfg.prebuildcommands> 0 then\n _p(2,'')\n_p(3,'%s',premake.esc(table.implode(cfg.prebuildcommands, \"\", \"\", \"\\r\\n\")))\n_p(2,'')\nend\nif #cfg.prelinkcommands> 0 then\n _p(2,'')\n_p(3,'%s',premake.esc(table.implode(cfg.prelinkcommands, \"\", \"\", \"\\r\\n\")))\n_p(2,'')\nend\nend\nfunction item_def_lib(cfg)\nif cfg.kind == 'StaticLib' then\n_p(1,'')\n_p(2,'$(OutDir)%s',cfg.buildtarget.name)\n_p(1,'')\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,'%s', target)\nend\nfunction import_lib(cfg)\nif cfg.kind == \"SharedLib\" then\nlocal implibname = cfg.linktarget.fullpath\n_p(3,'%s',iif(cfg.flags.NoImportLib, cfg.objectsdir .. \"\\\\\" .. path.getname(implibname), implibname))\nend\nend\nfuncti" - "on common_link_section(cfg)\n_p(3,'%s',iif(cfg.kind == \"ConsoleApp\",\"Console\", \"Windows\"))\nif cfg.flags.Symbols then \n_p(3,'true')\nelse\n_p(3,'false')\nend\nif optimisation(cfg) ~= \"Disabled\" then\n_p(3,'true')\n_p(3,'true')\nend\n_p(3,'$(OutDir)%s.pdb', path.getbasename(cfg.buildtarget.name))\nend\nfunction item_link(cfg)\n_p(2,'')\nif cfg.kind ~= 'StaticLib' then\nif #cfg.links > 0 then\n_p(3,'%s;%%(AdditionalDependencies)',\ntable.concat(premake.getlinks(cfg, \"all\", \"fullpath\"), \";\"))\nend\n_p(3,'$(OutDir)%s', cfg.buildtarget.name)\n_p(3,'%s%s%%(AdditionalLibraryDirectories)',\ntable.concat(pr" - "emake.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,'mainCRTStartup')\nend\nimport_lib(cfg)\n_p(3,'%s', iif(cfg.platform == \"x64\", \"MachineX64\", \"MachineX86\"))\nelse\ncommon_link_section(cfg)\nend\n_p(2,'')\nend\n \nfunction item_definitions(prj)\nfor _, cfginfo in ipairs(prj.solution.vstudio_configs) do\nlocal cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform)\n_p(1,'',premake.esc(cfginfo.name))\nvs10_clcompile(cfg)\nresource_compile(cfg)\nitem_def_lib(cfg)\nitem_link(cfg)\nevent_hooks(cfg)\n_p(1,'')\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_container[type],translated_path)\nelse\ntable.insert(sorted_container.None,translated_path)\nend\nend\nend\nend\n -- \n -- {8fd826f8-3739-44e6-8cc8-997122e53b8d}\n -- \n -- \nfunction write_file_type_block(files,group_type)\nif #files > 0 then\n_p(1,'')\nfor _, current_file in ipairs(files) do\n_p(2,'<%s Include=\\\"%s\\\" />', group_type,current_file)\nend\n_p(1,'')\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,'')\nfor _, dir in pairs(directories) do\n_p(2,'',dir)\n_p(3,'{%s}',os.uuid())\n_p(2,'')\nend\n_p(1,'')\nend\nend\nfunction write_file_filter_block(files,group_type)\nif #files > 0 then\n_p(1,'')\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,'%s',path_to_file)\n_p(2,'',group_type)\nelse\n_p(2,'<%s Include=\\\"%s\\\" " - "/>', group_type,path.translate(current_file, \"\\\\\"))\nend\nend\n_p(1,'')\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('')\n_p('')\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('')\nend\n -- \n -- \n -- \n -- Create\n -- Create\n --\n --" - "\nfunction premake.vs2010_vcxproj(prj)\nio.eol = \"\\r\\n\"\n_p('')\n_p('')\nvs2010_config(prj)\nvs2010_globals(prj)\n_p(1,'')\nconfig_type_block(prj)\n_p(1,'')\n_p(1,'')\n_p(1,'')\nimport_props(prj)\n_p(1,'')\nintermediate_and_out_dirs(prj)\nitem_definitions(prj)\nvcxproj_files(prj)\n_p(1,'')\n_p(1,'')\n_p(1,'')\n_p('')\nend\nfunction premake.vs2010_vcxproj_user(prj)\n_p('')\n_p('')\n_p('')\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.r" - "emove(fname)\nend\nend\nfunction premake.vs2010_cleantarget(name)\nos.remove(name .. \".pdb\")\nos.remove(name .. \".idb\")\nos.remove(name .. \".ilk\")\nend\n", + "n 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,''\n, premake.esc(cfginfo.name))\n_p(2,'%s',config_type(cfg))\n_p(2,'%s',iif(cfg.flags.Unicode,\"Unicode\",\"MultiByte\"))\nlocal use_debug = \"false\"\nif optimisation(cfg) == \"Disabled\" then \nuse_debug = \"true\" \nelse\n_p(2,'true')\nend\n_p(2,'%s',use_debug)\n_p(1,'')\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,''\n,premake.esc(cfginfo.name))\n_p(2,'')\n_p(1,'')\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,'%s'\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,'%s'\n,premake.esc(cfginfo.name),shouldIgnore)\nend\nend\nfunction intermediate_and_out_dirs(prj)\n_p(1," + "'')\n_p(2,'<_ProjectFileVersion>10.0.30319.1')\nfor _, cfginfo in ipairs(prj.solution.vstudio_configs) do\nlocal cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform)\n_p(2,'%s\\\\'\n, premake.esc(cfginfo.name),premake.esc(cfg.buildtarget.directory) )\n_p(2,'%s\\\\'\n, premake.esc(cfginfo.name), premake.esc(cfg.objectsdir))\n_p(2,'%s'\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,'false'\n,premake.esc(cfginfo.name))\nend\nend\n_p(1,'')\nend\nfunction optimisation(cfg)\nlocal result = \"Disabled\"\nfor _, value in ipairs(cfg.flags) do\nif (val" + "ue == \"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,'Use')\n_p(3,'%s', path.getname(cfg.pchheader))\nelse\n_p(3,'')\nend\nend\nfunction preprocessor(indent,cfg)\nif #cfg.defines > 0 then\n_p(indent,'%s;%%(PreprocessorDefinitions)'\n,premake.esc(table.concat(cfg.defines, \";\")))\nelse\n_p(indent,'')\nend\nend\nfunction include_dirs(indent,cfg)\nif #cfg.includedirs > 0 then\n_p(indent,'%s;%%(AdditionalIncludeDirectories)'\n,premake.esc(path.translate(table.concat(cfg.includedirs, \";\"), '\\\\')))\nend\nend\nfunction resource_compile(cfg)\n_p(2,'')\npreprocessor(3,cfg)\ninclude_dirs(3,cfg)\n_p(2,'')\nend\nfunction exceptions(cfg)\nif cfg.flags.NoExceptions then\n_p(2,'false')\nelseif cfg.flags.SEH then\n_p(2,'Async')\nend\nend\nfunction rtti(cfg)\nif cfg.flags.NoRTTI then\n_p(3,'false')\nend\nend\nfunction wchar_t_buildin(cfg)\nif cfg.flags.NativeWChar then\n_p(3,'true')\nelseif cfg.flags.NoNativeWChar then\n_p(3,'false')\nend\nend\nfunction sse(cfg)\nif cfg.flags.EnableSSE then\n_p(3," + "'StreamingSIMDExtensions')\nelseif cfg.flags.EnableSSE2 then\n_p(3,'StreamingSIMDExtensions2')\nend\nend\nfunction floating_point(cfg)\n if cfg.flags.FloatFast then\n_p(3,'Fast')\nelseif cfg.flags.FloatStrict then\n_p(3,'Strict')\nend\nend\nfunction debug_info(cfg)\nif cfg.flags.Symbols and not cfg.flags.NoEditAndContinue then\n_p(3,'EditAndContinue')\nelse\n_p(3,'')\nend\nend\nfunction minimal_build(cfg)\nif cfg.flags.Symbols and not cfg.flags.NoMinimalRebuild then\n_p(3,'true')\nelseif cfg.flags.Symbols then\n_p(3,'false')\nend\nend\nfunction vs10_clcompile(cfg)\n_p(2,'')\nif #cfg.buildoptions > 0 then\n_p(3,'%s %" + "%(AdditionalOptions)',\ntable.concat(premake.esc(cfg.buildoptions), \" \"))\nend\n_p(3,'%s',optimisation(cfg))\ninclude_dirs(3,cfg)\npreprocessor(3,cfg)\nminimal_build(cfg)\nif optimisation(cfg) == \"Disabled\" then\n_p(3,'EnableFastChecks')\nif cfg.flags.ExtraWarnings then\n_p(3,'true')\nend\nelse\n_p(3,'true')\nend\n_p(3,'%s', runtime(cfg))\n_p(3,'true')\nprecompiled_header(cfg)\nif cfg.flags.ExtraWarnings then\n_p(3,'Level4')\nelse\n_p(3,'Level3')\nend\nif cfg.flags.FatalWarnings then\n_p(3,'true')\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,'true')\nend\n_p(2,'')\nend\nfunction event_hooks(cfg)\nif #cfg.postbuildcommands> 0 then\n _p(2,'')\n_p(3,'%s',premake.esc(table.implode(cfg.postbuildcommands, \"\", \"\", \"\\r\\n\")))\n_p(2,'')\nend\nif #cfg.prebuildcommands> 0 then\n _p(2,'')\n_p(3,'%s',premake.esc(table.implode(cfg.prebuildcommands, \"\", \"\", \"\\r\\n\")))\n_p(2,'')\nend\nif #cfg.prelinkcommands> 0 then\n _p(2,'')\n_p(3,'%s',premake.esc(table.implode(cfg.prelinkcommands, \"\", \"\", \"\\r\\n\")))\n_p(2,'')\nend\nend\nfunction item_def_lib(cfg)\nif cfg.kind == 'StaticLib' then\n_p(1,'')\n_p(2,'$(OutDir)%s',cfg.buildtarget.name)\n_p(1,'')\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\"\n" + "end\n_p(3,'%s', target)\nend\nfunction import_lib(cfg)\nif cfg.kind == \"SharedLib\" then\nlocal implibname = cfg.linktarget.fullpath\n_p(3,'%s',iif(cfg.flags.NoImportLib, cfg.objectsdir .. \"\\\\\" .. path.getname(implibname), implibname))\nend\nend\nfunction common_link_section(cfg)\n_p(3,'%s',iif(cfg.kind == \"ConsoleApp\",\"Console\", \"Windows\"))\nif cfg.flags.Symbols then \n_p(3,'true')\nelse\n_p(3,'false')\nend\nif optimisation(cfg) ~= \"Disabled\" then\n_p(3,'true')\n_p(3,'true')\nend\n_p(3,'$(OutDir)%s.pdb'\n, path.getbasename(cfg.buildtarget.name))\nend\nfunction item_link(cfg)\n_p(2,'')\nif cfg.kind ~= 'StaticLib' then\nif #cfg.links > 0 then\n_p(3,'%s;%%(AdditionalDependencies)',\ntable.concat(premake.getlinks(cfg, \"all\", \"fullpath\"), \";\"))\nend\n_p(3,'$(OutDir)%s', cfg.buildtarget.name)\n_p(3,'%s%s%%(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,'mainCRTStartup')\nend\nimport_lib(cfg)\n_p(3,'%s', iif(cfg.platform == \"x64\", \"MachineX64\", \"MachineX86\"))\nelse\ncommon_link_section(cfg)\nend\n_p(2,'')\nend\n \nfunction item_definitions(prj)\nfor _, cfginfo in ipairs(prj.solution.vstudio_configs) do\nlocal cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform)\n_p(1,''\n,premake.esc(cfginfo.name))\nvs10_clcompile(cfg)\nresource_compile(cfg)\nitem_def_lib(cfg)\nitem_link(cfg)\nevent_hooks(cfg)\n_p(1,'')\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_container[type],translated_path)\nelse\ntable.insert(sorted_container.None,translated_path)\nend\nend\nend\nend\n -- \n -- {8fd826f8-3739-44e6-8cc8" + "-997122e53b8d}\n -- \n -- \nfunction write_file_type_block(files,group_type)\nif #files > 0 then\n_p(1,'')\nfor _, current_file in ipairs(files) do\n_p(2,'<%s Include=\\\"%s\\\" />', group_type,current_file)\nend\n_p(1,'')\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,'')\nfor _, dir in pairs(directories) do\n_p(2,'',dir)\n_p(3,'{%s}',os.uuid())\n_p(2,'')\nend\n_p(1,'')\nend\nend\nfunction write_file_filter_block(files,group_type)\nif #files > 0 " + " then\n_p(1,'')\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,'%s',path_to_file)\n_p(2,'',group_type)\nelse\n_p(2,'<%s Include=\\\"%s\\\" />', group_type,path.translate(current_file, \"\\\\\"))\nend\nend\n_p(1,'')\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('')\n_p('')\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('')\nend\n -- \n -- \n -- \n -- Create\n -- Create\n --\n --\nfunction premake.vs2010_vcxproj(prj)\nio.eol = \"\\r\\n\"\n_p('')\n_p('')\nvs2010_config(prj)\nvs2010_globals(prj)\n_p(1,'')\nconfig_type_block(prj)\n_p(1,'')\n_p(1,'')\n_p(1,'')\nimport_props(prj)\n_p(1,'')\nintermediate_and_out_dirs(prj)\nitem_definitions(prj)\nvcxproj_files(prj)\n_p(1,'')\n_p(1,'')\n_p(1,'')\n_p('')\nend\nfunction premake.vs2010_vcxproj_user(prj)\n_p('')\n_p('')\n_p('')\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 '" @@ -279,8 +279,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')\nelse\nio.write('vs2010 does not have an on clean')\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\npla" + "tforms = 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.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(p" + "rj, 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_vcxproj.lua b/tests/actions/vstudio/test_vs2010_vcxproj.lua index c412554f..19ed4db5 100644 --- a/tests/actions/vstudio/test_vs2010_vcxproj.lua +++ b/tests/actions/vstudio/test_vs2010_vcxproj.lua @@ -322,3 +322,22 @@ local buffer = get_buffer() test.string_contains(buffer,'foo_d') end + + function vs10_vcxproj.noExtraWarnings_bufferDoesNotContainSmallerTypeCheck() + local buffer = get_buffer() + test.string_does_not_contain(buffer,'') + end + + function vs10_vcxproj.debugAndExtraWarnings_bufferContainsSmallerTypeCheck() + configuration("Debug") + flags {"ExtraWarnings"} + local buffer = get_buffer() + test.string_contains(buffer,'true') + end + + function vs10_vcxproj.releaseAndExtraWarnings_bufferDoesNotContainSmallerTypeCheck() + configuration("Release") + flags {"ExtraWarnings"} + local buffer = get_buffer() + test.string_does_not_contain(buffer,'') + end \ No newline at end of file diff --git a/todo.txt b/todo.txt index ac6dd4f6..e185d9ce 100644 --- a/todo.txt +++ b/todo.txt @@ -9,31 +9,15 @@ support C# Should the project define DEBUG and NDEBUG depending on if debugging info is on?? - - - DynamicLibrary - false--missing - is this used when there are symbols - hmm profiling uses symbols does it not??? + UseDebugLibraries --added to config + whole program optimisation --added + added--- SmallerTypeCheck set to true when flags contain extra warnings and no optimisation + look at ResourceCompile + why are the preprocessor and include dir repeated? - currently the below format is not generated yet it uses the format from when - a vs upgrade is done. change this - - true - false - false - - - false - - dll + dll add the following when required true \ No newline at end of file From 4df82555080a4150e15447228c2a4a8964c09ccc Mon Sep 17 00:00:00 2001 From: LiamDevine Date: Mon, 21 Jun 2010 17:38:50 +0100 Subject: [PATCH 18/19] added MFC support changed to use only one configuration block --- src/actions/clean/_clean.lua | 16 +++++++- src/actions/vstudio/vs2010_vcxproxj.lua | 12 ++++-- src/host/scripts.c | 40 +++++++++---------- tests/actions/vstudio/test_vs2010_flags.lua | 6 +-- tests/actions/vstudio/test_vs2010_vcxproj.lua | 7 +++- todo.txt | 14 +++---- 6 files changed, 57 insertions(+), 38 deletions(-) diff --git a/src/actions/clean/_clean.lua b/src/actions/clean/_clean.lua index c40c56a3..fc53d095 100644 --- a/src/actions/clean/_clean.lua +++ b/src/actions/clean/_clean.lua @@ -62,10 +62,22 @@ -- 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') + 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') + 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) diff --git a/src/actions/vstudio/vs2010_vcxproxj.lua b/src/actions/vstudio/vs2010_vcxproxj.lua index 26bc214b..ac2afc2c 100644 --- a/src/actions/vstudio/vs2010_vcxproxj.lua +++ b/src/actions/vstudio/vs2010_vcxproxj.lua @@ -66,14 +66,14 @@ premake.vstudio.vcxproj = { } end local function vs2010_config(prj) + _p(1,'') for _, cfginfo in ipairs(prj.solution.vstudio_configs) do - _p(1,'') _p(2,'', premake.esc(cfginfo.name)) _p(3,'%s',cfginfo.buildcfg) _p(3,'%s',cfginfo.platform) _p(2,'') - _p(1,'') - end + end + _p(1,'') end local function vs2010_globals(prj) @@ -105,7 +105,11 @@ premake.vstudio.vcxproj = { } , premake.esc(cfginfo.name)) _p(2,'%s',config_type(cfg)) _p(2,'%s',iif(cfg.flags.Unicode,"Unicode","MultiByte")) - + + if cfg.flags.MFC then + _p(2,'Dynamic') + end + local use_debug = "false" if optimisation(cfg) == "Disabled" then use_debug = "true" diff --git a/src/host/scripts.c b/src/host/scripts.c index 6076e476..ac10d6a9 100644 --- a/src/host/scripts.c +++ b/src/host/scripts.c @@ -229,23 +229,23 @@ const char* builtin_scripts[] = { /* 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) d" - "o\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)\nfor _, cfginfo in ipairs(prj.solution.vstudio_configs) do\n_p(1,'')\n_p(2,'', premake.esc(cfginfo.name))\n_p(3,'%s',cfginfo.buildcfg)\n_p(3,'%s',cfginfo.platform)\n_p(2,'')\n_p(1,'')\nend\nend\nlocal function vs2010_globals(prj)\n_p(1,'')\n_p(2,'{%s}',prj.uuid)\n_p(2,'%s',prj.name)\n_p(2,'Win32Proj')\n_p(1,'')\nend\nfunction config_type(config)\nlocal t =\n{\nSharedLib = \"DynamicLibrary\",\nStaticLib = \"StaticLibrary\",\nConsoleApp = \"Application\",\n}\nreturn t[config.kind]\nend\nfunctio" - "n 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,''\n, premake.esc(cfginfo.name))\n_p(2,'%s',config_type(cfg))\n_p(2,'%s',iif(cfg.flags.Unicode,\"Unicode\",\"MultiByte\"))\nlocal use_debug = \"false\"\nif optimisation(cfg) == \"Disabled\" then \nuse_debug = \"true\" \nelse\n_p(2,'true')\nend\n_p(2,'%s',use_debug)\n_p(1,'')\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,''\n,premake.esc(cfginfo.name))\n_p(2,'')\n_p(1,'')\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,'%s'\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,'%s'\n,premake.esc(cfginfo.name),shouldIgnore)\nend\nend\nfunction intermediate_and_out_dirs(prj)\n_p(1," - "'')\n_p(2,'<_ProjectFileVersion>10.0.30319.1')\nfor _, cfginfo in ipairs(prj.solution.vstudio_configs) do\nlocal cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform)\n_p(2,'%s\\\\'\n, premake.esc(cfginfo.name),premake.esc(cfg.buildtarget.directory) )\n_p(2,'%s\\\\'\n, premake.esc(cfginfo.name), premake.esc(cfg.objectsdir))\n_p(2,'%s'\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,'false'\n,premake.esc(cfginfo.name))\nend\nend\n_p(1,'')\nend\nfunction optimisation(cfg)\nlocal result = \"Disabled\"\nfor _, value in ipairs(cfg.flags) do\nif (val" - "ue == \"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,'Use')\n_p(3,'%s', path.getname(cfg.pchheader))\nelse\n_p(3,'')\nend\nend\nfunction preprocessor(indent,cfg)\nif #cfg.defines > 0 then\n_p(indent,'%s;%%(PreprocessorDefinitions)'\n,premake.esc(table.concat(cfg.defines, \";\")))\nelse\n_p(indent,'')\nend\nend\nfunction include_dirs(indent,cfg)\nif #cfg.includedirs > 0 then\n_p(indent,'%s;%%(AdditionalIncludeDirectories)'\n,premake.esc(path.translate(table.concat(cfg.includedirs, \";\"), '\\\\')))\nend\nend\nfunction resource_compile(cfg)\n_p(2,'')\npreprocessor(3,cfg)\ninclude_dirs(3,cfg)\n_p(2,'')\nend\nfunction exceptions(cfg)\nif cfg.flags.NoExceptions then\n_p(2,'false')\nelseif cfg.flags.SEH then\n_p(2,'Async')\nend\nend\nfunction rtti(cfg)\nif cfg.flags.NoRTTI then\n_p(3,'false')\nend\nend\nfunction wchar_t_buildin(cfg)\nif cfg.flags.NativeWChar then\n_p(3,'true')\nelseif cfg.flags.NoNativeWChar then\n_p(3,'false')\nend\nend\nfunction sse(cfg)\nif cfg.flags.EnableSSE then\n_p(3," - "'StreamingSIMDExtensions')\nelseif cfg.flags.EnableSSE2 then\n_p(3,'StreamingSIMDExtensions2')\nend\nend\nfunction floating_point(cfg)\n if cfg.flags.FloatFast then\n_p(3,'Fast')\nelseif cfg.flags.FloatStrict then\n_p(3,'Strict')\nend\nend\nfunction debug_info(cfg)\nif cfg.flags.Symbols and not cfg.flags.NoEditAndContinue then\n_p(3,'EditAndContinue')\nelse\n_p(3,'')\nend\nend\nfunction minimal_build(cfg)\nif cfg.flags.Symbols and not cfg.flags.NoMinimalRebuild then\n_p(3,'true')\nelseif cfg.flags.Symbols then\n_p(3,'false')\nend\nend\nfunction vs10_clcompile(cfg)\n_p(2,'')\nif #cfg.buildoptions > 0 then\n_p(3,'%s %" - "%(AdditionalOptions)',\ntable.concat(premake.esc(cfg.buildoptions), \" \"))\nend\n_p(3,'%s',optimisation(cfg))\ninclude_dirs(3,cfg)\npreprocessor(3,cfg)\nminimal_build(cfg)\nif optimisation(cfg) == \"Disabled\" then\n_p(3,'EnableFastChecks')\nif cfg.flags.ExtraWarnings then\n_p(3,'true')\nend\nelse\n_p(3,'true')\nend\n_p(3,'%s', runtime(cfg))\n_p(3,'true')\nprecompiled_header(cfg)\nif cfg.flags.ExtraWarnings then\n_p(3,'Level4')\nelse\n_p(3,'Level3')\nend\nif cfg.flags.FatalWarnings then\n_p(3,'true')\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,'true')\nend\n_p(2,'')\nend\nfunction event_hooks(cfg)\nif #cfg.postbuildcommands> 0 then\n _p(2,'')\n_p(3,'%s',premake.esc(table.implode(cfg.postbuildcommands, \"\", \"\", \"\\r\\n\")))\n_p(2,'')\nend\nif #cfg.prebuildcommands> 0 then\n _p(2,'')\n_p(3,'%s',premake.esc(table.implode(cfg.prebuildcommands, \"\", \"\", \"\\r\\n\")))\n_p(2,'')\nend\nif #cfg.prelinkcommands> 0 then\n _p(2,'')\n_p(3,'%s',premake.esc(table.implode(cfg.prelinkcommands, \"\", \"\", \"\\r\\n\")))\n_p(2,'')\nend\nend\nfunction item_def_lib(cfg)\nif cfg.kind == 'StaticLib' then\n_p(1,'')\n_p(2,'$(OutDir)%s',cfg.buildtarget.name)\n_p(1,'')\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\"\n" - "end\n_p(3,'%s', target)\nend\nfunction import_lib(cfg)\nif cfg.kind == \"SharedLib\" then\nlocal implibname = cfg.linktarget.fullpath\n_p(3,'%s',iif(cfg.flags.NoImportLib, cfg.objectsdir .. \"\\\\\" .. path.getname(implibname), implibname))\nend\nend\nfunction common_link_section(cfg)\n_p(3,'%s',iif(cfg.kind == \"ConsoleApp\",\"Console\", \"Windows\"))\nif cfg.flags.Symbols then \n_p(3,'true')\nelse\n_p(3,'false')\nend\nif optimisation(cfg) ~= \"Disabled\" then\n_p(3,'true')\n_p(3,'true')\nend\n_p(3,'$(OutDir)%s.pdb'\n, path.getbasename(cfg.buildtarget.name))\nend\nfunction item_link(cfg)\n_p(2,'')\nif cfg.kind ~= 'StaticLib' then\nif #cfg.links > 0 then\n_p(3,'%s;%%(AdditionalDependencies)',\ntable.concat(premake.getlinks(cfg, \"all\", \"fullpath\"), \";\"))\nend\n_p(3,'$(OutDir)%s', cfg.buildtarget.name)\n_p(3,'%s%s%%(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,'mainCRTStartup')\nend\nimport_lib(cfg)\n_p(3,'%s', iif(cfg.platform == \"x64\", \"MachineX64\", \"MachineX86\"))\nelse\ncommon_link_section(cfg)\nend\n_p(2,'')\nend\n \nfunction item_definitions(prj)\nfor _, cfginfo in ipairs(prj.solution.vstudio_configs) do\nlocal cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform)\n_p(1,''\n,premake.esc(cfginfo.name))\nvs10_clcompile(cfg)\nresource_compile(cfg)\nitem_def_lib(cfg)\nitem_link(cfg)\nevent_hooks(cfg)\n_p(1,'')\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_container[type],translated_path)\nelse\ntable.insert(sorted_container.None,translated_path)\nend\nend\nend\nend\n -- \n -- {8fd826f8-3739-44e6-8cc8" - "-997122e53b8d}\n -- \n -- \nfunction write_file_type_block(files,group_type)\nif #files > 0 then\n_p(1,'')\nfor _, current_file in ipairs(files) do\n_p(2,'<%s Include=\\\"%s\\\" />', group_type,current_file)\nend\n_p(1,'')\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,'')\nfor _, dir in pairs(directories) do\n_p(2,'',dir)\n_p(3,'{%s}',os.uuid())\n_p(2,'')\nend\n_p(1,'')\nend\nend\nfunction write_file_filter_block(files,group_type)\nif #files > 0 " - " then\n_p(1,'')\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,'%s',path_to_file)\n_p(2,'',group_type)\nelse\n_p(2,'<%s Include=\\\"%s\\\" />', group_type,path.translate(current_file, \"\\\\\"))\nend\nend\n_p(1,'')\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('')\n_p('')\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('')\nend\n -- \n -- \n -- \n -- Create\n -- Create\n --\n --\nfunction premake.vs2010_vcxproj(prj)\nio.eol = \"\\r\\n\"\n_p('')\n_p('')\nvs2010_config(prj)\nvs2010_globals(prj)\n_p(1,'')\nconfig_type_block(prj)\n_p(1,'')\n_p(1,'')\n_p(1,'')\nimport_props(prj)\n_p(1,'')\nintermediate_and_out_dirs(prj)\nitem_definitions(prj)\nvcxproj_files(prj)\n_p(1,'')\n_p(1,'')\n_p(1,'')\n_p('')\nend\nfunction premake.vs2010_vcxproj_user(prj)\n_p('')\n_p('')\n_p('')\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", + "o\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,'')\nfor _, cfginfo in ipairs(prj.solution.vstudio_configs) do\n_p(2,'', premake.esc(cfginfo.name))\n_p(3,'%s',cfginfo.buildcfg)\n_p(3,'%s',cfginfo.platform)\n_p(2,'')\nend\n_p(1,'')\nend\nlocal function vs2010_globals(prj)\n_p(1,'')\n_p(2,'{%s}',prj.uuid)\n_p(2,'%s',prj.name)\n_p(2,'Win32Proj')\n_p(1,'')\nend\nfunction config_type(config)\nlocal t =\n{\nSharedLib = \"DynamicLibrary\",\nStaticLib = \"StaticLibrary\",\nConsoleApp = \"Application\",\n}\nreturn t[config.kind]\nend\nfunctio" + "n 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,''\n, premake.esc(cfginfo.name))\n_p(2,'%s',config_type(cfg))\n_p(2,'%s',iif(cfg.flags.Unicode,\"Unicode\",\"MultiByte\"))\nif cfg.flags.MFC then\n_p(2,'Dynamic')\nend\nlocal use_debug = \"false\"\nif optimisation(cfg) == \"Disabled\" then \nuse_debug = \"true\" \nelse\n_p(2,'true')\nend\n_p(2,'%s',use_debug)\n_p(1,'')\nend\nend\nfunction import_props(prj)\nfor _, cfginfo in ipairs(prj.solution.vstudio_configs) do\nlocal cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cf" + "ginfo.src_platform)\n_p(1,''\n,premake.esc(cfginfo.name))\n_p(2,'')\n_p(1,'')\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,'%s'\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,'%s'\n,premake.esc(cfginfo.name),shoul" + "dIgnore)\nend\nend\nfunction intermediate_and_out_dirs(prj)\n_p(1,'')\n_p(2,'<_ProjectFileVersion>10.0.30319.1')\nfor _, cfginfo in ipairs(prj.solution.vstudio_configs) do\nlocal cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform)\n_p(2,'%s\\\\'\n, premake.esc(cfginfo.name),premake.esc(cfg.buildtarget.directory) )\n_p(2,'%s\\\\'\n, premake.esc(cfginfo.name), premake.esc(cfg.objectsdir))\n_p(2,'%s'\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,'false'\n,premake.esc(cfginfo.name))\nend\nend\n_p(1,'')\nend\nfunction optimisation(cfg)\nlocal re" + "sult = \"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,'Use')\n_p(3,'%s', path.getname(cfg.pchheader))\nelse\n_p(3,'')\nend\nend\nfunction preprocessor(indent,cfg)\nif #cfg.defines > 0 then\n_p(indent,'%s;%%(PreprocessorDefinitions)'\n,premake.esc(table.concat(cfg.defines, \";\"))" + ")\nelse\n_p(indent,'')\nend\nend\nfunction include_dirs(indent,cfg)\nif #cfg.includedirs > 0 then\n_p(indent,'%s;%%(AdditionalIncludeDirectories)'\n,premake.esc(path.translate(table.concat(cfg.includedirs, \";\"), '\\\\')))\nend\nend\nfunction resource_compile(cfg)\n_p(2,'')\npreprocessor(3,cfg)\ninclude_dirs(3,cfg)\n_p(2,'')\nend\nfunction exceptions(cfg)\nif cfg.flags.NoExceptions then\n_p(2,'false')\nelseif cfg.flags.SEH then\n_p(2,'Async')\nend\nend\nfunction rtti(cfg)\nif cfg.flags.NoRTTI then\n_p(3,'false')\nend\nend\nfunction wchar_t_buildin(cfg)\nif cfg.flags.NativeWChar then\n_p(3,'true')\nelseif cfg.flags.NoNativeWChar then\n_p(3,'false'" + ")\nend\nend\nfunction sse(cfg)\nif cfg.flags.EnableSSE then\n_p(3,'StreamingSIMDExtensions')\nelseif cfg.flags.EnableSSE2 then\n_p(3,'StreamingSIMDExtensions2')\nend\nend\nfunction floating_point(cfg)\n if cfg.flags.FloatFast then\n_p(3,'Fast')\nelseif cfg.flags.FloatStrict then\n_p(3,'Strict')\nend\nend\nfunction debug_info(cfg)\nif cfg.flags.Symbols and not cfg.flags.NoEditAndContinue then\n_p(3,'EditAndContinue')\nelse\n_p(3,'')\nend\nend\nfunction minimal_build(cfg)\nif cfg.flags.Symbols and not cfg.flags.NoMinimalRebuild then\n_p(3,'true')\nelseif cfg.flags.Symbols then\n_p(3,'false')\nend\nend\nfunction vs10_clcompile(cfg)\n_p(2,'')\nif #cfg.buildoptions > 0 then\n_p(3,'%s %%(AdditionalOptions)',\ntable.concat(premake.esc(cfg.buildoptions), \" \"))\nend\n_p(3,'%s',optimisation(cfg))\ninclude_dirs(3,cfg)\npreprocessor(3,cfg)\nminimal_build(cfg)\nif optimisation(cfg) == \"Disabled\" then\n_p(3,'EnableFastChecks')\nif cfg.flags.ExtraWarnings then\n_p(3,'true')\nend\nelse\n_p(3,'true')\nend\n_p(3,'%s', runtime(cfg))\n_p(3,'true')\nprecompiled_header(cfg)\nif cfg.flags.ExtraWarnings then\n_p(3,'Level4')\nelse\n_p(3,'Level3')\nend\nif cfg.flags.FatalWarnings then\n_p(3,'true')\nend\nexceptions(cfg)\nrtti(cfg)\nwchar_t_buildin(cfg)\nsse(cfg)\nfloating_point(cfg)\ndebug_info(cfg)\nif cfg.flag" + "s.NoFramePointer then\n_p(3,'true')\nend\n_p(2,'')\nend\nfunction event_hooks(cfg)\nif #cfg.postbuildcommands> 0 then\n _p(2,'')\n_p(3,'%s',premake.esc(table.implode(cfg.postbuildcommands, \"\", \"\", \"\\r\\n\")))\n_p(2,'')\nend\nif #cfg.prebuildcommands> 0 then\n _p(2,'')\n_p(3,'%s',premake.esc(table.implode(cfg.prebuildcommands, \"\", \"\", \"\\r\\n\")))\n_p(2,'')\nend\nif #cfg.prelinkcommands> 0 then\n _p(2,'')\n_p(3,'%s',premake.esc(table.implode(cfg.prelinkcommands, \"\", \"\", \"\\r\\n\")))\n_p(2,'')\nend\nend\nfunction item_def_lib(cfg)\nif cfg.kind == 'StaticLib' then\n_p(1,'')\n_p(2,'$(OutDir)%s',cfg.buildtarget.name)\n_p(1,'')\nend\nend\nfunction link_target_machine(cfg)\nlocal target\nif cfg.platform == nil or cfg.platform == \"x32\" then target =\"MachineX" + "86\"\nelseif cfg.platform == \"x64\" then target =\"MachineX64\"\nend\n_p(3,'%s', target)\nend\nfunction import_lib(cfg)\nif cfg.kind == \"SharedLib\" then\nlocal implibname = cfg.linktarget.fullpath\n_p(3,'%s',iif(cfg.flags.NoImportLib, cfg.objectsdir .. \"\\\\\" .. path.getname(implibname), implibname))\nend\nend\nfunction common_link_section(cfg)\n_p(3,'%s',iif(cfg.kind == \"ConsoleApp\",\"Console\", \"Windows\"))\nif cfg.flags.Symbols then \n_p(3,'true')\nelse\n_p(3,'false')\nend\nif optimisation(cfg) ~= \"Disabled\" then\n_p(3,'true')\n_p(3,'true')\nend\n_p(3,'$(OutDir)%s.pdb'\n, path.getbasename(cfg.buildtarget.name))\nend\nfunction item_link(cfg)\n_p(2,'')\nif cfg.kind ~= 'Stat" + "icLib' then\nif #cfg.links > 0 then\n_p(3,'%s;%%(AdditionalDependencies)',\ntable.concat(premake.getlinks(cfg, \"all\", \"fullpath\"), \";\"))\nend\n_p(3,'$(OutDir)%s', cfg.buildtarget.name)\n_p(3,'%s%s%%(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,'mainCRTStartup')\nend\nimport_lib(cfg)\n_p(3,'%s', iif(cfg.platform == \"x64\", \"MachineX64\", \"MachineX86\"))\nelse\ncommon_link_section(cfg)\nend\n_p(2,'')\nend\n \nfunction item_definitions(prj)\nfor _, cfginfo in ipairs(prj.solution.vstudio_configs) do\nlocal cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src" + "_platform)\n_p(1,''\n,premake.esc(cfginfo.name))\nvs10_clcompile(cfg)\nresource_compile(cfg)\nitem_def_lib(cfg)\nitem_link(cfg)\nevent_hooks(cfg)\n_p(1,'')\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_container[type],translated_path)\nelse\ntable.insert(sorted_container.None,translated_path)\nend\nend\nend\nend\n -- \n -- {8fd826f8-3739-44e6-8cc8-997122e53b8d}\n -- \n -- \nfunction write_file_type_block(files,group_type)\nif #files > 0 then\n_p(1,'')\nfor _, current_file in ipairs(files) do\n_p(2,'<%s Include=\\\"%s\\\" />', group_type,current_file)\nend\n_p(1,'')\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,'')\nfor _, dir in pairs(directories) do\n_p(2,'',dir)\n_p(3,'{%s}',os.uuid())\n_p(2,'')\nend\n_p(1,'')\nend\nend\n" + "function write_file_filter_block(files,group_type)\nif #files > 0 then\n_p(1,'')\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,'%s',path_to_file)\n_p(2,'',group_type)\nelse\n_p(2,'<%s Include=\\\"%s\\\" />', group_type,path.translate(current_file, \"\\\\\"))\nend\nend\n_p(1,'')\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('')\n_p('')\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('')\nend\n -- \n -- \n -- \n -- Create\n -- Create\n --\n --\nfunction premake.vs2010_vcxproj(prj)\nio.eol = \"\\r\\n\"\n_p('')\n_p('')\nvs2010_config(prj)\nvs2010_globals(prj)\n_p(1,'')\nconfig_type_block(prj)\n_p(1,'')\n_p(1,'')\n_p(1,'')\nimport_props(prj)\n_p(1,'')\nintermediate_and_out_dirs(prj)\nitem_def" + "initions(prj)\nvcxproj_files(prj)\n_p(1,'')\n_p(1,'')\n_p(1,'')\n_p('')\nend\nfunction premake.vs2010_vcxproj_user(prj)\n_p('')\n_p('')\n_p('')\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 i" + "n 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 '" @@ -279,9 +279,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.trigger ==\"vs2010\" then\nif action.oncleanproject then\nio.write('vs2010 has an on clean and we are going to call it')\nelse\nio.write('vs2010 does not have an on clean')\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\npla" - "tforms = 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.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(p" - "rj, 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_flags.lua b/tests/actions/vstudio/test_vs2010_flags.lua index f66c2211..258ef25f 100644 --- a/tests/actions/vstudio/test_vs2010_flags.lua +++ b/tests/actions/vstudio/test_vs2010_flags.lua @@ -213,14 +213,14 @@ function vs10_flags.symbolsSetYetNotMinimalRebuild_minimalRebuild_setToTrue() end --this generates an error: invalid value 'MFC' ---[[ +---[[ function vs10_flags.mfc_useOfMfc_setToStatic() flags{"MFC"} buffer = get_buffer() - test.string_contains(buffer,'Static') + test.string_contains(buffer,'Dynamic') end ---]] +---]] function vs10_flags.Symbols_DebugInformationFormat_setToEditAndContinue() flags{"Symbols"} diff --git a/tests/actions/vstudio/test_vs2010_vcxproj.lua b/tests/actions/vstudio/test_vs2010_vcxproj.lua index 19ed4db5..f5e6ec4a 100644 --- a/tests/actions/vstudio/test_vs2010_vcxproj.lua +++ b/tests/actions/vstudio/test_vs2010_vcxproj.lua @@ -340,4 +340,9 @@ flags {"ExtraWarnings"} local buffer = get_buffer() test.string_does_not_contain(buffer,'') - end \ No newline at end of file + end + + function vs10_vcxproj.onlyOneProjectConfigurationBlockWhenMultipleConfigs() + local buffer = get_buffer() + test.string_does_not_contain(buffer,'.*') + end \ No newline at end of file diff --git a/todo.txt b/todo.txt index e185d9ce..246e98da 100644 --- a/todo.txt +++ b/todo.txt @@ -1,18 +1,16 @@ -add support for flags: Managed, MFC, Unsafe +add support for flags: Managed, Unsafe support C support Managed C++ support C# - - -Should the project define DEBUG and NDEBUG depending on if debugging info is on?? - UseDebugLibraries --added to config - whole program optimisation --added - added--- SmallerTypeCheck set to true when flags contain extra warnings and no optimisation - + MFC support added which sets Dynamic + + + 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? From 6415760b8a84f1154209615a78928913acb55063 Mon Sep 17 00:00:00 2001 From: LiamDevine Date: Mon, 21 Jun 2010 20:49:20 +0100 Subject: [PATCH 19/19] Fixed bug where a filter path had a dot in it's path added C support --- src/actions/vstudio/_vstudio.lua | 4 +- src/actions/vstudio/vs2010_vcxproxj.lua | 14 +++--- src/host/scripts.c | 47 ++++++++++--------- tests/actions/vstudio/test_vs2010_filters.lua | 32 ++++++++++++- tests/actions/vstudio/test_vs2010_vcxproj.lua | 9 +++- 5 files changed, 74 insertions(+), 32 deletions(-) diff --git a/src/actions/vstudio/_vstudio.lua b/src/actions/vstudio/_vstudio.lua index b6639218..a785f8b6 100644 --- a/src/actions/vstudio/_vstudio.lua +++ b/src/actions/vstudio/_vstudio.lua @@ -260,6 +260,8 @@ 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" @@ -431,7 +433,7 @@ valid_kinds = { "ConsoleApp", "WindowedApp", "StaticLib", "SharedLib" }, - valid_languages = { "C++"}, + valid_languages = { "C++","C"}, valid_tools = { cc = { "msc" }, diff --git a/src/actions/vstudio/vs2010_vcxproxj.lua b/src/actions/vstudio/vs2010_vcxproxj.lua index ac2afc2c..67bbc474 100644 --- a/src/actions/vstudio/vs2010_vcxproxj.lua +++ b/src/actions/vstudio/vs2010_vcxproxj.lua @@ -22,7 +22,7 @@ premake.vstudio.vcxproj = { } function list_of_directories_in_path(path) local list={} if path then - for dir in string.gmatch(path,"[%w%-%_]+\\")do + for dir in string.gmatch(path,"[%w%-%_%.]+\\")do if #list == 0 then list[1] = dir:sub(1,#dir-1) else @@ -313,6 +313,12 @@ premake.vstudio.vcxproj = { } _p(3,'false') end end + + function compile_language(cfg) + if cfg.language == "C" then + _p(3,'CompileAsC') + end + end function vs10_clcompile(cfg) _p(2,'') @@ -334,7 +340,6 @@ premake.vstudio.vcxproj = { } _p(3,'true') end else - --if optimisation(cfg) ~= "Disabled" then _p(3,'true') end @@ -346,9 +351,6 @@ premake.vstudio.vcxproj = { } if cfg.flags.ExtraWarnings then _p(3,'Level4') - --if optimisation(cfg) == "Disabled" then - -- _p(3,'true') - --end else _p(3,'Level3') end @@ -369,7 +371,7 @@ premake.vstudio.vcxproj = { } _p(3,'true') end - + compile_language(cfg) _p(2,'') end diff --git a/src/host/scripts.c b/src/host/scripts.c index ac10d6a9..909bd1f3 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, \"\")\nelseif (state == \"GroupEnd\") then\noutput(indent, \"\")\nelse\nou" "tput(indent, \"\")\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\")\noutput(indent, \"\\t\\t\")\noutput(indent, \"\\t\")\nend\nend\nend\noutput(indent, \"\")\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\"\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 = function(sln)\npremake.generate(sln, \"%%.sln\", premake.vs2002_solution)\nend,\nonproject = fu" - "nction(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)\nif premake.isdotnetproject(prj) then\npremake.generate(prj, \"%%.csproj\", premake.vs2002_c" - "sproj)\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(pr" - "j, \"%%.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,\no" - "ncleanproject = 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++\"},\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 = premake.vs2010_cleantarget\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(" @@ -228,24 +229,24 @@ const char* builtin_scripts[] = { "= 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) d" - "o\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,'')\nfor _, cfginfo in ipairs(prj.solution.vstudio_configs) do\n_p(2,'', premake.esc(cfginfo.name))\n_p(3,'%s',cfginfo.buildcfg)\n_p(3,'%s',cfginfo.platform)\n_p(2,'')\nend\n_p(1,'')\nend\nlocal function vs2010_globals(prj)\n_p(1,'')\n_p(2,'{%s}',prj.uuid)\n_p(2,'%s',prj.name)\n_p(2,'Win32Proj')\n_p(1,'')\nend\nfunction config_type(config)\nlocal t =\n{\nSharedLib = \"DynamicLibrary\",\nStaticLib = \"StaticLibrary\",\nConsoleApp = \"Application\",\n}\nreturn t[config.kind]\nend\nfunctio" - "n 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,''\n, premake.esc(cfginfo.name))\n_p(2,'%s',config_type(cfg))\n_p(2,'%s',iif(cfg.flags.Unicode,\"Unicode\",\"MultiByte\"))\nif cfg.flags.MFC then\n_p(2,'Dynamic')\nend\nlocal use_debug = \"false\"\nif optimisation(cfg) == \"Disabled\" then \nuse_debug = \"true\" \nelse\n_p(2,'true')\nend\n_p(2,'%s',use_debug)\n_p(1,'')\nend\nend\nfunction import_props(prj)\nfor _, cfginfo in ipairs(prj.solution.vstudio_configs) do\nlocal cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cf" - "ginfo.src_platform)\n_p(1,''\n,premake.esc(cfginfo.name))\n_p(2,'')\n_p(1,'')\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,'%s'\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,'%s'\n,premake.esc(cfginfo.name),shoul" - "dIgnore)\nend\nend\nfunction intermediate_and_out_dirs(prj)\n_p(1,'')\n_p(2,'<_ProjectFileVersion>10.0.30319.1')\nfor _, cfginfo in ipairs(prj.solution.vstudio_configs) do\nlocal cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform)\n_p(2,'%s\\\\'\n, premake.esc(cfginfo.name),premake.esc(cfg.buildtarget.directory) )\n_p(2,'%s\\\\'\n, premake.esc(cfginfo.name), premake.esc(cfg.objectsdir))\n_p(2,'%s'\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,'false'\n,premake.esc(cfginfo.name))\nend\nend\n_p(1,'')\nend\nfunction optimisation(cfg)\nlocal re" - "sult = \"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,'Use')\n_p(3,'%s', path.getname(cfg.pchheader))\nelse\n_p(3,'')\nend\nend\nfunction preprocessor(indent,cfg)\nif #cfg.defines > 0 then\n_p(indent,'%s;%%(PreprocessorDefinitions)'\n,premake.esc(table.concat(cfg.defines, \";\"))" - ")\nelse\n_p(indent,'')\nend\nend\nfunction include_dirs(indent,cfg)\nif #cfg.includedirs > 0 then\n_p(indent,'%s;%%(AdditionalIncludeDirectories)'\n,premake.esc(path.translate(table.concat(cfg.includedirs, \";\"), '\\\\')))\nend\nend\nfunction resource_compile(cfg)\n_p(2,'')\npreprocessor(3,cfg)\ninclude_dirs(3,cfg)\n_p(2,'')\nend\nfunction exceptions(cfg)\nif cfg.flags.NoExceptions then\n_p(2,'false')\nelseif cfg.flags.SEH then\n_p(2,'Async')\nend\nend\nfunction rtti(cfg)\nif cfg.flags.NoRTTI then\n_p(3,'false')\nend\nend\nfunction wchar_t_buildin(cfg)\nif cfg.flags.NativeWChar then\n_p(3,'true')\nelseif cfg.flags.NoNativeWChar then\n_p(3,'false'" - ")\nend\nend\nfunction sse(cfg)\nif cfg.flags.EnableSSE then\n_p(3,'StreamingSIMDExtensions')\nelseif cfg.flags.EnableSSE2 then\n_p(3,'StreamingSIMDExtensions2')\nend\nend\nfunction floating_point(cfg)\n if cfg.flags.FloatFast then\n_p(3,'Fast')\nelseif cfg.flags.FloatStrict then\n_p(3,'Strict')\nend\nend\nfunction debug_info(cfg)\nif cfg.flags.Symbols and not cfg.flags.NoEditAndContinue then\n_p(3,'EditAndContinue')\nelse\n_p(3,'')\nend\nend\nfunction minimal_build(cfg)\nif cfg.flags.Symbols and not cfg.flags.NoMinimalRebuild then\n_p(3,'true')\nelseif cfg.flags.Symbols then\n_p(3,'false')\nend\nend\nfunction vs10_clcompile(cfg)\n_p(2,'')\nif #cfg.buildoptions > 0 then\n_p(3,'%s %%(AdditionalOptions)',\ntable.concat(premake.esc(cfg.buildoptions), \" \"))\nend\n_p(3,'%s',optimisation(cfg))\ninclude_dirs(3,cfg)\npreprocessor(3,cfg)\nminimal_build(cfg)\nif optimisation(cfg) == \"Disabled\" then\n_p(3,'EnableFastChecks')\nif cfg.flags.ExtraWarnings then\n_p(3,'true')\nend\nelse\n_p(3,'true')\nend\n_p(3,'%s', runtime(cfg))\n_p(3,'true')\nprecompiled_header(cfg)\nif cfg.flags.ExtraWarnings then\n_p(3,'Level4')\nelse\n_p(3,'Level3')\nend\nif cfg.flags.FatalWarnings then\n_p(3,'true')\nend\nexceptions(cfg)\nrtti(cfg)\nwchar_t_buildin(cfg)\nsse(cfg)\nfloating_point(cfg)\ndebug_info(cfg)\nif cfg.flag" - "s.NoFramePointer then\n_p(3,'true')\nend\n_p(2,'')\nend\nfunction event_hooks(cfg)\nif #cfg.postbuildcommands> 0 then\n _p(2,'')\n_p(3,'%s',premake.esc(table.implode(cfg.postbuildcommands, \"\", \"\", \"\\r\\n\")))\n_p(2,'')\nend\nif #cfg.prebuildcommands> 0 then\n _p(2,'')\n_p(3,'%s',premake.esc(table.implode(cfg.prebuildcommands, \"\", \"\", \"\\r\\n\")))\n_p(2,'')\nend\nif #cfg.prelinkcommands> 0 then\n _p(2,'')\n_p(3,'%s',premake.esc(table.implode(cfg.prelinkcommands, \"\", \"\", \"\\r\\n\")))\n_p(2,'')\nend\nend\nfunction item_def_lib(cfg)\nif cfg.kind == 'StaticLib' then\n_p(1,'')\n_p(2,'$(OutDir)%s',cfg.buildtarget.name)\n_p(1,'')\nend\nend\nfunction link_target_machine(cfg)\nlocal target\nif cfg.platform == nil or cfg.platform == \"x32\" then target =\"MachineX" - "86\"\nelseif cfg.platform == \"x64\" then target =\"MachineX64\"\nend\n_p(3,'%s', target)\nend\nfunction import_lib(cfg)\nif cfg.kind == \"SharedLib\" then\nlocal implibname = cfg.linktarget.fullpath\n_p(3,'%s',iif(cfg.flags.NoImportLib, cfg.objectsdir .. \"\\\\\" .. path.getname(implibname), implibname))\nend\nend\nfunction common_link_section(cfg)\n_p(3,'%s',iif(cfg.kind == \"ConsoleApp\",\"Console\", \"Windows\"))\nif cfg.flags.Symbols then \n_p(3,'true')\nelse\n_p(3,'false')\nend\nif optimisation(cfg) ~= \"Disabled\" then\n_p(3,'true')\n_p(3,'true')\nend\n_p(3,'$(OutDir)%s.pdb'\n, path.getbasename(cfg.buildtarget.name))\nend\nfunction item_link(cfg)\n_p(2,'')\nif cfg.kind ~= 'Stat" - "icLib' then\nif #cfg.links > 0 then\n_p(3,'%s;%%(AdditionalDependencies)',\ntable.concat(premake.getlinks(cfg, \"all\", \"fullpath\"), \";\"))\nend\n_p(3,'$(OutDir)%s', cfg.buildtarget.name)\n_p(3,'%s%s%%(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,'mainCRTStartup')\nend\nimport_lib(cfg)\n_p(3,'%s', iif(cfg.platform == \"x64\", \"MachineX64\", \"MachineX86\"))\nelse\ncommon_link_section(cfg)\nend\n_p(2,'')\nend\n \nfunction item_definitions(prj)\nfor _, cfginfo in ipairs(prj.solution.vstudio_configs) do\nlocal cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src" - "_platform)\n_p(1,''\n,premake.esc(cfginfo.name))\nvs10_clcompile(cfg)\nresource_compile(cfg)\nitem_def_lib(cfg)\nitem_link(cfg)\nevent_hooks(cfg)\n_p(1,'')\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_container[type],translated_path)\nelse\ntable.insert(sorted_container.None,translated_path)\nend\nend\nend\nend\n -- \n -- {8fd826f8-3739-44e6-8cc8-997122e53b8d}\n -- \n -- \nfunction write_file_type_block(files,group_type)\nif #files > 0 then\n_p(1,'')\nfor _, current_file in ipairs(files) do\n_p(2,'<%s Include=\\\"%s\\\" />', group_type,current_file)\nend\n_p(1,'')\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,'')\nfor _, dir in pairs(directories) do\n_p(2,'',dir)\n_p(3,'{%s}',os.uuid())\n_p(2,'')\nend\n_p(1,'')\nend\nend\n" - "function write_file_filter_block(files,group_type)\nif #files > 0 then\n_p(1,'')\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,'%s',path_to_file)\n_p(2,'',group_type)\nelse\n_p(2,'<%s Include=\\\"%s\\\" />', group_type,path.translate(current_file, \"\\\\\"))\nend\nend\n_p(1,'')\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('')\n_p('')\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('')\nend\n -- \n -- \n -- \n -- Create\n -- Create\n --\n --\nfunction premake.vs2010_vcxproj(prj)\nio.eol = \"\\r\\n\"\n_p('')\n_p('')\nvs2010_config(prj)\nvs2010_globals(prj)\n_p(1,'')\nconfig_type_block(prj)\n_p(1,'')\n_p(1,'')\n_p(1,'')\nimport_props(prj)\n_p(1,'')\nintermediate_and_out_dirs(prj)\nitem_def" - "initions(prj)\nvcxproj_files(prj)\n_p(1,'')\n_p(1,'')\n_p(1,'')\n_p('')\nend\nfunction premake.vs2010_vcxproj_user(prj)\n_p('')\n_p('')\n_p('')\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 i" - "n 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", + "\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,'')\nfor _, cfginfo in ipairs(prj.solution.vstudio_configs) do\n_p(2,'', premake.esc(cfginfo.name))\n_p(3,'%s',cfginfo.buildcfg)\n_p(3,'%s',cfginfo.platform)\n_p(2,'')\nend\n_p(1,'')\nend\nlocal function vs2010_globals(prj)\n_p(1,'')\n_p(2,'{%s}',prj.uuid)\n_p(2,'%s',prj.name)\n_p(2,'Win32Proj')\n_p(1,'')\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,''\n, premake.esc(cfginfo.name))\n_p(2,'%s',config_type(cfg))\n_p(2,'%s',iif(cfg.flags.Unicode,\"Unicode\",\"MultiByte\"))\nif cfg.flags.MFC then\n_p(2,'Dynamic')\nend\nlocal use_debug = \"false\"\nif optimisation(cfg) == \"Disabled\" then \nuse_debug = \"true\" \nelse\n_p(2,'true')\nend\n_p(2,'%s',use_debug)\n_p(1,'')\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,''\n,premake.esc(cfginfo.name))\n_p(2,'')\n_p(1,'')\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,'%s'\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,'%s'\n,premake.esc(cfginfo.name),sho" + "uldIgnore)\nend\nend\nfunction intermediate_and_out_dirs(prj)\n_p(1,'')\n_p(2,'<_ProjectFileVersion>10.0.30319.1')\nfor _, cfginfo in ipairs(prj.solution.vstudio_configs) do\nlocal cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform)\n_p(2,'%s\\\\'\n, premake.esc(cfginfo.name),premake.esc(cfg.buildtarget.directory) )\n_p(2,'%s\\\\'\n, premake.esc(cfginfo.name), premake.esc(cfg.objectsdir))\n_p(2,'%s'\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,'false'\n,premake.esc(cfginfo.name))\nend\nend\n_p(1,'')\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,'Use')\n_p(3,'%s', path.getname(cfg.pchheader))\nelse\n_p(3,'')\nend\nend\nfunction preprocessor(indent,cfg)\nif #cfg.defines > 0 then\n_p(indent,'%s;%%(PreprocessorDefinitions)'\n,premake.esc(table.concat(cfg.defines, \";\"" + ")))\nelse\n_p(indent,'')\nend\nend\nfunction include_dirs(indent,cfg)\nif #cfg.includedirs > 0 then\n_p(indent,'%s;%%(AdditionalIncludeDirectories)'\n,premake.esc(path.translate(table.concat(cfg.includedirs, \";\"), '\\\\')))\nend\nend\nfunction resource_compile(cfg)\n_p(2,'')\npreprocessor(3,cfg)\ninclude_dirs(3,cfg)\n_p(2,'')\nend\nfunction exceptions(cfg)\nif cfg.flags.NoExceptions then\n_p(2,'false')\nelseif cfg.flags.SEH then\n_p(2,'Async')\nend\nend\nfunction rtti(cfg)\nif cfg.flags.NoRTTI then\n_p(3,'false')\nend\nend\nfunction wchar_t_buildin(cfg)\nif cfg.flags.NativeWChar then\n_p(3,'true')\nelseif cfg.flags.NoNativeWChar then\n_p(3,'false')\nend\nend\nfunction sse(cfg)\nif cfg.flags.EnableSSE then\n_p(3,'StreamingSIMDExtensions')\nelseif cfg.flags.EnableSSE2 then\n_p(3,'StreamingSIMDExtensions2')\nend\nend\nfunction floating_point(cfg)\n if cfg.flags.FloatFast then\n_p(3,'Fast')\nelseif cfg.flags.FloatStrict then\n_p(3,'Strict')\nend\nend\nfunction debug_info(cfg)\nif cfg.flags.Symbols and not cfg.flags.NoEditAndContinue then\n_p(3,'EditAndContinue')\nelse\n_p(3,'')\nend\nend\nfunction minimal_build(cfg)\nif cfg.flags.Symbols and not cfg.flags.NoMinimalRebuild then\n_p(3,'true')\nelseif cfg.flags.Symbols then\n_p(3,'false')\nend\nend\nfunction compile_language(cfg)\nif cfg.lang" + "uage == \"C\" then\n_p(3,'CompileAsC')\nend\nend\nfunction vs10_clcompile(cfg)\n_p(2,'')\nif #cfg.buildoptions > 0 then\n_p(3,'%s %%(AdditionalOptions)',\ntable.concat(premake.esc(cfg.buildoptions), \" \"))\nend\n_p(3,'%s',optimisation(cfg))\ninclude_dirs(3,cfg)\npreprocessor(3,cfg)\nminimal_build(cfg)\nif optimisation(cfg) == \"Disabled\" then\n_p(3,'EnableFastChecks')\nif cfg.flags.ExtraWarnings then\n_p(3,'true')\nend\nelse\n_p(3,'true')\nend\n_p(3,'%s', runtime(cfg))\n_p(3,'true')\nprecompiled_header(cfg)\nif cfg.flags.ExtraWarnings then\n_p(3,'Level4')\nelse\n_p(3,'Level3')\nend\nif cfg.flags.FatalWarnings then\n_p(3,'true" + "')\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,'true')\nend\ncompile_language(cfg)\n_p(2,'')\nend\nfunction event_hooks(cfg)\nif #cfg.postbuildcommands> 0 then\n _p(2,'')\n_p(3,'%s',premake.esc(table.implode(cfg.postbuildcommands, \"\", \"\", \"\\r\\n\")))\n_p(2,'')\nend\nif #cfg.prebuildcommands> 0 then\n _p(2,'')\n_p(3,'%s',premake.esc(table.implode(cfg.prebuildcommands, \"\", \"\", \"\\r\\n\")))\n_p(2,'')\nend\nif #cfg.prelinkcommands> 0 then\n _p(2,'')\n_p(3,'%s',premake.esc(table.implode(cfg.prelinkcommands, \"\", \"\", \"\\r\\n\")))\n_p(2,'')\nend\nend\nfunction item_def_lib(cfg)\nif cfg.kind == 'StaticLib' then\n_p(1,'')\n_p(2,'$(OutDir)%s',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,'%s', target)\nend\nfunction import_lib(cfg)\nif cfg.kind == \"SharedLib\" then\nlocal implibname = cfg.linktarget.fullpath\n_p(3,'%s',iif(cfg.flags.NoImportLib, cfg.objectsdir .. \"\\\\\" .. path.getname(implibname), implibname))\nend\nend\nfunction common_link_section(cfg)\n_p(3,'%s',iif(cfg.kind == \"ConsoleApp\",\"Console\", \"Windows\"))\nif cfg.flags.Symbols then \n_p(3,'true')\nelse\n_p(3,'false')\nend\nif optimisation(cfg) ~= \"Disabled\" then\n_p(3,'true')\n_p(3,'true')\nend\n_p(3,'$(OutDir)%s." + "pdb'\n, path.getbasename(cfg.buildtarget.name))\nend\nfunction item_link(cfg)\n_p(2,'')\nif cfg.kind ~= 'StaticLib' then\nif #cfg.links > 0 then\n_p(3,'%s;%%(AdditionalDependencies)',\ntable.concat(premake.getlinks(cfg, \"all\", \"fullpath\"), \";\"))\nend\n_p(3,'$(OutDir)%s', cfg.buildtarget.name)\n_p(3,'%s%s%%(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,'mainCRTStartup')\nend\nimport_lib(cfg)\n_p(3,'%s', iif(cfg.platform == \"x64\", \"MachineX64\", \"MachineX86\"))\nelse\ncommon_link_section(cfg)\nend\n_p(2,'')\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,''\n,premake.esc(cfginfo.name))\nvs10_clcompile(cfg)\nresource_compile(cfg)\nitem_def_lib(cfg)\nitem_link(cfg)\nevent_hooks(cfg)\n_p(1,'')\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 -- \n -- {8fd826f8-3739-44e6-8cc8-997122e53b8d}\n -- \n -- \nfunction write_file_type_block(files,group_type)\nif #files > 0 then\n_p(1,'')\nfor _, current_file in ipairs(files) do\n_p(2,'<%s Include=\\\"%s\\\" />', group_type,current_file)\nend\n_p(1,'')\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,'')\nfor _, dir in pairs(directories) do\n_p(2,'',dir)\n_p(3,'{%s}',os.uuid())\n_p(2,'')\nend\n_p(1,'')\nend\nend\nfunction write_file_filter_block(files,group_type)\nif #files > 0 then\n_p(1,'')\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,'%s',path_to_file)\n_p(2,'',group_type)\nelse\n_p(2,'<%s Include=\\\"%s\\\" />', group_type,path.translate(current_file, \"\\\\\"))\nend\nend\n_p(1,'')\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('')\n_p('')\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('')\nend\n -- \n -- \n -- \n -- Create\n -- Create\n --\n --\nfunction premake.vs2010_vcxproj(prj)\nio.eol = \"\\r\\n\"\n_p('')\n_p('')\nvs2010_config(prj)\nvs2010_globals(prj)\n_p(1,'')\nconfig_type_block(prj)\n_p(1,'')\n_p(1,'')\n_p(1,'')\nimport_props(prj)\n_p(1,'')\nintermediate_and_out_dirs(prj)\nitem_definitions(prj)\nvcxproj_files(prj)\n_p(1,'')\n_p(1,'')\n_p(1,'')\n_p('')\nend\nfunction premake.vs2010_vcxproj_user(prj)\n_p('')\n_p('')\n_p('')\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 '" diff --git a/tests/actions/vstudio/test_vs2010_filters.lua b/tests/actions/vstudio/test_vs2010_filters.lua index c26c8ca7..d4621cab 100644 --- a/tests/actions/vstudio/test_vs2010_filters.lua +++ b/tests/actions/vstudio/test_vs2010_filters.lua @@ -360,4 +360,34 @@ test.string_contains(buffer,'.*') - end \ No newline at end of file + end + + function vs10_vcxproj.languageC_bufferContainsCompileAsC() + language "C" + local buffer = get_buffer() + test.string_contains(buffer,'CompileAsC') + end + \ No newline at end of file