From 408a94ebaea8c42fb7cf62e202b29b53c5f4abaf Mon Sep 17 00:00:00 2001 From: liamDevine Date: Tue, 27 Jul 2010 16:24:00 +0100 Subject: [PATCH 1/6] Added config_type to the namespace premake.vstudio.vs10_helpers from local scope Fixed config_type not returning Application for a WindowedApp --- src/actions/vstudio/vs2010_vcxproxj.lua | 7 ++++--- tests/actions/vstudio/test_vs2010_project_kinds.lua | 6 ++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/actions/vstudio/vs2010_vcxproxj.lua b/src/actions/vstudio/vs2010_vcxproxj.lua index e2b25bcf..f2b2333b 100644 --- a/src/actions/vstudio/vs2010_vcxproxj.lua +++ b/src/actions/vstudio/vs2010_vcxproxj.lua @@ -122,12 +122,13 @@ local vs10_helpers = premake.vstudio.vs10_helpers _p(1,'') end - local function config_type(config) + function vs10_helpers.config_type(config) local t = { SharedLib = "DynamicLibrary", StaticLib = "StaticLibrary", - ConsoleApp = "Application", + ConsoleApp = "Application", + WindowedApp = "Application" } return t[config.kind] end @@ -155,7 +156,7 @@ local vs10_helpers = premake.vstudio.vs10_helpers 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',vs10_helpers.config_type(cfg)) _p(2,'%s',iif(cfg.flags.Unicode,"Unicode","MultiByte")) if cfg.flags.MFC then diff --git a/tests/actions/vstudio/test_vs2010_project_kinds.lua b/tests/actions/vstudio/test_vs2010_project_kinds.lua index 0a19b491..80a3ba0e 100644 --- a/tests/actions/vstudio/test_vs2010_project_kinds.lua +++ b/tests/actions/vstudio/test_vs2010_project_kinds.lua @@ -151,4 +151,10 @@ shared lib missing ??? in link section when noIn local buffer = get_buffer() test.string_does_not_contain(buffer,'.*.*') end + + function vs10_project_kinds.configType_configIsWindowedApp_resultComparesEqualToApplication() + local t = { kind = "WindowedApp"} + local result = premake.vstudio.vs10_helpers.config_type(t) + test.isequal('Application',result) + end \ No newline at end of file From df4e215fef2888f6ce32bdf201f1b1f6187c6394 Mon Sep 17 00:00:00 2001 From: liamDevine Date: Tue, 27 Jul 2010 19:25:36 +0100 Subject: [PATCH 2/6] Resource script now put in correct ItemGroup which is ResourceCompile inside a *.vcxproj --- src/actions/vstudio/vs2010_vcxproxj.lua | 11 ++- tests/actions/vstudio/test_vs2010_vcxproj.lua | 81 +++++++++++-------- 2 files changed, 57 insertions(+), 35 deletions(-) diff --git a/src/actions/vstudio/vs2010_vcxproxj.lua b/src/actions/vstudio/vs2010_vcxproxj.lua index f2b2333b..81f09daf 100644 --- a/src/actions/vstudio/vs2010_vcxproxj.lua +++ b/src/actions/vstudio/vs2010_vcxproxj.lua @@ -84,7 +84,8 @@ local vs10_helpers = premake.vstudio.vs10_helpers c = "ClCompile", cpp = "ClCompile", cxx = "ClCompile", - cc = "ClCompile" + cc = "ClCompile", + rc = "ResourceCompile" } for _, current_file in ipairs(files) do @@ -499,7 +500,7 @@ local vs10_helpers = premake.vstudio.vs10_helpers common_link_section(cfg) - if (cfg.kind == "ConsoleApp" or cfg.kind == "WindowedApp") and not cfg.flags.WinMain then + if vs10_helpers.config_type(cfg) == 'Application' and not cfg.flags.WinMain then _p(3,'mainCRTStartup') end @@ -541,6 +542,8 @@ local vs10_helpers = premake.vstudio.vs10_helpers -- local function write_file_type_block(files,group_type) + _p(4,#files) + _p(4,group_type) if #files > 0 then _p(1,'') for _, current_file in ipairs(files) do @@ -555,7 +558,8 @@ local vs10_helpers = premake.vstudio.vs10_helpers { ClCompile ={}, ClInclude ={}, - None ={} + None ={}, + ResourceCompile ={} } cfg = premake.getconfig(prj) @@ -563,6 +567,7 @@ local vs10_helpers = premake.vstudio.vs10_helpers write_file_type_block(sorted.ClInclude,"ClInclude") write_file_type_block(sorted.ClCompile,'ClCompile') write_file_type_block(sorted.None,'None') + write_file_type_block(sorted.ResourceCompile,'ResourceCompile') end diff --git a/tests/actions/vstudio/test_vs2010_vcxproj.lua b/tests/actions/vstudio/test_vs2010_vcxproj.lua index fff203f4..07d29375 100644 --- a/tests/actions/vstudio/test_vs2010_vcxproj.lua +++ b/tests/actions/vstudio/test_vs2010_vcxproj.lua @@ -28,7 +28,8 @@ "foo/dummyHeader.h", "foo/dummySource.cpp", "../src/host/*h", - "../src/host/*.c" + "../src/host/*.c", + "dummyResourceScript.rc" } configuration("Release") @@ -47,99 +48,99 @@ premake.buildconfigs() sln.vstudio_configs = premake.vstudio_buildconfigs(sln) premake.vs2010_vcxproj(prj) - buffer = io.endcapture() + local buffer = io.endcapture() return buffer end function vs10_vcxproj.xmlDeclarationPresent() - buffer = get_buffer() + local buffer = get_buffer() test.istrue(string.startswith(buffer, '')) end function vs10_vcxproj.projectBlocksArePresent() - buffer = get_buffer() + local buffer = get_buffer() test.string_contains(buffer,'') end function vs10_vcxproj.projectOpenTagIsCorrect() - buffer = get_buffer() + local buffer = get_buffer() test.string_contains(buffer,'.*') end function vs10_vcxproj.configItemGroupPresent() - buffer = get_buffer() + local buffer = get_buffer() test.string_contains(buffer,'.*') end function vs10_vcxproj.configBlocksArePresent() - buffer = get_buffer() + local buffer = get_buffer() test.string_contains(buffer,'') end function vs10_vcxproj.configTypeBlockPresent() - buffer = get_buffer() + local buffer = get_buffer() test.string_contains(buffer,'.*') end function vs10_vcxproj.twoConfigTypeBlocksPresent() - buffer = get_buffer() + local buffer = get_buffer() test.string_contains(buffer,'.*') end function vs10_vcxproj.propsDefaultForCppProjArePresent() - buffer = get_buffer() + local buffer = get_buffer() test.string_contains(buffer,'') end function vs10_vcxproj.propsForCppProjArePresent() - buffer = get_buffer() + local buffer = get_buffer() test.string_contains(buffer,'') end function vs10_vcxproj.extensionSettingArePresent() - buffer = get_buffer() + local buffer = get_buffer() test.string_contains(buffer,'.*') end function vs10_vcxproj.userMacrosPresent() - buffer = get_buffer() + local buffer = get_buffer() test.string_contains(buffer,'') end function vs10_vcxproj.intermediateAndOutDirsPropertyGroupWithMagicNumber() - buffer = get_buffer() + local buffer = get_buffer() test.string_contains(buffer,'.*<_ProjectFileVersion>10%.0%.30319%.1') end function vs10_vcxproj.outDirPresent() - buffer = get_buffer() + local buffer = get_buffer() test.string_contains(buffer,'') end function vs10_vcxproj.initDirPresent() - buffer = get_buffer() + local buffer = get_buffer() test.string_contains(buffer,'') end function vs10_vcxproj.projectWithDebugAndReleaseConfig_twoOutDirsAndTwoIntDirs() - buffer = get_buffer() + local buffer = get_buffer() test.string_contains(buffer,'.*.*.*') end function vs10_vcxproj.containsItemDefinition() - buffer = get_buffer() + local buffer = get_buffer() test.string_contains(buffer,'.*') end function vs10_vcxproj.containsClCompileBlock() - buffer = get_buffer() + local buffer = get_buffer() test.string_contains(buffer,'.*') end function vs10_vcxproj.containsAdditionalOptions() buildoptions {"/Gm"} - buffer = get_buffer() + local buffer = get_buffer() test.string_contains(buffer,'/Gm %%%(AdditionalOptions%)') end @@ -148,47 +149,47 @@ end function vs10_vcxproj.debugHasNoOptimisation() - buffer = get_buffer() + local buffer = get_buffer() test.string_contains(buffer, cl_compile_string('Debug').. '.*Disabled.*') end function vs10_vcxproj.releaseHasFullOptimisation() - buffer = get_buffer() + local buffer = get_buffer() test.string_contains(buffer, cl_compile_string('Release').. '.*Full.*') end function vs10_vcxproj.includeDirectories_debugEntryContains_include_directory() - buffer = get_buffer() + local 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() + local 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() + local buffer = get_buffer() test.string_contains(buffer,cl_compile_string('Debug').. '.*.*'.. path.translate(include_directory2, '\\') ..';.*') end function vs10_vcxproj.debugContainsPreprossorBlock() - buffer = get_buffer() + local buffer = get_buffer() test.string_contains(buffer,cl_compile_string('Debug').. '.*.*') end function vs10_vcxproj.debugHasDebugDefine() - buffer = get_buffer() + local buffer = get_buffer() test.string_contains(buffer,cl_compile_string('Debug')..'.*.*'..debug_define..'.*') end function vs10_vcxproj.releaseHasStringPoolingOn() - buffer = get_buffer() + local buffer = get_buffer() test.string_contains(buffer,cl_compile_string('Release')..'.*true') end function vs10_vcxproj.hasItemGroupSection() - buffer = get_buffer() + local buffer = get_buffer() test.string_contains(buffer,'.*') end @@ -227,7 +228,8 @@ { ClInclude ={}, ClCompile ={}, - None ={} + None ={}, + ResourceCompile ={} } vs10_helpers.sort_input_files(input,sorted) return sorted @@ -250,8 +252,22 @@ test.isequal(file, sorted.None) end + function vs10_vcxproj.sortFile_resourceScript_resourceCompileEqualToFile() + local file = {"foo.rc"} + local sorted = SortAndReturnSortedInputFiles(file) + test.isequal(file, sorted.ResourceCompile) + end + + function vs10_vcxproj.itemGroupSection_hasResourceCompileSection() + --for some reason this does not work here and it needs to be in + --the project setting at the top ? + --files{"dummyResourceScript.rc"} + local buffer = get_buffer() + test.string_contains(buffer,'.*') + end + function vs10_vcxproj.itemGroupSection_hasHeaderListed() - buffer = get_buffer() + local buffer = get_buffer() test.string_contains(buffer,'.*.*') end @@ -352,5 +368,6 @@ language "C" local buffer = get_buffer() test.string_contains(buffer,'CompileAsC') - end + end + \ No newline at end of file From 8626609492cb88f91f71c50e38303d6dd78e4be6 Mon Sep 17 00:00:00 2001 From: liamDevine Date: Tue, 27 Jul 2010 19:28:17 +0100 Subject: [PATCH 3/6] Removed debug print statements that were added due to files no being included --- src/actions/vstudio/vs2010_vcxproxj.lua | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/actions/vstudio/vs2010_vcxproxj.lua b/src/actions/vstudio/vs2010_vcxproxj.lua index 81f09daf..2cc94f2c 100644 --- a/src/actions/vstudio/vs2010_vcxproxj.lua +++ b/src/actions/vstudio/vs2010_vcxproxj.lua @@ -542,8 +542,6 @@ local vs10_helpers = premake.vstudio.vs10_helpers -- local function write_file_type_block(files,group_type) - _p(4,#files) - _p(4,group_type) if #files > 0 then _p(1,'') for _, current_file in ipairs(files) do From 0382a1c310fa7459e69714bd0e80feb30bc09aab Mon Sep 17 00:00:00 2001 From: liamDevine Date: Tue, 27 Jul 2010 20:02:11 +0100 Subject: [PATCH 4/6] embedded scripts --- src/actions/vstudio/vs2010_vcxproxj.lua | 4 ++- src/host/scripts.c | 34 +++++++++---------- tests/actions/vstudio/test_vs2010_filters.lua | 11 +++++- 3 files changed, 30 insertions(+), 19 deletions(-) diff --git a/src/actions/vstudio/vs2010_vcxproxj.lua b/src/actions/vstudio/vs2010_vcxproxj.lua index 2cc94f2c..78375279 100644 --- a/src/actions/vstudio/vs2010_vcxproxj.lua +++ b/src/actions/vstudio/vs2010_vcxproxj.lua @@ -607,7 +607,8 @@ local vs10_helpers = premake.vstudio.vs10_helpers { ClCompile ={}, ClInclude ={}, - None ={} + None ={}, + ResourceCompile ={} } cfg = premake.getconfig(prj) @@ -620,6 +621,7 @@ local vs10_helpers = premake.vstudio.vs10_helpers write_file_filter_block(sorted.ClInclude,"ClInclude") write_file_filter_block(sorted.ClCompile,"ClCompile") write_file_filter_block(sorted.None,"None") + write_file_filter_block(sorted.ResourceCompile,"ResourceCompile") _p('') end diff --git a/src/host/scripts.c b/src/host/scripts.c index fbec2d18..99176fab 100644 --- a/src/host/scripts.c +++ b/src/host/scripts.c @@ -230,23 +230,23 @@ const char* builtin_scripts[] = { /* actions/vstudio/vs2010_vcxproxj.lua */ "\npremake.vstudio.vs10_helpers = { }\nlocal vs10_helpers = premake.vstudio.vs10_helpers\nfunction vs10_helpers.remove_relative_path(file)\nfile = file:gsub(\"%.%.\\\\\",'')\nfile = file:gsub(\"%.\\\\\",'')\nreturn file\nend\nfunction vs10_helpers.file_path(file)\nfile = vs10_helpers.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 vs10_helpers.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 vs10_helpers.table_of_filters(t)\nlocal filters ={}\nfor key, value in pairs(t) do\nlocal result = vs10_helpers.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 vs10_helpers.table_of_file_filters(files)\nlocal filters ={}\nfor key, valueTable in pairs(files) do\nfor _, entry in ipairs(valueTable) do\nlocal result = vs10_helpers.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\nfunction vs10_helpers.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 vs10_helpers.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 = vs10_helpers.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\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\nlocal function config_type(config)\nlocal t =\n{\nSharedLib = \"DynamicLibrary\",\nStaticLib = \"StaticLibrary\",\nConsoleApp = \"Application\",\n}\nreturn t[config.kind]\nend\nlocal function if_config_and_platform()\nreturn 'Condition=\"\\'$(Configuration)|$(Platform)'\nend\nloc" - "al function 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\nlocal function 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\nlocal function 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\nlocal function 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\nlocal function 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\nlocal function 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_l" - "ink(cfg,cfginfo)\nif cfg.flags.NoManifest then\n_p(2,'false'\n,premake.esc(cfginfo.name))\nend\nend\n_p(1,'')\nend\nlocal function 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\nlocal function 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\nlocal function 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\nlocal function 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\nlocal function resource_compile(cfg)\n_p(2,'')\npreprocessor(3,cfg)\ninclude_dirs(3,cfg)\n_p(2,'')\nend\nlocal function exceptions(cfg)\nif cfg.flags.NoExceptions then\n_p(2,'false')\nelseif cfg.flags.SEH then\n_p(2,'Async')\nend\nend\nlocal function rtti(cfg)\nif cfg.flags.NoRTTI then\n_p(3,'false')\nend\nend\nlocal function wchar_t_buildin(cfg)\nif cfg.flags.NativeWChar then\n_p(3,'true')\nelseif cfg.flags.NoNativeWChar then\n_p(3,'false')\nend" - "\nend\nlocal function sse(cfg)\nif cfg.flags.EnableSSE then\n_p(3,'StreamingSIMDExtensions')\nelseif cfg.flags.EnableSSE2 then\n_p(3,'StreamingSIMDExtensions2')\nend\nend\nlocal function floating_point(cfg)\n if cfg.flags.FloatFast then\n_p(3,'Fast')\nelseif cfg.flags.FloatStrict then\n_p(3,'Strict')\nend\nend\nlocal function debug_info(cfg)\nif cfg.flags.Symbols and not cfg.flags.NoEditAndContinue then\n_p(3,'EditAndContinue')\nelse\n_p(3,'')\nend\nend\nlocal function 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\nlocal function compile_lang" - "uage(cfg)\nif cfg.language == \"C\" then\n_p(3,'CompileAsC')\nend\nend\nlocal function 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\nlocal function 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\nlocal function 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\nlocal function 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\nlocal function 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\nlocal function 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\nlocal function 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_s" - "ection(cfg)\nend\n_p(2,'')\nend\n \nlocal function 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\n -- \n -- {8fd826f8-3739-44e6-8cc8-997122e53b8d}\n -- \n -- \nlocal function 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\nlocal function vcxproj_files(prj)\nlocal sorted =\n{\nClCompile={},\nClInclude={},\nNone={}\n}\ncfg = premake.getconfig(prj)\nvs10_h" - "elpers.sort_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\nlocal function write_filter_includes(sorted_table)\nlocal directories = vs10_helpers.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\nlocal 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 = vs10_helpers.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, \"\\\\\"))\ne" - "nd\nend\n_p(1,'')\nend\nend\nlocal function vcxproj_filter_files(prj)\nlocal sorted =\n{\nClCompile={},\nClInclude={},\nNone={}\n}\ncfg = premake.getconfig(prj)\nvs10_helpers.sort_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\nfuncti" - "on premake.vs2010_vcxproj_filters(prj)\nvcxproj_filter_files(prj)\nend\n", + "\nfunction vs10_helpers.table_of_file_filters(files)\nlocal filters ={}\nfor key, valueTable in pairs(files) do\nfor _, entry in ipairs(valueTable) do\nlocal result = vs10_helpers.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\nfunction vs10_helpers.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 vs10_helpers.sort_input_files(files,sorted_container)\nlocal types = \n{\nh= \"ClInclude\",\nhpp= \"ClInclude\",\nhxx= \"ClInclude\",\nc= \"ClCompile\",\ncpp= \"ClCompile\",\ncxx= \"ClCompile\",\ncc= \"ClCompile\",\nrc = \"ResourceCompile\"\n}\nfor _, current_file in ipairs(files) do\nlocal translated_path = path.translate(current_file, '\\\\')\nlocal ext = vs10_helpers.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\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 vs10_helpers.config_type(config)\nlocal t =\n{\nSharedLib = \"DynamicLibrary\",\nStaticLib = \"StaticLibrary\",\nConsoleApp = \"Application\",\nWindowedApp = \"Application\"\n}\nreturn t[config.kind]\nend\nlocal function if_config_and_platform" + "()\nreturn 'Condition=\"\\'$(Configuration)|$(Platform)'\nend\nlocal function 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\nlocal function 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',vs10_helpers.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\nlocal function 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\nlocal function 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),ShoudLinkIncremen" + "tally)\nend\nend\nlocal function 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\nlocal function 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.ge" + "tbasename(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\nlocal function 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\nlocal function 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\nlocal function preprocessor(indent,cfg)\nif #cfg.defines > 0 then\n_p(indent,'%s;%%(PreprocessorDefinitions)'\n,pr" + "emake.esc(table.concat(cfg.defines, \";\")))\nelse\n_p(indent,'')\nend\nend\nlocal function 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\nlocal function resource_compile(cfg)\n_p(2,'')\npreprocessor(3,cfg)\ninclude_dirs(3,cfg)\n_p(2,'')\nend\nlocal function exceptions(cfg)\nif cfg.flags.NoExceptions then\n_p(2,'false')\nelseif cfg.flags.SEH then\n_p(2,'Async')\nend\nend\nlocal function rtti(cfg)\nif cfg.flags.NoRTTI then\n_p(3,'false')\nend\nend\nlocal function wchar_t_buildin(cfg)\nif cfg.flags.NativeWChar then\n_p(3,'true')\nelseif cfg.flags.NoNativeWChar " + "then\n_p(3,'false')\nend\nend\nlocal function sse(cfg)\nif cfg.flags.EnableSSE then\n_p(3,'StreamingSIMDExtensions')\nelseif cfg.flags.EnableSSE2 then\n_p(3,'StreamingSIMDExtensions2')\nend\nend\nlocal function floating_point(cfg)\n if cfg.flags.FloatFast then\n_p(3,'Fast')\nelseif cfg.flags.FloatStrict then\n_p(3,'Strict')\nend\nend\nlocal function debug_info(cfg)\nif cfg.flags.Symbols and not cfg.flags.NoEditAndContinue then\n_p(3,'EditAndContinue')\nelse\n_p(3,'')\nend\nend\nlocal function 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\nlocal function compile_language(cfg)\nif cfg.language == \"C\" then\n_p(3,'CompileAsC')\nend\nend\nlocal function 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\nlocal function 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\nlocal function 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\nlocal function 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\nlocal function 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\nlocal function 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\nlocal function 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 vs10_helpers.config_type(cfg) == 'Application' 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 \nlocal function 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\n -- \n -- {8fd826f8-3739-44e6-8cc8-997122e53b8d}\n -- \n -- \nlocal function 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\nlocal function vcxproj_files(prj)\nlocal sorted =\n{\nClCompile={}" + ",\nClInclude={},\nNone={},\nResourceCompile ={}\n}\ncfg = premake.getconfig(prj)\nvs10_helpers.sort_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')\nwrite_file_type_block(sorted.ResourceCompile,'ResourceCompile')\nend\nlocal function write_filter_includes(sorted_table)\nlocal directories = vs10_helpers.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\nlocal 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 = vs10_helpers.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\nlocal function vcxproj_filter_files(prj)\nlocal sorted =\n{\nClCompile={},\nClInclude={},\nNone={},\nResourceCompile ={}\n}\ncfg = premake.getconfig(prj)\nvs10_helpers.sort_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\")\nwrite_file_filter_block(sorted.ResourceCompile,\"ResourceCompile\")\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\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 fc62d6b0..fefb6473 100644 --- a/tests/actions/vstudio/test_vs2010_filters.lua +++ b/tests/actions/vstudio/test_vs2010_filters.lua @@ -351,7 +351,7 @@ test.string_contains(buffer,' Date: Wed, 28 Jul 2010 01:25:07 +0100 Subject: [PATCH 5/6] linkoptions added and refactored for all "kinds" --- src/actions/vstudio/vs2010_vcxproxj.lua | 13 ++++- .../vstudio/test_vs2010_project_kinds.lua | 48 ++++++++++++++++++- 2 files changed, 58 insertions(+), 3 deletions(-) diff --git a/src/actions/vstudio/vs2010_vcxproxj.lua b/src/actions/vstudio/vs2010_vcxproxj.lua index 78375279..4a1bfc80 100644 --- a/src/actions/vstudio/vs2010_vcxproxj.lua +++ b/src/actions/vstudio/vs2010_vcxproxj.lua @@ -438,11 +438,19 @@ local vs10_helpers = premake.vstudio.vs10_helpers _p(2,'') end end - + + local function additional_options(indent,cfg) + if #cfg.linkoptions > 0 then + _p(indent,'%s %%(AdditionalOptions)', + table.concat(premake.esc(cfg.linkoptions), " ")) + end + end + local function item_def_lib(cfg) if cfg.kind == 'StaticLib' then _p(1,'') _p(2,'$(OutDir)%s',cfg.buildtarget.name) + additional_options(2,cfg) _p(1,'') end end @@ -507,7 +515,8 @@ local vs10_helpers = premake.vstudio.vs10_helpers import_lib(cfg) _p(3,'%s', iif(cfg.platform == "x64", "MachineX64", "MachineX86")) - + + additional_options(3,cfg) else common_link_section(cfg) end diff --git a/tests/actions/vstudio/test_vs2010_project_kinds.lua b/tests/actions/vstudio/test_vs2010_project_kinds.lua index 80a3ba0e..a268da2f 100644 --- a/tests/actions/vstudio/test_vs2010_project_kinds.lua +++ b/tests/actions/vstudio/test_vs2010_project_kinds.lua @@ -157,4 +157,50 @@ shared lib missing ??? in link section when noIn local result = premake.vstudio.vs10_helpers.config_type(t) test.isequal('Application',result) end - \ No newline at end of file + + function vs10_project_kinds.linkOptions_staticLib_bufferContainsAdditionalOptionsInSideLibTag() + kind "StaticLib" + linkoptions{'/dummyOption'} + + test.string_contains(get_buffer(), + '.*%%%(AdditionalOptions%).*') + end + + function vs10_project_kinds.noLinkOptions_staticLib_bufferDoesNotContainAdditionalOptionsInSideLibTag() + kind "StaticLib" + + test.string_does_not_contain(get_buffer(), + '.*%%%(AdditionalOptions%).*') + end + + function vs10_project_kinds.linkOptions_staticLib_bufferContainsPassedOption() + kind "StaticLib" + linkoptions{'/dummyOption'} + + test.string_contains(get_buffer(), + '/dummyOption %%%(AdditionalOptions%).*') + end + + function vs10_project_kinds.linkOptions_windowedApp_bufferContainsAdditionalOptionsInSideLinkTag() + kind "WindowedApp" + linkoptions{'/dummyOption'} + + test.string_contains(get_buffer(), + '.* %%%(AdditionalOptions%).*') + end + function vs10_project_kinds.linkOptions_consoleApp_bufferContainsAdditionalOptionsInSideLinkTag() + kind "ConsoleApp" + linkoptions{'/dummyOption'} + + test.string_contains(get_buffer(), + '.* %%%(AdditionalOptions%).*') + end + + function vs10_project_kinds.linkOptions_sharedLib_bufferContainsAdditionalOptionsInSideLinkTag() + kind "SharedLib" + linkoptions{'/dummyOption'} + + test.string_contains(get_buffer(), + '.* %%%(AdditionalOptions%).*') + end + \ No newline at end of file From f5dd035ac3448afbbfa11eb781319bb96640d30e Mon Sep 17 00:00:00 2001 From: liamDevine Date: Wed, 28 Jul 2010 01:28:06 +0100 Subject: [PATCH 6/6] embedded scripts --- src/host/scripts.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/host/scripts.c b/src/host/scripts.c index 99176fab..36c2ce07 100644 --- a/src/host/scripts.c +++ b/src/host/scripts.c @@ -239,14 +239,14 @@ const char* builtin_scripts[] = { "emake.esc(table.concat(cfg.defines, \";\")))\nelse\n_p(indent,'')\nend\nend\nlocal function 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\nlocal function resource_compile(cfg)\n_p(2,'')\npreprocessor(3,cfg)\ninclude_dirs(3,cfg)\n_p(2,'')\nend\nlocal function exceptions(cfg)\nif cfg.flags.NoExceptions then\n_p(2,'false')\nelseif cfg.flags.SEH then\n_p(2,'Async')\nend\nend\nlocal function rtti(cfg)\nif cfg.flags.NoRTTI then\n_p(3,'false')\nend\nend\nlocal function wchar_t_buildin(cfg)\nif cfg.flags.NativeWChar then\n_p(3,'true')\nelseif cfg.flags.NoNativeWChar " "then\n_p(3,'false')\nend\nend\nlocal function sse(cfg)\nif cfg.flags.EnableSSE then\n_p(3,'StreamingSIMDExtensions')\nelseif cfg.flags.EnableSSE2 then\n_p(3,'StreamingSIMDExtensions2')\nend\nend\nlocal function floating_point(cfg)\n if cfg.flags.FloatFast then\n_p(3,'Fast')\nelseif cfg.flags.FloatStrict then\n_p(3,'Strict')\nend\nend\nlocal function debug_info(cfg)\nif cfg.flags.Symbols and not cfg.flags.NoEditAndContinue then\n_p(3,'EditAndContinue')\nelse\n_p(3,'')\nend\nend\nlocal function 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\nlocal function compile_language(cfg)\nif cfg.language == \"C\" then\n_p(3,'CompileAsC')\nend\nend\nlocal function 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\nlocal function 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\nlocal function 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\nlocal function 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\nlocal function 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\nlocal function 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\nlocal function 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 vs10_helpers.config_type(cfg) == 'Application' 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 \nlocal function 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\n -- \n -- {8fd826f8-3739-44e6-8cc8-997122e53b8d}\n -- \n -- \nlocal function 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\nlocal function vcxproj_files(prj)\nlocal sorted =\n{\nClCompile={}" - ",\nClInclude={},\nNone={},\nResourceCompile ={}\n}\ncfg = premake.getconfig(prj)\nvs10_helpers.sort_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')\nwrite_file_type_block(sorted.ResourceCompile,'ResourceCompile')\nend\nlocal function write_filter_includes(sorted_table)\nlocal directories = vs10_helpers.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\nlocal 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 = vs10_helpers.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\nlocal function vcxproj_filter_files(prj)\nlocal sorted =\n{\nClCompile={},\nClInclude={},\nNone={},\nResourceCompile ={}\n}\ncfg = premake.getconfig(prj)\nvs10_helpers.sort_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\")\nwrite_file_filter_block(sorted.ResourceCompile,\"ResourceCompile\")\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\n", + "arningLevel>')\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\nlocal function 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\nlocal function additional_options(ind" + "ent,cfg)\nif #cfg.linkoptions > 0 then\n_p(indent,'%s %%(AdditionalOptions)',\ntable.concat(premake.esc(cfg.linkoptions), \" \"))\nend\nend\nlocal function item_def_lib(cfg)\nif cfg.kind == 'StaticLib' then\n_p(1,'')\n_p(2,'$(OutDir)%s',cfg.buildtarget.name)\nadditional_options(2,cfg)\n_p(1,'')\nend\nend\nlocal function 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\nlocal function 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\nlocal function 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\nlocal function 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,';',''))\ncommo" + "n_link_section(cfg)\nif vs10_helpers.config_type(cfg) == 'Application' and not cfg.flags.WinMain then\n_p(3,'mainCRTStartup')\nend\nimport_lib(cfg)\n_p(3,'%s', iif(cfg.platform == \"x64\", \"MachineX64\", \"MachineX86\"))\nadditional_options(3,cfg)\nelse\ncommon_link_section(cfg)\nend\n_p(2,'')\nend\n \nlocal function 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\n -- \n -- {8fd826f8-3739-44e6-8cc8-997122e53b8d}\n -- \n -- \nlocal function 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\nlocal function vcxproj_files(prj)\nlocal sorted =\n{\nClCompile={},\nClInclude={},\nNone={},\nResourceCompile ={}\n}\ncfg = premake.getconfig(prj)\nvs10_helpers.sort_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')\nwrite_file_type_block(sorted.ResourceCompile,'ResourceCompile')\nend\nlocal function write_filter_includes(sorted_table)\nlocal directories = vs10_helpers.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\nlocal function write_file_filter_block(file" + "s,group_type)\nif #files > 0 then\n_p(1,'')\nfor _, current_file in ipairs(files) do\nlocal path_to_file = vs10_helpers.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\nlocal function vcxproj_filter_files(prj)\nlocal sorted =\n{\nClCompile={},\nClInclude={},\nNone={},\nResourceCompile ={}\n}\ncfg = premake.getconfig(prj)\nvs10_helpers.sort_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,\"No" + "ne\")\nwrite_file_filter_block(sorted.ResourceCompile,\"ResourceCompile\")\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\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 '"