Merged with latest premake-stable

This commit is contained in:
Jason Perkins 2010-12-02 06:23:23 -05:00
commit 68303c0400
9 changed files with 911 additions and 924 deletions

View File

@ -2,3 +2,5 @@ effc29c89976fad8598fc00d8d764391d7a5564d dev-0.1
effc29c89976fad8598fc00d8d764391d7a5564d dev-0.1
0000000000000000000000000000000000000000 dev-0.1
b356c6f751e085dad8d264143e9ae0dabe78423d 4.3-beta1
1dd035de5b6dba46c32decd97269ceb70dc61f4b 4.3-rc2
582630d7b7d40abb096131e822e2ea0376296a73 4.3

View File

@ -1,12 +1,12 @@
-------
4.4 (in progress)
-------
* Bug 3119793: Fixed ClCompile blocks with vs10 and PCH (Dan Dunham)
* Patch 2963313: Enable setting .NET framework version (Justen Hyde)
-------
4.3 (in progress)
4.3
-------
* CHANGED LICENSE FROM GPLv2 TO BSD
@ -33,6 +33,9 @@
* Bug 3020382: GCC PCH not working
* Bug 3016050: {"../Dir/file1.c","../../Dir/file2.c"} breaks Xcode (Stephane)
* Bug 3015312: Makefiles are not quoted correctly
* Bug 3097868: Removes relative paths from vs2010 filters (Robert Konrad)
* Bug 3095274: Pre-compiled header support missing for VS2010 target
* Bug 3100062: vs2010 Runtime library selection
-------

23
scripts/RELEASE.txt Normal file
View File

@ -0,0 +1,23 @@
PREMAKE RELEASE CHECKLIST
-------------------------
VERSION NUMBERS
4.0
4.0-beta1
4.0-rc1
4.0.1
PREP
* Make sure all tests pass on Windows and POSIX
* Update CHANGELOG.txt as needed
* Prep release announcement for forums
* Run `premake4 embed`
* Commit all changes to premake-stable
* Tag premake-stable with the version number

View File

@ -4,11 +4,11 @@
--
-- BEFORE RUNNING THIS SCRIPT:
-- * Make sure all tests pass on Windows AND Posix systems
-- * Run `premake4 embed`
-- * Update CHANGELOG.txt
-- * Run `premake4 embed`
-- * Commit all changes to premake-stable
-- * Prepare release news item
-- * Tag premake-stable with the version number
-- * Prepare release news item
--
-- RUN THE SCRIPT:
-- On each platform, run `premake4 release x.x binary`
@ -24,7 +24,6 @@
-- * Post to Twitter
-- * Send to email list
-- * Add release to Freshmeat (http://freshmeat.net/projects/premake)
-- * Increment version number in -stable and -dev, add "-dev" extension
-- * Push changes to repositories on BitBucket
--
-- Info on using Mercurial to manage releases:
@ -64,6 +63,8 @@ function dorelease()
local version = _ARGS[1]
local kind = _ARGS[2]
local pkgname = "premake-" .. version
--
-- Look for required utilities
@ -83,7 +84,14 @@ function dorelease()
--
print( "")
print("FOLLOW THE INSTRUCTIONS IN THE SCRIPT COMMENTS!")
print( "BEFORE RUNNING THIS SCRIPT you should..." )
print( "* Pass all tests on Windows AND Posix systems" )
print( "* Update CHANGELOG.txt")
print( "* Run `premake4 embed`")
print( "* Commit all changes to premake-stable" )
print( "* Tag premake-stable with the version number" )
print( "* Prepare release news item")
print( "")
print( "Press [Enter] to begin.")
io .read()
@ -104,9 +112,16 @@ function dorelease()
print("Downloading release tag...")
os.mkdir("release")
os.chdir("release")
-- hg clone -r {tag} https://bitbucket.org/premake/premake-stable premake-{version}
os.chdir("premake-" .. version)
os.rmdir(pkgname)
z = exec( "hg clone -r %s %s %s", version, hgroot, pkgname)
if z ~= 0 then
error("** Failed to download tagged sources", 0)
end
os.chdir(pkgname)
--
@ -182,7 +197,7 @@ function dorelease()
print("Creating source code package...")
os.chdir("..")
exec("zip -r9 %s-src.zip %s/*", workdir, workdir)
exec("zip -r9 %s-src.zip %s/*", pkgname, pkgname)
--
-- Create a binary package for this platform. This step requires a working
@ -193,23 +208,16 @@ function dorelease()
print("Building platform binary release...")
-- IMPORTANT: Mac binary needs to be built in Xcode to ensure 10.5
-- compatibility right now. I haven't been able to figure out the
-- right flags to make it work from a makefile yet.
--
-- In Xcode, open the inspector for the TARGET Set the architecture
-- to 32-bit universal, and the base SDK to 10.5.
exec("premake4 /platform=universal32 gmake")
exec("make config=%s", iif(os.is("macosx"), "releaseuniv32", "release"))
local fname
os.chdir("bin/release")
if os.is("windows") then
fname = string.format("%s-windows.zip", workdir)
fname = string.format("%s-windows.zip", pkgname)
exec("zip -9 %s premake4.exe", fname)
else
fname = string.format("%s-%s.tar.gz", workdir, os.get())
fname = string.format("%s-%s.tar.gz", pkgname, os.get())
exec("tar czvf %s premake4", fname)
end

View File

@ -21,6 +21,7 @@ local vs10_helpers = premake.vstudio.vs10_helpers
function vs10_helpers.list_of_directories_in_path(path)
local list={}
path = vs10_helpers.remove_relative_path(path)
if path then
for dir in string.gmatch(path,"[%w%-%_%.]+\\")do
if #list == 0 then
@ -33,25 +34,10 @@ local vs10_helpers = premake.vstudio.vs10_helpers
return list
end
function vs10_helpers.table_of_filters(t)
local filters ={}
for key, value in pairs(t) do
local result = vs10_helpers.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 vs10_helpers.table_of_file_filters(files)
local filters ={}
for key, valueTable in pairs(files) do
for _, valueTable in pairs(files) do
for _, entry in ipairs(valueTable) do
local result = vs10_helpers.list_of_directories_in_path(entry)
for __,dir in ipairs(result) do
@ -135,7 +121,7 @@ local vs10_helpers = premake.vstudio.vs10_helpers
end
local function if_config_and_platform()
return 'Condition="\'$(Configuration)|$(Platform)'
return 'Condition="\'$(Configuration)|$(Platform)\'==\'%s\'"'
end
local function optimisation(cfg)
@ -155,7 +141,7 @@ local vs10_helpers = premake.vstudio.vs10_helpers
local function config_type_block(prj)
for _, cfginfo in ipairs(prj.solution.vstudio_configs) do
local cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform)
_p(1,'<PropertyGroup '..if_config_and_platform() ..'\'==\'%s\'" Label="Configuration">'
_p(1,'<PropertyGroup '..if_config_and_platform() ..' Label="Configuration">'
, premake.esc(cfginfo.name))
_p(2,'<ConfigurationType>%s</ConfigurationType>',vs10_helpers.config_type(cfg))
_p(2,'<CharacterSet>%s</CharacterSet>',iif(cfg.flags.Unicode,"Unicode","MultiByte"))
@ -180,7 +166,7 @@ local vs10_helpers = premake.vstudio.vs10_helpers
local function import_props(prj)
for _, cfginfo in ipairs(prj.solution.vstudio_configs) do
local cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform)
_p(1,'<ImportGroup '..if_config_and_platform() ..'\'==\'%s\'" Label="PropertySheets">'
_p(1,'<ImportGroup '..if_config_and_platform() ..' Label="PropertySheets">'
,premake.esc(cfginfo.name))
_p(2,'<Import Project="$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props" Condition="exists(\'$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\')" Label="LocalAppDataPlatform" />')
_p(1,'</ImportGroup>')
@ -194,7 +180,7 @@ local vs10_helpers = premake.vstudio.vs10_helpers
ShoudLinkIncrementally = 'true'
end
_p(2,'<LinkIncremental '..if_config_and_platform() ..'\'==\'%s\'">%s</LinkIncremental>'
_p(2,'<LinkIncremental '..if_config_and_platform() ..'>%s</LinkIncremental>'
,premake.esc(cfginfo.name),ShoudLinkIncrementally)
end
end
@ -204,7 +190,7 @@ local vs10_helpers = premake.vstudio.vs10_helpers
if cfg.kind == "SharedLib" then
local shouldIgnore = "false"
if cfg.flags.NoImportLib then shouldIgnore = "true" end
_p(2,'<IgnoreImportLibrary '..if_config_and_platform() ..'\'==\'%s\'">%s</IgnoreImportLibrary>'
_p(2,'<IgnoreImportLibrary '..if_config_and_platform() ..'>%s</IgnoreImportLibrary>'
,premake.esc(cfginfo.name),shouldIgnore)
end
end
@ -216,17 +202,17 @@ local vs10_helpers = premake.vstudio.vs10_helpers
for _, cfginfo in ipairs(prj.solution.vstudio_configs) do
local cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform)
_p(2,'<OutDir '..if_config_and_platform() ..'\'==\'%s\'">%s\\</OutDir>'
_p(2,'<OutDir '..if_config_and_platform() ..'>%s\\</OutDir>'
, premake.esc(cfginfo.name),premake.esc(cfg.buildtarget.directory) )
_p(2,'<IntDir '..if_config_and_platform() ..'\'==\'%s\'">%s\\</IntDir>'
_p(2,'<IntDir '..if_config_and_platform() ..'>%s\\</IntDir>'
, premake.esc(cfginfo.name), premake.esc(cfg.objectsdir))
_p(2,'<TargetName '..if_config_and_platform() ..'\'==\'%s\'">%s</TargetName>'
_p(2,'<TargetName '..if_config_and_platform() ..'>%s</TargetName>'
,premake.esc(cfginfo.name),path.getbasename(cfg.buildtarget.name))
ignore_import_lib(cfg,cfginfo)
incremental_link(cfg,cfginfo)
if cfg.flags.NoManifest then
_p(2,'<GenerateManifest '..if_config_and_platform() ..'\'==\'%s\'">false</GenerateManifest>'
_p(2,'<GenerateManifest '..if_config_and_platform() ..'>false</GenerateManifest>'
,premake.esc(cfginfo.name))
end
end
@ -238,10 +224,10 @@ local vs10_helpers = premake.vstudio.vs10_helpers
local function runtime(cfg)
local runtime
if cfg.flags.StaticRuntime then
runtime = iif(cfg.flags.Symbols,"MultiThreadedDebug","MultiThreaded")
if premake.config.isdebugbuild(cfg) then
runtime = iif(cfg.flags.StaticRuntime,"MultiThreadedDebug", "MultiThreadedDebugDLL")
else
runtime = iif(cfg.flags.Symbols, "MultiThreadedDebugDLL", "MultiThreadedDLL")
runtime = iif(cfg.flags.StaticRuntime, "MultiThreaded", "MultiThreadedDLL")
end
return runtime
end
@ -255,24 +241,6 @@ local vs10_helpers = premake.vstudio.vs10_helpers
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
--
local function preprocessor(indent,cfg)
if #cfg.defines > 0 then
_p(indent,'<PreprocessorDefinitions>%s;%%(PreprocessorDefinitions)</PreprocessorDefinitions>'
@ -335,23 +303,31 @@ local vs10_helpers = premake.vstudio.vs10_helpers
end
end
local function debug_info(cfg)
--
-- EditAndContinue /ZI
-- ProgramDatabase /Zi
-- OldStyle C7 Compatable /Z7
--
if cfg.flags.Symbols and not cfg.flags.NoEditAndContinue then
_p(3,'<DebugInformationFormat>EditAndContinue</DebugInformationFormat>')
local debug_info = ''
if cfg.flags.Symbols then
if optimisation(cfg) ~= "Disabled" or cfg.flags.NoEditAndContinue then
debug_info = "ProgramDatabase"
elseif cfg.platform ~= "x64" then
debug_info = "EditAndContinue"
else
_p(3,'<DebugInformationFormat></DebugInformationFormat>')
debug_info = "OldStyle"
end
end
_p(3,'<DebugInformationFormat>%s</DebugInformationFormat>',debug_info)
end
local function minimal_build(cfg)
if cfg.flags.Symbols and not cfg.flags.NoMinimalRebuild then
if premake.config.isdebugbuild(cfg) and not cfg.flags.NoMinimalRebuild then
_p(3,'<MinimalRebuild>true</MinimalRebuild>')
elseif cfg.flags.Symbols then
else
_p(3,'<MinimalRebuild>false</MinimalRebuild>')
end
end
@ -487,9 +463,10 @@ local vs10_helpers = premake.vstudio.vs10_helpers
_p(3,'<EnableCOMDATFolding>true</EnableCOMDATFolding>')
end
if cfg.flags.Symbols then
_p(3,'<ProgramDataBaseFileName>$(OutDir)%s.pdb</ProgramDataBaseFileName>'
, path.getbasename(cfg.buildtarget.name))
end
end
local function item_link(cfg)
@ -527,7 +504,7 @@ local vs10_helpers = premake.vstudio.vs10_helpers
local function item_definitions(prj)
for _, cfginfo in ipairs(prj.solution.vstudio_configs) do
local cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform)
_p(1,'<ItemDefinitionGroup Condition="\'$(Configuration)|$(Platform)\'==\'%s\'">'
_p(1,'<ItemDefinitionGroup ' ..if_config_and_platform() ..'>'
,premake.esc(cfginfo.name))
vs10_clcompile(cfg)
resource_compile(cfg)
@ -560,6 +537,37 @@ local vs10_helpers = premake.vstudio.vs10_helpers
end
end
local function write_file_compile_block(files,prj,configs)
if #files > 0 then
local config_mappings = {}
for _, cfginfo in ipairs(configs) do
local cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform)
if cfg.pchheader and cfg.pchsource and not cfg.flags.NoPCH then
config_mappings[cfginfo] = path.translate(cfg.pchsource, "\\")
end
end
_p(1,'<ItemGroup>')
for _, current_file in ipairs(files) do
_p(2,'<ClCompile Include=\"%s\">', current_file)
for _, cfginfo in ipairs(configs) do
if config_mappings[cfginfo] and current_file == config_mappings[cfginfo] then
_p(3,'<PrecompiledHeader '.. if_config_and_platform() .. '>Create</PrecompiledHeader>'
,premake.esc(cfginfo.name))
--only one source file per pch
config_mappings[cfginfo] = nil
end
end
_p(2,'</ClCompile>')
end
_p(1,'</ItemGroup>')
end
end
local function vcxproj_files(prj)
local sorted =
{
@ -572,7 +580,7 @@ local vs10_helpers = premake.vstudio.vs10_helpers
cfg = premake.getconfig(prj)
vs10_helpers.sort_input_files(cfg.files,sorted)
write_file_type_block(sorted.ClInclude,"ClInclude")
write_file_type_block(sorted.ClCompile,'ClCompile')
write_file_compile_block(sorted.ClCompile,prj,prj.solution.vstudio_configs)
write_file_type_block(sorted.None,'None')
write_file_type_block(sorted.ResourceCompile,'ResourceCompile')
@ -611,6 +619,9 @@ local vs10_helpers = premake.vstudio.vs10_helpers
end
end
local tool_version_and_xmlns = 'ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"'
local xml_version_and_encoding = '<?xml version="1.0" encoding="utf-8"?>'
local function vcxproj_filter_files(prj)
local sorted =
{
@ -624,8 +635,8 @@ local vs10_helpers = premake.vstudio.vs10_helpers
vs10_helpers.sort_input_files(cfg.files,sorted)
io.eol = "\r\n"
_p('<?xml version="1.0" encoding="utf-8"?>')
_p('<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">')
_p(xml_version_and_encoding)
_p('<Project ' ..tool_version_and_xmlns ..'>')
write_filter_includes(sorted)
write_file_filter_block(sorted.ClInclude,"ClInclude")
write_file_filter_block(sorted.ClCompile,"ClCompile")
@ -634,20 +645,10 @@ local vs10_helpers = premake.vstudio.vs10_helpers
_p('</Project>')
end
--
-- <ItemGroup>
-- <ClCompile Include="SomeProjName.cpp" />
-- <ClCompile Include="stdafx.cpp">
-- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
-- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
--</ClCompile>
--</ItemGroup>
--
function premake.vs2010_vcxproj(prj)
io.eol = "\r\n"
_p('<?xml version="1.0" encoding="utf-8"?>')
_p('<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">')
_p(xml_version_and_encoding)
_p('<Project DefaultTargets="Build" ' ..tool_version_and_xmlns ..'>')
vs2010_config(prj)
vs2010_globals(prj)
@ -680,9 +681,10 @@ local vs10_helpers = premake.vstudio.vs10_helpers
_p('</Project>')
end
function premake.vs2010_vcxproj_user(prj)
_p('<?xml version="1.0" encoding="utf-8"?>')
_p('<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">')
_p(xml_version_and_encoding)
_p('<Project ' ..tool_version_and_xmlns ..'>')
_p('</Project>')
end

View File

@ -237,24 +237,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.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\",\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,'<ItemGroup Label=\"ProjectConfigurations\">')\nfor _, cfginfo in ipairs(prj.solution.vstudio_configs) do\n_p(2,'<ProjectConfiguration Include=\"%s\">', premake.esc(cfginfo.name))\n_p(3,'<Configuration>%s</Configuration>',cfginfo.buildcfg)\n_p(3,'<Platform>%s</Platform>',cfginfo.platform)\n_p(2,'</ProjectConfiguration>')\nend\n_p(1,'</ItemGroup>')\nend\nlocal function vs2010_globals(prj)\n_p(1,'<PropertyGroup Label=\"Globals\">')\n_p(2,'<ProjectGuid>{%s}</ProjectGuid>',prj.uuid)\n_p(2,'<RootNamespace>%s</RootNamespace>',prj.name)\n_p(2,'<Keyword>Win32Proj</Keyword>')\n_p(1,'</PropertyGroup>')\nend\nfunction 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,'<PropertyGroup '..if_config_and_platform() ..'\\'==\\'%s\\'\" Label=\"Configuration\">'\n, premake.esc(cfginfo.name))\n_p(2,'<ConfigurationType>%s</ConfigurationType>',vs10_helpers.config_type(cfg))\n_p(2,'<CharacterSet>%s</CharacterSet>',iif(cfg.flags.Unicode,\"Unicode\",\"MultiByte\"))\nif cfg.flags.MFC then\n_p(2,'<UseOfMfc>Dynamic</UseOfMfc>')\nend\nlocal use_debug = \"false\"\nif optimisation(cfg) == \"Disabled\" then \nuse_debug = \"true\" \nelse\n_p(2,'<W"
"holeProgramOptimization>true</WholeProgramOptimization>')\nend\n_p(2,'<UseDebugLibraries>%s</UseDebugLibraries>',use_debug)\n_p(1,'</PropertyGroup>')\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,'<ImportGroup '..if_config_and_platform() ..'\\'==\\'%s\\'\" Label=\"PropertySheets\">'\n,premake.esc(cfginfo.name))\n_p(2,'<Import Project=\"$(UserRootDir)\\\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists(\\'$(UserRootDir)\\\\Microsoft.Cpp.$(Platform).user.props\\')\" Label=\"LocalAppDataPlatform\" />')\n_p(1,'</ImportGroup>')\nend\nend\nlocal function incremental_link(cfg,cfginfo)\nif cfg.kind ~= \"StaticLib\" then\nShoudLinkIncrementally = 'false'\nif optimisation(cfg) == \"Disabled\" then\nShoudLinkIncrementally = 'true'\nend\n_p(2,'<LinkIncremental '..if_config_and_platform() ..'\\'==\\'%s\\'\">%s</LinkIncremental>'\n,premake.esc(cfginfo.name),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,'<IgnoreImportLibrary '..if_config_and_platform() ..'\\'==\\'%s\\'\">%s</IgnoreImportLibrary>'\n,premake.esc(cfginfo.name),shouldIgnore)\nend\nend\nlocal function intermediate_and_out_dirs(prj)\n_p(1,'<PropertyGroup>')\n_p(2,'<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>')\nfor _, cfginfo in ipairs(prj.solution.vstudio_configs) do\nlocal cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform)\n_p(2,'<OutDir '..if_config_and_platform() ..'\\'==\\'%s\\'\">%s\\\\</OutDir>'\n, premake.esc(cfginfo.name),premake.esc(cfg.buildtarget.directory) )\n_p(2,'<IntDir '..if_config_and_platform() ..'\\'==\\'%s\\'\">%s\\\\</IntDir>'\n, premake.esc(cfginfo.name), premake.esc(cfg.objectsdir))\n_p(2,'<TargetName '..if_config_and_platform() ..'\\'==\\'%s\\'\">%s</TargetName>'\n,premake.esc(cfginfo.name),path.ge"
"tbasename(cfg.buildtarget.name))\nignore_import_lib(cfg,cfginfo)\nincremental_link(cfg,cfginfo)\nif cfg.flags.NoManifest then\n_p(2,'<GenerateManifest '..if_config_and_platform() ..'\\'==\\'%s\\'\">false</GenerateManifest>'\n,premake.esc(cfginfo.name))\nend\nend\n_p(1,'</PropertyGroup>')\nend\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,'<PrecompiledHeader>Use</PrecompiledHeader>')\n_p(3,'<PrecompiledHeaderFile>%s</PrecompiledHeaderFile>', path.getname(cfg.pchheader))\nelse\n_p(3,'<PrecompiledHeader></PrecompiledHeader>')\nend\nend\nlocal function preprocessor(indent,cfg)\nif #cfg.defines > 0 then\n_p(indent,'<PreprocessorDefinitions>%s;%%(PreprocessorDefinitions)</PreprocessorDefinitions>'\n,pr"
"emake.esc(table.concat(cfg.defines, \";\")))\nelse\n_p(indent,'<PreprocessorDefinitions></PreprocessorDefinitions>')\nend\nend\nlocal function include_dirs(indent,cfg)\nif #cfg.includedirs > 0 then\n_p(indent,'<AdditionalIncludeDirectories>%s;%%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>'\n,premake.esc(path.translate(table.concat(cfg.includedirs, \";\"), '\\\\')))\nend\nend\nlocal function resource_compile(cfg)\n_p(2,'<ResourceCompile>')\npreprocessor(3,cfg)\ninclude_dirs(3,cfg)\n_p(2,'</ResourceCompile>')\nend\nlocal function exceptions(cfg)\nif cfg.flags.NoExceptions then\n_p(2,'<ExceptionHandling>false</ExceptionHandling>')\nelseif cfg.flags.SEH then\n_p(2,'<ExceptionHandling>Async</ExceptionHandling>')\nend\nend\nlocal function rtti(cfg)\nif cfg.flags.NoRTTI then\n_p(3,'<RuntimeTypeInfo>false</RuntimeTypeInfo>')\nend\nend\nlocal function wchar_t_buildin(cfg)\nif cfg.flags.NativeWChar then\n_p(3,'<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>')\nelseif cfg.flags.NoNativeWChar "
"then\n_p(3,'<TreatWChar_tAsBuiltInType>false</TreatWChar_tAsBuiltInType>')\nend\nend\nlocal function sse(cfg)\nif cfg.flags.EnableSSE then\n_p(3,'<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>')\nelseif cfg.flags.EnableSSE2 then\n_p(3,'<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>')\nend\nend\nlocal function floating_point(cfg)\n if cfg.flags.FloatFast then\n_p(3,'<FloatingPointModel>Fast</FloatingPointModel>')\nelseif cfg.flags.FloatStrict then\n_p(3,'<FloatingPointModel>Strict</FloatingPointModel>')\nend\nend\nlocal function debug_info(cfg)\nif cfg.flags.Symbols and not cfg.flags.NoEditAndContinue then\n_p(3,'<DebugInformationFormat>EditAndContinue</DebugInformationFormat>')\nelse\n_p(3,'<DebugInformationFormat></DebugInformationFormat>')\nend\nend\nlocal function minimal_build(cfg)\nif cfg.flags.Symbols and not cfg.flags.NoMinimalRebuild then\n_p(3,'<MinimalRebuild>true</MinimalRebuild>')\nelseif cfg.flags.Symbols then\n_p(3,'"
"<MinimalRebuild>false</MinimalRebuild>')\nend\nend\nlocal function compile_language(cfg)\nif cfg.language == \"C\" then\n_p(3,'<CompileAs>CompileAsC</CompileAs>')\nend\nend\nlocal function vs10_clcompile(cfg)\n_p(2,'<ClCompile>')\nif #cfg.buildoptions > 0 then\n_p(3,'<AdditionalOptions>%s %%(AdditionalOptions)</AdditionalOptions>',\ntable.concat(premake.esc(cfg.buildoptions), \" \"))\nend\n_p(3,'<Optimization>%s</Optimization>',optimisation(cfg))\ninclude_dirs(3,cfg)\npreprocessor(3,cfg)\nminimal_build(cfg)\nif optimisation(cfg) == \"Disabled\" then\n_p(3,'<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>')\nif cfg.flags.ExtraWarnings then\n_p(3,'<SmallerTypeCheck>true</SmallerTypeCheck>')\nend\nelse\n_p(3,'<StringPooling>true</StringPooling>')\nend\n_p(3,'<RuntimeLibrary>%s</RuntimeLibrary>', runtime(cfg))\n_p(3,'<FunctionLevelLinking>true</FunctionLevelLinking>')\nprecompiled_header(cfg)\nif cfg.flags.ExtraWarnings then\n_p(3,'<WarningLevel>Level4</WarningLevel>')\nelse\n_p(3,'<WarningLevel>Level3</W"
"arningLevel>')\nend\nif cfg.flags.FatalWarnings then\n_p(3,'<TreatWarningAsError>true</TreatWarningAsError>')\nend\nexceptions(cfg)\nrtti(cfg)\nwchar_t_buildin(cfg)\nsse(cfg)\nfloating_point(cfg)\ndebug_info(cfg)\nif cfg.flags.NoFramePointer then\n_p(3,'<OmitFramePointers>true</OmitFramePointers>')\nend\ncompile_language(cfg)\n_p(2,'</ClCompile>')\nend\nlocal function event_hooks(cfg)\nif #cfg.postbuildcommands> 0 then\n _p(2,'<PostBuildEvent>')\n_p(3,'<Command>%s</Command>',premake.esc(table.implode(cfg.postbuildcommands, \"\", \"\", \"\\r\\n\")))\n_p(2,'</PostBuildEvent>')\nend\nif #cfg.prebuildcommands> 0 then\n _p(2,'<PreBuildEvent>')\n_p(3,'<Command>%s</Command>',premake.esc(table.implode(cfg.prebuildcommands, \"\", \"\", \"\\r\\n\")))\n_p(2,'</PreBuildEvent>')\nend\nif #cfg.prelinkcommands> 0 then\n _p(2,'<PreLinkEvent>')\n_p(3,'<Command>%s</Command>',premake.esc(table.implode(cfg.prelinkcommands, \"\", \"\", \"\\r\\n\")))\n_p(2,'</PreLinkEvent>')\nend\nend\nlocal function additional_options(ind"
"ent,cfg)\nif #cfg.linkoptions > 0 then\n_p(indent,'<AdditionalOptions>%s %%(AdditionalOptions)</AdditionalOptions>',\ntable.concat(premake.esc(cfg.linkoptions), \" \"))\nend\nend\nlocal function item_def_lib(cfg)\nif cfg.kind == 'StaticLib' then\n_p(1,'<Lib>')\n_p(2,'<OutputFile>$(OutDir)%s</OutputFile>',cfg.buildtarget.name)\nadditional_options(2,cfg)\n_p(1,'</Lib>')\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,'<TargetMachine>%s</TargetMachine>', target)\nend\nlocal function import_lib(cfg)\nif cfg.kind == \"SharedLib\" then\nlocal implibname = cfg.linktarget.fullpath\n_p(3,'<ImportLibrary>%s</ImportLibrary>',iif(cfg.flags.NoImportLib, cfg.objectsdir .. \"\\\\\" .. path.getname(implibname), implibname))\nend\nend\nlocal function common_link_section(cfg)\n_p(3,'<SubSystem>%s</SubSystem>',iif(cfg.kind == \"ConsoleApp\",\"Console\", \"Windows\""
"))\nif cfg.flags.Symbols then \n_p(3,'<GenerateDebugInformation>true</GenerateDebugInformation>')\nelse\n_p(3,'<GenerateDebugInformation>false</GenerateDebugInformation>')\nend\nif optimisation(cfg) ~= \"Disabled\" then\n_p(3,'<OptimizeReferences>true</OptimizeReferences>')\n_p(3,'<EnableCOMDATFolding>true</EnableCOMDATFolding>')\nend\n_p(3,'<ProgramDataBaseFileName>$(OutDir)%s.pdb</ProgramDataBaseFileName>'\n, path.getbasename(cfg.buildtarget.name))\nend\nlocal function item_link(cfg)\n_p(2,'<Link>')\nif cfg.kind ~= 'StaticLib' then\nif #cfg.links > 0 then\n_p(3,'<AdditionalDependencies>%s;%%(AdditionalDependencies)</AdditionalDependencies>',\ntable.concat(premake.getlinks(cfg, \"all\", \"fullpath\"), \";\"))\nend\n_p(3,'<OutputFile>$(OutDir)%s</OutputFile>', cfg.buildtarget.name)\n_p(3,'<AdditionalLibraryDirectories>%s%s%%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>',\ntable.concat(premake.esc(path.translate(cfg.libdirs, '\\\\')) , \";\"),\niif(cfg.libdirs and #cfg.libdirs >0,';',''))\ncommo"
"n_link_section(cfg)\nif vs10_helpers.config_type(cfg) == 'Application' and not cfg.flags.WinMain then\n_p(3,'<EntryPointSymbol>mainCRTStartup</EntryPointSymbol>')\nend\nimport_lib(cfg)\n_p(3,'<TargetMachine>%s</TargetMachine>', iif(cfg.platform == \"x64\", \"MachineX64\", \"MachineX86\"))\nadditional_options(3,cfg)\nelse\ncommon_link_section(cfg)\nend\n_p(2,'</Link>')\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,'<ItemDefinitionGroup Condition=\"\\'$(Configuration)|$(Platform)\\'==\\'%s\\'\">'\n,premake.esc(cfginfo.name))\nvs10_clcompile(cfg)\nresource_compile(cfg)\nitem_def_lib(cfg)\nitem_link(cfg)\nevent_hooks(cfg)\n_p(1,'</ItemDefinitionGroup>')\nend\nend\n -- <ProjectReference Include=\"zlibvc.vcxproj\">\n -- <Project>{8fd826f8-3739-44e6-8cc8-997122e53b8d}</Project>\n -- </ProjectReference>\n -- </ItemGroup>\nlocal function write_file_type_"
"block(files,group_type)\nif #files > 0 then\n_p(1,'<ItemGroup>')\nfor _, current_file in ipairs(files) do\n_p(2,'<%s Include=\\\"%s\\\" />', group_type,current_file)\nend\n_p(1,'</ItemGroup>')\nend\nend\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,'<ItemGroup>')\nfor _, dir in pairs(directories) do\n_p(2,'<Filter Include=\"%s\">',dir)\n_p(3,'<UniqueIdentifier>{%s}</UniqueIdentifier>',os.uuid())\n_p(2,'</Filter>')\nend\n_p(1,'</ItemGroup>')\nend\nend\nlocal function write_file_filter_block(file"
"s,group_type)\nif #files > 0 then\n_p(1,'<ItemGroup>')\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,'<Filter>%s</Filter>',path_to_file)\n_p(2,'</%s>',group_type)\nelse\n_p(2,'<%s Include=\\\"%s\\\" />', group_type,path.translate(current_file, \"\\\\\"))\nend\nend\n_p(1,'</ItemGroup>')\nend\nend\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('<?xml version=\"1.0\" encoding=\"utf-8\"?>')\n_p('<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">')\nwrite_filter_includes(sorted)\nwrite_file_filter_block(sorted.ClInclude,\"ClInclude\")\nwrite_file_filter_block(sorted.ClCompile,\"ClCompile\")\nwrite_file_filter_block(sorted.None,\"No"
"ne\")\nwrite_file_filter_block(sorted.ResourceCompile,\"ResourceCompile\")\n_p('</Project>')\nend\n -- <ItemGroup>\n -- <ClCompile Include=\"SomeProjName.cpp\" />\n -- <ClCompile Include=\"stdafx.cpp\">\n -- <PrecompiledHeader Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">Create</PrecompiledHeader>\n -- <PrecompiledHeader Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">Create</PrecompiledHeader>\n --</ClCompile>\n --</ItemGroup>\nfunction premake.vs2010_vcxproj(prj)\nio.eol = \"\\r\\n\"\n_p('<?xml version=\"1.0\" encoding=\"utf-8\"?>')\n_p('<Project DefaultTargets=\"Build\" ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">')\nvs2010_config(prj)\nvs2010_globals(prj)\n_p(1,'<Import Project=\"$(VCTargetsPath)\\\\Microsoft.Cpp.Default.props\" />')\nconfig_type_block(prj)\n_p(1,'<Import Project=\"$(VCTargetsPath)\\\\Microsoft.Cpp.props\" />')\n_p(1,'<ImportGroup Label=\"ExtensionSettings\">')\n_p(1,'</ImportGroup>')\nimport_props(prj)\n_p"
"(1,'<PropertyGroup Label=\"UserMacros\" />')\nintermediate_and_out_dirs(prj)\nitem_definitions(prj)\nvcxproj_files(prj)\n_p(1,'<Import Project=\"$(VCTargetsPath)\\\\Microsoft.Cpp.targets\" />')\n_p(1,'<ImportGroup Label=\"ExtensionTargets\">')\n_p(1,'</ImportGroup>')\n_p('</Project>')\nend\nfunction premake.vs2010_vcxproj_user(prj)\n_p('<?xml version=\"1.0\" encoding=\"utf-8\"?>')\n_p('<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">')\n_p('</Project>')\nend\nfunction premake.vs2010_vcxproj_filters(prj)\nvcxproj_filter_files(prj)\nend\n",
"\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={}\npath = vs10_helpers.remove_relative_path(path)\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_file_filters(files)\nlocal filters ={}\nfor _, 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 t"
"able.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,'<ItemGroup Label=\"ProjectConfigurations\">')\nfor _, cfginfo in ipairs(prj.solution."
"vstudio_configs) do\n_p(2,'<ProjectConfiguration Include=\"%s\">', premake.esc(cfginfo.name))\n_p(3,'<Configuration>%s</Configuration>',cfginfo.buildcfg)\n_p(3,'<Platform>%s</Platform>',cfginfo.platform)\n_p(2,'</ProjectConfiguration>')\nend\n_p(1,'</ItemGroup>')\nend\nlocal function vs2010_globals(prj)\n_p(1,'<PropertyGroup Label=\"Globals\">')\n_p(2,'<ProjectGuid>{%s}</ProjectGuid>',prj.uuid)\n_p(2,'<RootNamespace>%s</RootNamespace>',prj.name)\n_p(2,'<Keyword>Win32Proj</Keyword>')\n_p(1,'</PropertyGroup>')\nend\nfunction 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)\\'==\\'%s\\'\"'\nend\nlocal function optimisation(cfg)\nlocal result = \"Disabled\"\nfor _, value in ipairs(cfg.flags) do\nif (value == \"Optimize\") then\nresult = \"Full\"\nelseif (value == \"Opt"
"imizeSize\") 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,'<PropertyGroup '..if_config_and_platform() ..' Label=\"Configuration\">'\n, premake.esc(cfginfo.name))\n_p(2,'<ConfigurationType>%s</ConfigurationType>',vs10_helpers.config_type(cfg))\n_p(2,'<CharacterSet>%s</CharacterSet>',iif(cfg.flags.Unicode,\"Unicode\",\"MultiByte\"))\nif cfg.flags.MFC then\n_p(2,'<UseOfMfc>Dynamic</UseOfMfc>')\nend\nlocal use_debug = \"false\"\nif optimisation(cfg) == \"Disabled\" then \nuse_debug = \"true\" \nelse\n_p(2,'<WholeProgramOptimization>true</WholeProgramOptimization>')\nend\n_p(2,'<UseDebugLibraries>%s</UseDebugLibraries>',use_debug)\n_p(1,'</PropertyGroup>')\nend\nend\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,'<ImportGroup '..if_config_and_platform() ..' Label=\"PropertySheets\">'\n,premake.esc(cfginfo.name))\n_p(2,'<Import Project=\"$(UserRootDir)\\\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists(\\'$(UserRootDir)\\\\Microsoft.Cpp.$(Platform).user.props\\')\" Label=\"LocalAppDataPlatform\" />')\n_p(1,'</ImportGroup>')\nend\nend\nlocal function incremental_link(cfg,cfginfo)\nif cfg.kind ~= \"StaticLib\" then\nShoudLinkIncrementally = 'false'\nif optimisation(cfg) == \"Disabled\" then\nShoudLinkIncrementally = 'true'\nend\n_p(2,'<LinkIncremental '..if_config_and_platform() ..'>%s</LinkIncremental>'\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,'<IgnoreImportLibrary '..if_config_and_platform() ..'>%s</IgnoreImportLibrary>'\n,pre"
"make.esc(cfginfo.name),shouldIgnore)\nend\nend\nlocal function intermediate_and_out_dirs(prj)\n_p(1,'<PropertyGroup>')\n_p(2,'<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>')\nfor _, cfginfo in ipairs(prj.solution.vstudio_configs) do\nlocal cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform)\n_p(2,'<OutDir '..if_config_and_platform() ..'>%s\\\\</OutDir>'\n, premake.esc(cfginfo.name),premake.esc(cfg.buildtarget.directory) )\n_p(2,'<IntDir '..if_config_and_platform() ..'>%s\\\\</IntDir>'\n, premake.esc(cfginfo.name), premake.esc(cfg.objectsdir))\n_p(2,'<TargetName '..if_config_and_platform() ..'>%s</TargetName>'\n,premake.esc(cfginfo.name),path.getbasename(cfg.buildtarget.name))\nignore_import_lib(cfg,cfginfo)\nincremental_link(cfg,cfginfo)\nif cfg.flags.NoManifest then\n_p(2,'<GenerateManifest '..if_config_and_platform() ..'>false</GenerateManifest>'\n,premake.esc(cfginfo.name))\nend\nend\n_p(1,'</PropertyGroup>')\nend\nlocal function runtime(cfg)\nlocal runtime\nif premake.config."
"isdebugbuild(cfg) then\nruntime = iif(cfg.flags.StaticRuntime,\"MultiThreadedDebug\", \"MultiThreadedDebugDLL\")\nelse\nruntime = iif(cfg.flags.StaticRuntime, \"MultiThreaded\", \"MultiThreadedDLL\")\nend\nreturn runtime\nend\nlocal function precompiled_header(cfg)\n if not cfg.flags.NoPCH and cfg.pchheader then\n_p(3,'<PrecompiledHeader>Use</PrecompiledHeader>')\n_p(3,'<PrecompiledHeaderFile>%s</PrecompiledHeaderFile>', path.getname(cfg.pchheader))\nelse\n_p(3,'<PrecompiledHeader></PrecompiledHeader>')\nend\nend\nlocal function preprocessor(indent,cfg)\nif #cfg.defines > 0 then\n_p(indent,'<PreprocessorDefinitions>%s;%%(PreprocessorDefinitions)</PreprocessorDefinitions>'\n,premake.esc(table.concat(cfg.defines, \";\")))\nelse\n_p(indent,'<PreprocessorDefinitions></PreprocessorDefinitions>')\nend\nend\nlocal function include_dirs(indent,cfg)\nif #cfg.includedirs > 0 then\n_p(indent,'<AdditionalIncludeDirectories>%s;%%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>'\n,premake.esc(path.translat"
"e(table.concat(cfg.includedirs, \";\"), '\\\\')))\nend\nend\nlocal function resource_compile(cfg)\n_p(2,'<ResourceCompile>')\npreprocessor(3,cfg)\ninclude_dirs(3,cfg)\n_p(2,'</ResourceCompile>')\nend\nlocal function exceptions(cfg)\nif cfg.flags.NoExceptions then\n_p(2,'<ExceptionHandling>false</ExceptionHandling>')\nelseif cfg.flags.SEH then\n_p(2,'<ExceptionHandling>Async</ExceptionHandling>')\nend\nend\nlocal function rtti(cfg)\nif cfg.flags.NoRTTI then\n_p(3,'<RuntimeTypeInfo>false</RuntimeTypeInfo>')\nend\nend\nlocal function wchar_t_buildin(cfg)\nif cfg.flags.NativeWChar then\n_p(3,'<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>')\nelseif cfg.flags.NoNativeWChar then\n_p(3,'<TreatWChar_tAsBuiltInType>false</TreatWChar_tAsBuiltInType>')\nend\nend\nlocal function sse(cfg)\nif cfg.flags.EnableSSE then\n_p(3,'<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>')\nelseif cfg.flags.EnableSSE2 then\n_p(3,'<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</Enabl"
"eEnhancedInstructionSet>')\nend\nend\nlocal function floating_point(cfg)\n if cfg.flags.FloatFast then\n_p(3,'<FloatingPointModel>Fast</FloatingPointModel>')\nelseif cfg.flags.FloatStrict then\n_p(3,'<FloatingPointModel>Strict</FloatingPointModel>')\nend\nend\nlocal function debug_info(cfg)\nlocal debug_info = ''\nif cfg.flags.Symbols then\nif optimisation(cfg) ~= \"Disabled\" or cfg.flags.NoEditAndContinue then\ndebug_info = \"ProgramDatabase\"\nelseif cfg.platform ~= \"x64\" then\ndebug_info = \"EditAndContinue\"\nelse\ndebug_info = \"OldStyle\"\nend\nend\n_p(3,'<DebugInformationFormat>%s</DebugInformationFormat>',debug_info)\nend\nlocal function minimal_build(cfg)\nif premake.config.isdebugbuild(cfg) and not cfg.flags.NoMinimalRebuild then\n_p(3,'<MinimalRebuild>true</MinimalRebuild>')\nelse\n_p(3,'<MinimalRebuild>false</MinimalRebuild>')\nend\nend\nlocal function compile_language(cfg)\nif cfg.language == \"C\" then\n_p(3,'<CompileAs>CompileAsC</CompileAs>')\nend\nend\nlocal function vs10_clcompile(cfg)"
"\n_p(2,'<ClCompile>')\nif #cfg.buildoptions > 0 then\n_p(3,'<AdditionalOptions>%s %%(AdditionalOptions)</AdditionalOptions>',\ntable.concat(premake.esc(cfg.buildoptions), \" \"))\nend\n_p(3,'<Optimization>%s</Optimization>',optimisation(cfg))\ninclude_dirs(3,cfg)\npreprocessor(3,cfg)\nminimal_build(cfg)\nif optimisation(cfg) == \"Disabled\" then\n_p(3,'<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>')\nif cfg.flags.ExtraWarnings then\n_p(3,'<SmallerTypeCheck>true</SmallerTypeCheck>')\nend\nelse\n_p(3,'<StringPooling>true</StringPooling>')\nend\n_p(3,'<RuntimeLibrary>%s</RuntimeLibrary>', runtime(cfg))\n_p(3,'<FunctionLevelLinking>true</FunctionLevelLinking>')\nprecompiled_header(cfg)\nif cfg.flags.ExtraWarnings then\n_p(3,'<WarningLevel>Level4</WarningLevel>')\nelse\n_p(3,'<WarningLevel>Level3</WarningLevel>')\nend\nif cfg.flags.FatalWarnings then\n_p(3,'<TreatWarningAsError>true</TreatWarningAsError>')\nend\nexceptions(cfg)\nrtti(cfg)\nwchar_t_buildin(cfg)\nsse(cfg)\nfloating_point(cfg)\ndebug_info("
"cfg)\nif cfg.flags.NoFramePointer then\n_p(3,'<OmitFramePointers>true</OmitFramePointers>')\nend\ncompile_language(cfg)\n_p(2,'</ClCompile>')\nend\nlocal function event_hooks(cfg)\nif #cfg.postbuildcommands> 0 then\n _p(2,'<PostBuildEvent>')\n_p(3,'<Command>%s</Command>',premake.esc(table.implode(cfg.postbuildcommands, \"\", \"\", \"\\r\\n\")))\n_p(2,'</PostBuildEvent>')\nend\nif #cfg.prebuildcommands> 0 then\n _p(2,'<PreBuildEvent>')\n_p(3,'<Command>%s</Command>',premake.esc(table.implode(cfg.prebuildcommands, \"\", \"\", \"\\r\\n\")))\n_p(2,'</PreBuildEvent>')\nend\nif #cfg.prelinkcommands> 0 then\n _p(2,'<PreLinkEvent>')\n_p(3,'<Command>%s</Command>',premake.esc(table.implode(cfg.prelinkcommands, \"\", \"\", \"\\r\\n\")))\n_p(2,'</PreLinkEvent>')\nend\nend\nlocal function additional_options(indent,cfg)\nif #cfg.linkoptions > 0 then\n_p(indent,'<AdditionalOptions>%s %%(AdditionalOptions)</AdditionalOptions>',\ntable.concat(premake.esc(cfg.linkoptions), \" \"))\nend\nend\nlocal function item_def_lib("
"cfg)\nif cfg.kind == 'StaticLib' then\n_p(1,'<Lib>')\n_p(2,'<OutputFile>$(OutDir)%s</OutputFile>',cfg.buildtarget.name)\nadditional_options(2,cfg)\n_p(1,'</Lib>')\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,'<TargetMachine>%s</TargetMachine>', target)\nend\nlocal function import_lib(cfg)\nif cfg.kind == \"SharedLib\" then\nlocal implibname = cfg.linktarget.fullpath\n_p(3,'<ImportLibrary>%s</ImportLibrary>',iif(cfg.flags.NoImportLib, cfg.objectsdir .. \"\\\\\" .. path.getname(implibname), implibname))\nend\nend\nlocal function common_link_section(cfg)\n_p(3,'<SubSystem>%s</SubSystem>',iif(cfg.kind == \"ConsoleApp\",\"Console\", \"Windows\"))\nif cfg.flags.Symbols then \n_p(3,'<GenerateDebugInformation>true</GenerateDebugInformation>')\nelse\n_p(3,'<GenerateDebugInformation>false</GenerateDebugInformation>')\nend\nif optimisation(cfg) ~= \"Disa"
"bled\" then\n_p(3,'<OptimizeReferences>true</OptimizeReferences>')\n_p(3,'<EnableCOMDATFolding>true</EnableCOMDATFolding>')\nend\nif cfg.flags.Symbols then\n_p(3,'<ProgramDataBaseFileName>$(OutDir)%s.pdb</ProgramDataBaseFileName>'\n, path.getbasename(cfg.buildtarget.name))\nend\nend\nlocal function item_link(cfg)\n_p(2,'<Link>')\nif cfg.kind ~= 'StaticLib' then\nif #cfg.links > 0 then\n_p(3,'<AdditionalDependencies>%s;%%(AdditionalDependencies)</AdditionalDependencies>',\ntable.concat(premake.getlinks(cfg, \"all\", \"fullpath\"), \";\"))\nend\n_p(3,'<OutputFile>$(OutDir)%s</OutputFile>', cfg.buildtarget.name)\n_p(3,'<AdditionalLibraryDirectories>%s%s%%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>',\ntable.concat(premake.esc(path.translate(cfg.libdirs, '\\\\')) , \";\"),\niif(cfg.libdirs and #cfg.libdirs >0,';',''))\ncommon_link_section(cfg)\nif vs10_helpers.config_type(cfg) == 'Application' and not cfg.flags.WinMain then\n_p(3,'<EntryPointSymbol>mainCRTStartup</EntryPointSymbol>')\nend\nimport_"
"lib(cfg)\n_p(3,'<TargetMachine>%s</TargetMachine>', iif(cfg.platform == \"x64\", \"MachineX64\", \"MachineX86\"))\nadditional_options(3,cfg)\nelse\ncommon_link_section(cfg)\nend\n_p(2,'</Link>')\nend\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,'<ItemDefinitionGroup ' ..if_config_and_platform() ..'>'\n,premake.esc(cfginfo.name))\nvs10_clcompile(cfg)\nresource_compile(cfg)\nitem_def_lib(cfg)\nitem_link(cfg)\nevent_hooks(cfg)\n_p(1,'</ItemDefinitionGroup>')\nend\nend\n -- <ProjectReference Include=\"zlibvc.vcxproj\">\n -- <Project>{8fd826f8-3739-44e6-8cc8-997122e53b8d}</Project>\n -- </ProjectReference>\n -- </ItemGroup>\nlocal function write_file_type_block(files,group_type)\nif #files > 0 then\n_p(1,'<ItemGroup>')\nfor _, current_file in ipairs(files) do\n_p(2,'<%s Include=\\\"%s\\\" />', group_type,current_file)\nend\n_p(1,'</ItemGroup>')\nend\nend\nloc"
"al function write_file_compile_block(files,prj,configs)\nif #files > 0 then\nlocal config_mappings = {}\nfor _, cfginfo in ipairs(configs) do\nlocal cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform)\nif cfg.pchheader and cfg.pchsource and not cfg.flags.NoPCH then\nconfig_mappings[cfginfo] = path.translate(cfg.pchsource, \"\\\\\")\nend\nend\n_p(1,'<ItemGroup>')\nfor _, current_file in ipairs(files) do\n_p(2,'<ClCompile Include=\\\"%s\\\">', current_file)\nfor _, cfginfo in ipairs(configs) do\nif config_mappings[cfginfo] and current_file == config_mappings[cfginfo] then \n_p(3,'<PrecompiledHeader '.. if_config_and_platform() .. '>Create</PrecompiledHeader>'\n,premake.esc(cfginfo.name))\nconfig_mappings[cfginfo] = nil\nend\nend\n_p(2,'</ClCompile>')\nend\n_p(1,'</ItemGroup>')\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_fil"
"e_type_block(sorted.ClInclude,\"ClInclude\")\nwrite_file_compile_block(sorted.ClCompile,prj,prj.solution.vstudio_configs)\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,'<ItemGroup>')\nfor _, dir in pairs(directories) do\n_p(2,'<Filter Include=\"%s\">',dir)\n_p(3,'<UniqueIdentifier>{%s}</UniqueIdentifier>',os.uuid())\n_p(2,'</Filter>')\nend\n_p(1,'</ItemGroup>')\nend\nend\nlocal function write_file_filter_block(files,group_type)\nif #files > 0 then\n_p(1,'<ItemGroup>')\nfor _, current_file in ipairs(files) do\nlocal path_to_file = 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,'<Filter>%s</Filter>',path_to_file)\n_p(2,'</%s>',group_type)\nelse\n_p(2,'<%s Include=\\\"%s\\\" />', group_type,path."
"translate(current_file, \"\\\\\"))\nend\nend\n_p(1,'</ItemGroup>')\nend\nend\nlocal tool_version_and_xmlns = 'ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\"'\nlocal xml_version_and_encoding = '<?xml version=\"1.0\" encoding=\"utf-8\"?>'\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(xml_version_and_encoding)\n_p('<Project ' ..tool_version_and_xmlns ..'>')\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('</Project>')\nend\nfunction premake.vs2010_vcxproj(prj)\nio.eol = \"\\r\\n\"\n_p(xml_version_and_encoding)\n_p('<Project DefaultTargets=\"Build\" ' ..tool_version_and_xmlns ..'>')\nvs"
"2010_config(prj)\nvs2010_globals(prj)\n_p(1,'<Import Project=\"$(VCTargetsPath)\\\\Microsoft.Cpp.Default.props\" />')\nconfig_type_block(prj)\n_p(1,'<Import Project=\"$(VCTargetsPath)\\\\Microsoft.Cpp.props\" />')\n_p(1,'<ImportGroup Label=\"ExtensionSettings\">')\n_p(1,'</ImportGroup>')\nimport_props(prj)\n_p(1,'<PropertyGroup Label=\"UserMacros\" />')\nintermediate_and_out_dirs(prj)\nitem_definitions(prj)\nvcxproj_files(prj)\n_p(1,'<Import Project=\"$(VCTargetsPath)\\\\Microsoft.Cpp.targets\" />')\n_p(1,'<ImportGroup Label=\"ExtensionTargets\">')\n_p(1,'</ImportGroup>')\n_p('</Project>')\nend\nfunction premake.vs2010_vcxproj_user(prj)\n_p(xml_version_and_encoding)\n_p('<Project ' ..tool_version_and_xmlns ..'>')\n_p('</Project>')\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 '"

View File

@ -95,11 +95,6 @@
test.isequal("foo",result)
end
function vs10_filters.listOfDirectories_passedNil_returnsIsEmpty()
local result = vs10_helpers.list_of_directories_in_path(nil)
test.isequal(0,#result)
end
function vs10_filters.listOfDirectories_oneDirectory_returnsSizeIsOne()
local result = vs10_helpers.list_of_directories_in_path("foo\\bar.h")
test.isequal(1,#result)
@ -120,105 +115,11 @@
test.isequal("foo\\bar",result[2])
end
function vs10_filters.tableOfFilters_emptyTable_returnsEmptyTable()
t = {}
local result = vs10_helpers.table_of_filters(t)
function vs10_filters.listOfDirectories_dotSlash_returnsIsEmpty()
local result = vs10_helpers.list_of_directories_in_path(".\\bar.h")
test.isequal(0,#result)
end
function vs10_filters.tableOfFilters_tableHasFilesYetNoDirectories_returnSizeIsZero()
t =
{
'foo.h'
}
local result = vs10_helpers.table_of_filters(t)
test.isequal(0,#result)
end
function vs10_filters.tableOfFilters_tableHasOneDirectory_returnSizeIsOne()
t =
{
'bar\\foo.h'
}
local result = vs10_helpers.table_of_filters(t)
test.isequal(1,#result)
end
function vs10_filters.tableOfFilters_tableHasTwoDirectories_returnSizeIsOne()
t =
{
'bar\\foo.h',
'baz\\foo.h'
}
local result = vs10_helpers.table_of_filters(t)
test.isequal(2,#result)
end
function vs10_filters.tableOfFilters_tableHasTwoDirectories_firstEntryIsBar()
t =
{
'bar\\foo.h',
'baz\\foo.h'
}
local result = vs10_helpers.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 = vs10_helpers.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 = vs10_helpers.table_of_filters(t)
test.isequal(1,#result)
end
function vs10_filters.tableOfFilters_tableEntryHasTwoDirectories_returnSizeIsTwo()
t =
{
'bar\\baz\\foo.h'
}
local result = vs10_helpers.table_of_filters(t)
test.isequal(2,#result)
end
function vs10_filters.tableOfFilters_tableEntryHasTwoDirectories_firstEntryIsBarSlashBar()
t =
{
'bar\\baz\\foo.h'
}
local result = vs10_helpers.table_of_filters(t)
test.isequal('bar',result[1])
end
function vs10_filters.tableOfFilters_tableEntryHasTwoDirectories_secondEntryIsBarSlashBaz()
t =
{
'bar\\baz\\foo.h'
}
local result = vs10_helpers.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 = vs10_helpers.table_of_filters(t)
test.isequal(3,#result)
end
function vs10_filters.tableOfFileFilters_returnSizeIsTwo()
local t =
{
@ -360,15 +261,6 @@
test.string_contains(buffer,'<None')
end
function vs10_filters.tableOfFileFilters_filterContainsDots_bufferContainsTheEntry()
t =
{
'bar\\baz\\foo.bar.h'
}
local result = vs10_helpers.table_of_filters(t)
test.isequal(2,#result)
end
function vs10_filters.tableOfFileFilters_filterContainsDots_resultsLengthIsThree()
t =
{

View File

@ -3,12 +3,6 @@ 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"
@ -28,7 +22,7 @@ local function get_buffer()
premake.buildconfigs()
sln.vstudio_configs = premake.vstudio_buildconfigs(sln)
premake.vs2010_vcxproj(prj)
buffer = io.endcapture()
local buffer = io.endcapture()
return buffer
end
@ -36,82 +30,82 @@ end
function vs10_flags.sseSet()
flags {"EnableSSE"}
buffer = get_buffer()
local buffer = get_buffer()
test.string_contains(buffer,'<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>')
end
function vs10_flags.sse2Set()
flags {"EnableSSE2"}
buffer = get_buffer()
local buffer = get_buffer()
test.string_contains(buffer,'<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>')
end
function vs10_flags.extraWarningNotSet_warningLevelIsThree()
buffer = get_buffer()
local buffer = get_buffer()
test.string_contains(buffer,'<WarningLevel>Level3</WarningLevel>')
end
function vs10_flags.extraWarning_warningLevelIsFour()
flags {"ExtraWarnings"}
buffer = get_buffer()
local buffer = get_buffer()
test.string_contains(buffer,'<WarningLevel>Level4</WarningLevel>')
end
function vs10_flags.extraWarning_treatWarningsAsError_setToTrue()
flags {"FatalWarnings"}
buffer = get_buffer()
local buffer = get_buffer()
test.string_contains(buffer,'<TreatWarningAsError>true</TreatWarningAsError>')
end
function vs10_flags.floatFast_floatingPointModel_setToFast()
flags {"FloatFast"}
buffer = get_buffer()
local buffer = get_buffer()
test.string_contains(buffer,'<FloatingPointModel>Fast</FloatingPointModel>')
end
function vs10_flags.floatStrict_floatingPointModel_setToStrict()
flags {"FloatStrict"}
buffer = get_buffer()
local buffer = get_buffer()
test.string_contains(buffer,'<FloatingPointModel>Strict</FloatingPointModel>')
end
function vs10_flags.nativeWideChar_TreatWChar_tAsBuiltInType_setToTrue()
flags {"NativeWChar"}
buffer = get_buffer()
local buffer = get_buffer()
test.string_contains(buffer,'<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>')
end
function vs10_flags.nativeWideChar_TreatWChar_tAsBuiltInType_setToFalse()
flags {"NoNativeWChar"}
buffer = get_buffer()
local buffer = get_buffer()
test.string_contains(buffer,'<TreatWChar_tAsBuiltInType>false</TreatWChar_tAsBuiltInType>')
end
function vs10_flags.noExceptions_exceptionHandling_setToFalse()
flags {"NoExceptions"}
buffer = get_buffer()
local buffer = get_buffer()
test.string_contains(buffer,'<ExceptionHandling>false</ExceptionHandling>')
end
function vs10_flags.structuredExceptions_exceptionHandling_setToAsync()
flags {"SEH"}
buffer = get_buffer()
local buffer = get_buffer()
test.string_contains(buffer,'<ExceptionHandling>Async</ExceptionHandling>')
end
function vs10_flags.noFramePointer_omitFramePointers_setToTrue()
flags {"NoFramePointer"}
buffer = get_buffer()
local buffer = get_buffer()
test.string_contains(buffer,'<OmitFramePointers>true</OmitFramePointers>')
end
@ -119,133 +113,145 @@ end
function vs10_flags.noRTTI_runtimeTypeInfo_setToFalse()
flags {"NoRTTI"}
buffer = get_buffer()
local buffer = get_buffer()
test.string_contains(buffer,'<RuntimeTypeInfo>false</RuntimeTypeInfo>')
end
function vs10_flags.optimizeSize_optimization_setToMinSpace()
flags {"OptimizeSize"}
buffer = get_buffer()
local buffer = get_buffer()
test.string_contains(buffer,'<Optimization>MinSpace</Optimization>')
end
function vs10_flags.optimizeSpeed_optimization_setToMaxSpeed()
flags {"OptimizeSpeed"}
buffer = get_buffer()
local buffer = get_buffer()
test.string_contains(buffer,'<Optimization>MaxSpeed</Optimization>')
end
function vs10_flags.optimizeSpeed_optimization_setToMaxSpeed()
flags {"Optimize"}
buffer = get_buffer()
local buffer = get_buffer()
test.string_contains(buffer,'<Optimization>Full</Optimization>')
end
function vs10_flags.noStaticRuntime_runtimeLibrary_setToMultiThreadedDLL()
buffer = get_buffer()
test.string_contains(buffer,'<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>')
end
--[[
function vs10_flags.symbols_runtimeLibrary_setToMultiThreadedDebugDLL()
flags {"Symbols"}
buffer = get_buffer()
test.string_contains(buffer,'<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>')
end
--]]
function vs10_flags.noStaticRuntimeYetSymbols_runtimeLibrary_setToMultiThreadedDebugDLL()
flags {"Symbols"}
buffer = get_buffer()
local debug_string = "Symbols"
local release_string = "Optimize"
function vs10_flags.debugHasNoStaticRuntime_runtimeLibrary_setToMultiThreadedDebugDLL()
flags {debug_string}
local buffer = get_buffer()
test.string_contains(buffer,'<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>')
end
function vs10_flags.staticRuntime_runtimeLibrary_setToMultiThreaded()
flags {"StaticRuntime"}
buffer = get_buffer()
test.string_contains(buffer,'<RuntimeLibrary>MultiThreaded</RuntimeLibrary>')
end
function vs10_flags.staticRuntimeAndSymbols_runtimeLibrary_setToMultiThreadedDebug()
flags {"StaticRuntime","Symbols"}
buffer = get_buffer()
function vs10_flags.debugAndStaticRuntime_runtimeLibrary_setToMultiThreadedDebug()
flags {debug_string,"StaticRuntime"}
local buffer = get_buffer()
test.string_contains(buffer,'<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>')
end
function vs10_flags.releaseHasNoStaticRuntime_runtimeLibrary_setToMultiThreadedDLL()
flags {release_string}
local buffer = get_buffer()
test.string_contains(buffer,'<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>')
end
function vs10_flags.releaseAndStaticRuntime_runtimeLibrary_setToMultiThreaded()
flags {release_string,"StaticRuntime"}
local buffer = get_buffer()
test.string_contains(buffer,'<RuntimeLibrary>MultiThreaded</RuntimeLibrary>')
end
function vs10_flags.noCharacterSetDefine_characterSet_setToMultiByte()
buffer = get_buffer()
local buffer = get_buffer()
test.string_contains(buffer,'<CharacterSet>MultiByte</CharacterSet>')
end
function vs10_flags.unicode_characterSet_setToUnicode()
flags {"Unicode"}
buffer = get_buffer()
local buffer = get_buffer()
test.string_contains(buffer,'<CharacterSet>Unicode</CharacterSet>')
end
function vs10_flags.noMinimalRebuildYetNotSymbols_minimalRebuild_isNotFound()
flags {"NoMinimalRebuild"}
buffer = get_buffer()
test.string_does_not_contain(buffer,'MinimalRebuild')
end
function vs10_flags.debugAndNoMinimalRebuildAndSymbols_minimalRebuild_setToFalse()
flags {debug_string,"NoMinimalRebuild"}
function vs10_flags.noMinimalRebuildAndSymbols_minimalRebuild_setToFalse()
flags {"NoMinimalRebuild","Symbols"}
buffer = get_buffer()
local buffer = get_buffer()
test.string_contains(buffer,'<MinimalRebuild>false</MinimalRebuild>')
end
function vs10_flags.symbolsSetYetNotMinimalRebuild_minimalRebuild_setToTrue()
flags {"Symbols"}
function vs10_flags.debugYetNotMinimalRebuild_minimalRebuild_setToTrue()
flags {debug_string}
buffer = get_buffer()
local buffer = get_buffer()
test.string_contains(buffer,'<MinimalRebuild>true</MinimalRebuild>')
end
--this generates an error: invalid value 'MFC'
---[[
function vs10_flags.release_minimalRebuild_setToFalse()
flags {release_string}
local buffer = get_buffer()
test.string_contains(buffer,'<MinimalRebuild>false</MinimalRebuild>')
end
function vs10_flags.mfc_useOfMfc_setToStatic()
flags{"MFC"}
buffer = get_buffer()
local buffer = get_buffer()
test.string_contains(buffer,'<UseOfMfc>Dynamic</UseOfMfc>')
end
---]]
function vs10_flags.Symbols_DebugInformationFormat_setToEditAndContinue()
flags{"Symbols"}
buffer = get_buffer()
local buffer = get_buffer()
test.string_contains(buffer,'<DebugInformationFormat>EditAndContinue</DebugInformationFormat>')
end
function vs10_flags.symbolsAndNoEditAndContinue_DebugInformationFormat_isAnEmptyBlock()
function vs10_flags.symbolsAndNoEditAndContinue_DebugInformationFormat_setToProgramDatabase()
flags{"Symbols","NoEditAndContinue"}
buffer = get_buffer()
local buffer = get_buffer()
test.string_contains(buffer,'<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>')
end
function vs10_flags.symbolsAndRelease_DebugInformationFormat_setToProgramDatabase()
flags{"Symbols",release_string}
local buffer = get_buffer()
test.string_contains(buffer,'<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>')
end
function vs10_flags.noSymbols_DebugInformationFormat_blockIsEmpty()
local buffer = get_buffer()
test.string_contains(buffer,'<DebugInformationFormat></DebugInformationFormat>')
end
function vs10_flags.symbols_64BitBuild_DebugInformationFormat_setToOldStyle()
flags{"Symbols"}
platforms{"x64"}
local buffer = get_buffer()
test.string_contains(buffer,'<DebugInformationFormat>OldStyle</DebugInformationFormat>')
end
function vs10_flags.noManifest_GenerateManifest_setToFalse()
flags{"NoManifest"}
buffer = get_buffer()
local buffer = get_buffer()
test.string_contains(buffer,'<GenerateManifest Condition="\'%$%(Configuration%)|%$%(Platform%)\'==\'Debug|Win32\'">false</GenerateManifest>')
end
function vs10_flags.programDataBaseFile()
buffer = get_buffer()
function vs10_flags.noSymbols_bufferDoesNotContainprogramDataBaseFile()
local buffer = get_buffer()
test.string_does_not_contain(buffer,'<Link>.*<ProgramDataBaseFileName>.*</Link>')
end
function vs10_flags.symbols_bufferContainsprogramDataBaseFile()
flags{"Symbols"}
local buffer = get_buffer()
test.string_contains(buffer,'<Link>.*<ProgramDataBaseFileName>%$%(OutDir%)MyProject%.pdb</ProgramDataBaseFileName>.*</Link>')
end

View File

@ -6,6 +6,10 @@
local vs10_helpers = premake.vstudio.vs10_helpers
local sln, prj
function vs10_vcxproj.teardown()
sln = nil
prj = nil
end
function vs10_vcxproj.setup()
_ACTION = "vs2010"
@ -40,7 +44,6 @@
defines {debug_define}
links{"foo_d"}
end
local function get_buffer()
@ -370,4 +373,52 @@
test.string_contains(buffer,'<CompileAs>CompileAsC</CompileAs>')
end
local debug_config_pch_string = '<PrecompiledHeader Condition="\'%$%(Configuration%)|%$%(Platform%)\'==\'Debug|Win32\'">Create</PrecompiledHeader>'
local release_config_pch_string = debug_config_pch_string:gsub('Debug','Release')
function vs10_vcxproj.noPchFlagSet_bufferDoesNotContainPchCreate()
configuration("Debug")
flags{"NoPCH"}
local buffer = get_buffer()
test.string_does_not_contain(buffer,debug_config_pch_string)
end
function vs10_vcxproj.pchHeaderSetYetPchSourceIsNot_bufferDoesNotContainPchCreate()
configuration("Debug")
pchheader "foo/dummyHeader.h"
local buffer = get_buffer()
test.string_does_not_contain(buffer,debug_config_pch_string)
end
function vs10_vcxproj.pchHeaderAndPchSourceSet_bufferContainPchCreate()
configuration("Debug")
pchheader "foo/dummyHeader.h"
pchsource "foo/dummySource.cpp"
local buffer = get_buffer()
test.string_contains(buffer,debug_config_pch_string)
end
function vs10_vcxproj.pchHeaderAndSourceSet_yetAlsoNoPch_bufferDoesNotContainpchCreate()
configuration('Debug')
pchheader "foo/dummyHeader.h"
pchsource "foo/dummySource.cpp"
flags{"NoPCH"}
local buffer = get_buffer()
test.string_does_not_contain(buffer,debug_config_pch_string)
end
function vs10_vcxproj.pchHeaderAndPchSourceSet_debugAndRelease_matchingClCompileBlocks()
configuration("Debug")
pchheader "foo/dummyHeader.h"
pchsource "foo/dummySource.cpp"
configuration("Release")
pchheader "foo/dummyHeader.h"
pchsource "foo/dummySource.cpp"
local buffer = get_buffer()
local expected = '<ClCompile Include="foo\\dummySource.cpp">%s+'
..debug_config_pch_string ..'%s+'
..release_config_pch_string ..'%s+</ClCompile>'
test.string_contains(buffer,expected)
end