Factored out a bunch of hardcoded tabs in _p() calls

This commit is contained in:
starkos 2009-12-28 18:49:18 +00:00
parent b9e6c4315b
commit a744d46384
6 changed files with 166 additions and 166 deletions

View File

@ -10,13 +10,13 @@
_p('<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>')
_p('<CodeBlocks_project_file>')
_p('\t<FileVersion major="1" minor="6" />')
_p(1,'<FileVersion major="1" minor="6" />')
-- write project block header
_p('\t<Project>')
_p('\t\t<Option title="%s" />', premake.esc(prj.name))
_p('\t\t<Option pch_mode="2" />')
_p('\t\t<Option compiler="%s" />', _OPTIONS.cc)
_p(1,'<Project>')
_p(2,'<Option title="%s" />', premake.esc(prj.name))
_p(2,'<Option pch_mode="2" />')
_p(2,'<Option compiler="%s" />', _OPTIONS.cc)
-- build a list of supported target platforms; I don't support cross-compiling yet
local platforms = premake.filterplatforms(prj.solution, cc.platforms, "Native")
@ -27,85 +27,85 @@
end
-- write configuration blocks
_p('\t\t<Build>')
_p(2,'<Build>')
for _, platform in ipairs(platforms) do
for cfg in premake.eachconfig(prj, platform) do
_p('\t\t\t<Target title="%s">', premake.esc(cfg.longname))
_p(3,'<Target title="%s">', premake.esc(cfg.longname))
_p('\t\t\t\t<Option output="%s" prefix_auto="0" extension_auto="0" />', premake.esc(cfg.buildtarget.fullpath))
_p('\t\t\t\t<Option object_output="%s" />', premake.esc(cfg.objectsdir))
_p(4,'<Option output="%s" prefix_auto="0" extension_auto="0" />', premake.esc(cfg.buildtarget.fullpath))
_p(4,'<Option object_output="%s" />', premake.esc(cfg.objectsdir))
-- identify the type of binary
local types = { WindowedApp = 0, ConsoleApp = 1, StaticLib = 2, SharedLib = 3 }
_p('\t\t\t\t<Option type="%d" />', types[cfg.kind])
_p(4,'<Option type="%d" />', types[cfg.kind])
_p('\t\t\t\t<Option compiler="%s" />', _OPTIONS.cc)
_p(4,'<Option compiler="%s" />', _OPTIONS.cc)
if (cfg.kind == "SharedLib") then
_p('\t\t\t\t<Option createDefFile="0" />')
_p('\t\t\t\t<Option createStaticLib="%s" />', iif(cfg.flags.NoImportLib, 0, 1))
_p(4,'<Option createDefFile="0" />')
_p(4,'<Option createStaticLib="%s" />', iif(cfg.flags.NoImportLib, 0, 1))
end
-- begin compiler block --
_p('\t\t\t\t<Compiler>')
_p(4,'<Compiler>')
for _,flag in ipairs(table.join(cc.getcflags(cfg), cc.getcxxflags(cfg), cc.getdefines(cfg.defines), cfg.buildoptions)) do
_p('\t\t\t\t\t<Add option="%s" />', premake.esc(flag))
_p(5,'<Add option="%s" />', premake.esc(flag))
end
if not cfg.flags.NoPCH and cfg.pchheader then
_p('\t\t\t\t\t<Add option="-Winvalid-pch" />')
_p('\t\t\t\t\t<Add option="-include &quot;%s&quot;" />', premake.esc(cfg.pchheader))
_p(5,'<Add option="-Winvalid-pch" />')
_p(5,'<Add option="-include &quot;%s&quot;" />', premake.esc(cfg.pchheader))
end
for _,v in ipairs(cfg.includedirs) do
_p('\t\t\t\t\t<Add directory="%s" />', premake.esc(v))
_p(5,'<Add directory="%s" />', premake.esc(v))
end
_p('\t\t\t\t</Compiler>')
_p(4,'</Compiler>')
-- end compiler block --
-- begin linker block --
_p('\t\t\t\t<Linker>')
_p(4,'<Linker>')
for _,flag in ipairs(table.join(cc.getldflags(cfg), cfg.linkoptions)) do
_p('\t\t\t\t\t<Add option="%s" />', premake.esc(flag))
_p(5,'<Add option="%s" />', premake.esc(flag))
end
for _,v in ipairs(premake.getlinks(cfg, "all", "directory")) do
_p('\t\t\t\t\t<Add directory="%s" />', premake.esc(v))
_p(5,'<Add directory="%s" />', premake.esc(v))
end
for _,v in ipairs(premake.getlinks(cfg, "all", "basename")) do
_p('\t\t\t\t\t<Add library="%s" />', premake.esc(v))
_p(5,'<Add library="%s" />', premake.esc(v))
end
_p('\t\t\t\t</Linker>')
_p(4,'</Linker>')
-- end linker block --
-- begin resource compiler block --
if premake.findfile(cfg, ".rc") then
_p('\t\t\t\t<ResourceCompiler>')
_p(4,'<ResourceCompiler>')
for _,v in ipairs(cfg.includedirs) do
_p('\t\t\t\t\t<Add directory="%s" />', premake.esc(v))
_p(5,'<Add directory="%s" />', premake.esc(v))
end
for _,v in ipairs(cfg.resincludedirs) do
_p('\t\t\t\t\t<Add directory="%s" />', premake.esc(v))
_p(5,'<Add directory="%s" />', premake.esc(v))
end
_p('\t\t\t\t</ResourceCompiler>')
_p(4,'</ResourceCompiler>')
end
-- end resource compiler block --
-- begin build steps --
if #cfg.prebuildcommands > 0 or #cfg.postbuildcommands > 0 then
_p('\t\t\t\t<ExtraCommands>')
_p(4,'<ExtraCommands>')
for _,v in ipairs(cfg.prebuildcommands) do
_p('\t\t\t\t\t<Add before="%s" />', premake.esc(v))
_p(5,'<Add before="%s" />', premake.esc(v))
end
for _,v in ipairs(cfg.postbuildcommands) do
_p('\t\t\t\t\t<Add after="%s" />', premake.esc(v))
_p(5,'<Add after="%s" />', premake.esc(v))
end
_p('\t\t\t\t</ExtraCommands>')
_p(4,'</ExtraCommands>')
end
-- end build steps --
_p('\t\t\t</Target>')
_p(3,'</Target>')
end
end
_p('\t\t</Build>')
_p(2,'</Build>')
-- begin files block --
local pchheader
@ -114,24 +114,24 @@
end
for _,fname in ipairs(prj.files) do
_p('\t\t<Unit filename="%s">', premake.esc(fname))
_p(2,'<Unit filename="%s">', premake.esc(fname))
if path.isresourcefile(fname) then
_p('\t\t\t<Option compilerVar="WINDRES" />')
_p(3,'<Option compilerVar="WINDRES" />')
elseif path.iscppfile(fname) then
_p('\t\t\t<Option compilerVar="%s" />', iif(prj.language == "C", "CC", "CPP"))
_p(3,'<Option compilerVar="%s" />', iif(prj.language == "C", "CC", "CPP"))
end
if not prj.flags.NoPCH and fname == pchheader then
_p('\t\t\t<Option compilerVar="%s" />', iif(prj.language == "C", "CC", "CPP"))
_p('\t\t\t<Option compile="1" />')
_p('\t\t\t<Option weight="0" />')
_p('\t\t\t<Add option="-x c++-header" />')
_p(3,'<Option compilerVar="%s" />', iif(prj.language == "C", "CC", "CPP"))
_p(3,'<Option compile="1" />')
_p(3,'<Option weight="0" />')
_p(3,'<Add option="-x c++-header" />')
end
_p('\t\t</Unit>')
_p(2,'</Unit>')
end
-- end files block --
_p('\t\t<Extensions />')
_p('\t</Project>')
_p(2,'<Extensions />')
_p(1,'</Project>')
_p('</CodeBlocks_project_file>')
_p('')

View File

@ -7,21 +7,21 @@
function premake.codeblocks_workspace(sln)
_p('<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>')
_p('<CodeBlocks_workspace_file>')
_p('\t<Workspace title="%s">', sln.name)
_p(1,'<Workspace title="%s">', sln.name)
for prj in premake.solution.eachproject(sln) do
local fname = path.join(path.getrelative(sln.location, prj.location), prj.name)
local active = iif(prj.project == sln.projects[1], ' active="1"', '')
_p('\t\t<Project filename="%s.cbp"%s>', fname, active)
_p(2,'<Project filename="%s.cbp"%s>', fname, active)
for _,dep in ipairs(premake.getdependencies(prj)) do
_p('\t\t\t<Depends filename="%s.cbp" />', path.join(path.getrelative(sln.location, dep.location), dep.name))
_p(3,'<Depends filename="%s.cbp" />', path.join(path.getrelative(sln.location, dep.location), dep.name))
end
_p('\t\t</Project>')
_p(2,'</Project>')
end
_p('\t</Workspace>')
_p(1,'</Workspace>')
_p('</CodeBlocks_workspace_file>')
end

View File

@ -32,112 +32,112 @@
io.eol = "\r\n"
_p('<VisualStudioProject>')
_p('\t<CSHARP')
_p('\t\tProjectType = "Local"')
_p('\t\tProductVersion = "%s"', iif(_ACTION == "vs2002", "7.0.9254", "7.10.3077"))
_p('\t\tSchemaVersion = "%s"', iif(_ACTION == "vs2002", "1.0", "2.0"))
_p('\t\tProjectGuid = "{%s}"', prj.uuid)
_p('\t>')
_p(1,'<CSHARP')
_p(2,'ProjectType = "Local"')
_p(2,'ProductVersion = "%s"', iif(_ACTION == "vs2002", "7.0.9254", "7.10.3077"))
_p(2,'SchemaVersion = "%s"', iif(_ACTION == "vs2002", "1.0", "2.0"))
_p(2,'ProjectGuid = "{%s}"', prj.uuid)
_p(1,'>')
_p('\t\t<Build>')
_p(2,'<Build>')
-- Write out project-wide settings
_p('\t\t\t<Settings')
_p('\t\t\t\tApplicationIcon = ""')
_p('\t\t\t\tAssemblyKeyContainerName = ""')
_p('\t\t\t\tAssemblyName = "%s"', prj.buildtarget.basename)
_p('\t\t\t\tAssemblyOriginatorKeyFile = ""')
_p('\t\t\t\tDefaultClientScript = "JScript"')
_p('\t\t\t\tDefaultHTMLPageLayout = "Grid"')
_p('\t\t\t\tDefaultTargetSchema = "IE50"')
_p('\t\t\t\tDelaySign = "false"')
_p(3,'<Settings')
_p(4,'ApplicationIcon = ""')
_p(4,'AssemblyKeyContainerName = ""')
_p(4,'AssemblyName = "%s"', prj.buildtarget.basename)
_p(4,'AssemblyOriginatorKeyFile = ""')
_p(4,'DefaultClientScript = "JScript"')
_p(4,'DefaultHTMLPageLayout = "Grid"')
_p(4,'DefaultTargetSchema = "IE50"')
_p(4,'DelaySign = "false"')
if _ACTION == "vs2002" then
_p('\t\t\t\tNoStandardLibraries = "false"')
_p(4,'NoStandardLibraries = "false"')
end
_p('\t\t\t\tOutputType = "%s"', premake.dotnet.getkind(prj))
_p(4,'OutputType = "%s"', premake.dotnet.getkind(prj))
if _ACTION == "vs2003" then
_p('\t\t\t\tPreBuildEvent = ""')
_p('\t\t\t\tPostBuildEvent = ""')
_p(4,'PreBuildEvent = ""')
_p(4,'PostBuildEvent = ""')
end
_p('\t\t\t\tRootNamespace = "%s"', prj.buildtarget.basename)
_p(4,'RootNamespace = "%s"', prj.buildtarget.basename)
if _ACTION == "vs2003" then
_p('\t\t\t\tRunPostBuildEvent = "OnBuildSuccess"')
_p(4,'RunPostBuildEvent = "OnBuildSuccess"')
end
_p('\t\t\t\tStartupObject = ""')
_p('\t\t\t>')
_p(4,'StartupObject = ""')
_p(3,'>')
-- Write out configuration blocks
for cfg in premake.eachconfig(prj) do
_p('\t\t\t\t<Config')
_p('\t\t\t\t\tName = "%s"', premake.esc(cfg.name))
_p('\t\t\t\t\tAllowUnsafeBlocks = "%s"', iif(cfg.flags.Unsafe, "true", "false"))
_p('\t\t\t\t\tBaseAddress = "285212672"')
_p('\t\t\t\t\tCheckForOverflowUnderflow = "false"')
_p('\t\t\t\t\tConfigurationOverrideFile = ""')
_p('\t\t\t\t\tDefineConstants = "%s"', premake.esc(table.concat(cfg.defines, ";")))
_p('\t\t\t\t\tDocumentationFile = ""')
_p('\t\t\t\t\tDebugSymbols = "%s"', iif(cfg.flags.Symbols, "true", "false"))
_p('\t\t\t\t\tFileAlignment = "4096"')
_p('\t\t\t\t\tIncrementalBuild = "false"')
_p(4,'<Config')
_p(5,'Name = "%s"', premake.esc(cfg.name))
_p(5,'AllowUnsafeBlocks = "%s"', iif(cfg.flags.Unsafe, "true", "false"))
_p(5,'BaseAddress = "285212672"')
_p(5,'CheckForOverflowUnderflow = "false"')
_p(5,'ConfigurationOverrideFile = ""')
_p(5,'DefineConstants = "%s"', premake.esc(table.concat(cfg.defines, ";")))
_p(5,'DocumentationFile = ""')
_p(5,'DebugSymbols = "%s"', iif(cfg.flags.Symbols, "true", "false"))
_p(5,'FileAlignment = "4096"')
_p(5,'IncrementalBuild = "false"')
if _ACTION == "vs2003" then
_p('\t\t\t\t\tNoStdLib = "false"')
_p('\t\t\t\t\tNoWarn = ""')
_p(5,'NoStdLib = "false"')
_p(5,'NoWarn = ""')
end
_p('\t\t\t\t\tOptimize = "%s"', iif(cfg.flags.Optimize or cfg.flags.OptimizeSize or cfg.flags.OptimizeSpeed, "true", "false"))
_p('\t\t\t\t\tOutputPath = "%s"', premake.esc(cfg.buildtarget.directory))
_p('\t\t\t\t\tRegisterForComInterop = "false"')
_p('\t\t\t\t\tRemoveIntegerChecks = "false"')
_p('\t\t\t\t\tTreatWarningsAsErrors = "%s"', iif(cfg.flags.FatalWarnings, "true", "false"))
_p('\t\t\t\t\tWarningLevel = "4"')
_p('\t\t\t\t/>')
_p(5,'Optimize = "%s"', iif(cfg.flags.Optimize or cfg.flags.OptimizeSize or cfg.flags.OptimizeSpeed, "true", "false"))
_p(5,'OutputPath = "%s"', premake.esc(cfg.buildtarget.directory))
_p(5,'RegisterForComInterop = "false"')
_p(5,'RemoveIntegerChecks = "false"')
_p(5,'TreatWarningsAsErrors = "%s"', iif(cfg.flags.FatalWarnings, "true", "false"))
_p(5,'WarningLevel = "4"')
_p(4,'/>')
end
_p('\t\t\t</Settings>')
_p(3,'</Settings>')
-- List assembly references
_p('\t\t\t<References>')
_p(3,'<References>')
for _, ref in ipairs(premake.getlinks(prj, "siblings", "object")) do
_p('\t\t\t\t<Reference')
_p('\t\t\t\t\tName = "%s"', ref.buildtarget.basename)
_p('\t\t\t\t\tProject = "{%s}"', ref.uuid)
_p('\t\t\t\t\tPackage = "{%s}"', _VS.tool(ref))
_p('\t\t\t\t/>')
_p(4,'<Reference')
_p(5,'Name = "%s"', ref.buildtarget.basename)
_p(5,'Project = "{%s}"', ref.uuid)
_p(5,'Package = "{%s}"', _VS.tool(ref))
_p(4,'/>')
end
for _, linkname in ipairs(premake.getlinks(prj, "system", "fullpath")) do
_p('\t\t\t\t<Reference')
_p('\t\t\t\t\tName = "%s"', path.getbasename(linkname))
_p('\t\t\t\t\tAssemblyName = "%s"', path.getname(linkname))
_p(4,'<Reference')
_p(5,'Name = "%s"', path.getbasename(linkname))
_p(5,'AssemblyName = "%s"', path.getname(linkname))
if path.getdirectory(linkname) ~= "." then
_p('\t\t\t\t\tHintPath = "%s"', path.translate(linkname, "\\"))
_p(5,'HintPath = "%s"', path.translate(linkname, "\\"))
end
_p('\t\t\t\t/>')
_p(4,'/>')
end
_p('\t\t\t</References>')
_p(3,'</References>')
_p('\t\t</Build>')
_p(2,'</Build>')
-- List source files
_p('\t\t<Files>')
_p('\t\t\t<Include>')
_p(2,'<Files>')
_p(3,'<Include>')
for fcfg in premake.eachfile(prj) do
local action = premake.dotnet.getbuildaction(fcfg)
local fname = path.translate(premake.esc(fcfg.name), "\\")
local elements, dependency = getelements(prj, action, fcfg.name)
_p('\t\t\t\t<File')
_p('\t\t\t\t\tRelPath = "%s"', premake.esc(fname))
_p('\t\t\t\t\tBuildAction = "%s"', action)
_p(4,'<File')
_p(5,'RelPath = "%s"', premake.esc(fname))
_p(5,'BuildAction = "%s"', action)
if dependency then
_p('\t\t\t\t\tDependentUpon = "%s"', premake.esc(path.translate(dependency, "\\")))
_p(5,'DependentUpon = "%s"', premake.esc(path.translate(dependency, "\\")))
end
if elements == "SubTypeCode" then
_p('\t\t\t\t\tSubType = "Code"')
_p(5,'SubType = "Code"')
end
_p('\t\t\t\t/>')
_p(4,'/>')
end
_p('\t\t\t</Include>')
_p('\t\t</Files>')
_p(3,'</Include>')
_p(2,'</Files>')
_p('\t</CSHARP>')
_p(1,'</CSHARP>')
_p('</VisualStudioProject>')
end

View File

@ -8,43 +8,43 @@
io.eol = "\r\n"
_p('<VisualStudioProject>')
_p('\t<CSHARP>')
_p('\t\t<Build>')
_p(1,'<CSHARP>')
_p(2,'<Build>')
-- Visual Studio wants absolute paths
local refpaths = table.translate(prj.libdirs, function(v) return path.getabsolute(prj.location .. "/" .. v) end)
_p('\t\t\t<Settings ReferencePath = "%s">', path.translate(table.concat(refpaths, ";"), "\\"))
_p(3,'<Settings ReferencePath = "%s">', path.translate(table.concat(refpaths, ";"), "\\"))
for cfg in premake.eachconfig(prj) do
_p('\t\t\t\t<Config')
_p('\t\t\t\t\tName = "%s"', premake.esc(cfg.name))
_p('\t\t\t\t\tEnableASPDebugging = "false"')
_p('\t\t\t\t\tEnableASPXDebugging = "false"')
_p('\t\t\t\t\tEnableUnmanagedDebugging = "false"')
_p('\t\t\t\t\tEnableSQLServerDebugging = "false"')
_p('\t\t\t\t\tRemoteDebugEnabled = "false"')
_p('\t\t\t\t\tRemoteDebugMachine = ""')
_p('\t\t\t\t\tStartAction = "Project"')
_p('\t\t\t\t\tStartArguments = ""')
_p('\t\t\t\t\tStartPage = ""')
_p('\t\t\t\t\tStartProgram = ""')
_p('\t\t\t\t\tStartURL = ""')
_p('\t\t\t\t\tStartWorkingDirectory = ""')
_p('\t\t\t\t\tStartWithIE = "false"')
_p('\t\t\t\t/>')
_p(4,'<Config')
_p(5,'Name = "%s"', premake.esc(cfg.name))
_p(5,'EnableASPDebugging = "false"')
_p(5,'EnableASPXDebugging = "false"')
_p(5,'EnableUnmanagedDebugging = "false"')
_p(5,'EnableSQLServerDebugging = "false"')
_p(5,'RemoteDebugEnabled = "false"')
_p(5,'RemoteDebugMachine = ""')
_p(5,'StartAction = "Project"')
_p(5,'StartArguments = ""')
_p(5,'StartPage = ""')
_p(5,'StartProgram = ""')
_p(5,'StartURL = ""')
_p(5,'StartWorkingDirectory = ""')
_p(5,'StartWithIE = "false"')
_p(4,'/>')
end
_p('\t\t\t</Settings>')
_p('\t\t</Build>')
_p('\t\t<OtherProjectSettings')
_p('\t\t\tCopyProjectDestinationFolder = ""')
_p('\t\t\tCopyProjectUncPath = ""')
_p('\t\t\tCopyProjectOption = "0"')
_p('\t\t\tProjectView = "ProjectFiles"')
_p('\t\t\tProjectTrust = "0"')
_p('\t\t/>')
_p(3,'</Settings>')
_p(2,'</Build>')
_p(2,'<OtherProjectSettings')
_p(3,'CopyProjectDestinationFolder = ""')
_p(3,'CopyProjectUncPath = ""')
_p(3,'CopyProjectOption = "0"')
_p(3,'ProjectView = "ProjectFiles"')
_p(3,'ProjectTrust = "0"')
_p(2,'/>')
_p('\t</CSHARP>')
_p(1,'</CSHARP>')
_p('</VisualStudioProject>')
end

View File

@ -20,27 +20,27 @@
end
_p('Global')
_p('\tGlobalSection(SolutionConfiguration) = preSolution')
_p(1,'GlobalSection(SolutionConfiguration) = preSolution')
for i, cfgname in ipairs(sln.configurations) do
_p('\t\tConfigName.%d = %s', i - 1, cfgname)
_p(2,'ConfigName.%d = %s', i - 1, cfgname)
end
_p('\tEndGlobalSection')
_p(1,'EndGlobalSection')
_p('\tGlobalSection(ProjectDependencies) = postSolution')
_p('\tEndGlobalSection')
_p(1,'GlobalSection(ProjectDependencies) = postSolution')
_p(1,'EndGlobalSection')
_p('\tGlobalSection(ProjectConfiguration) = postSolution')
_p(1,'GlobalSection(ProjectConfiguration) = postSolution')
for prj in premake.solution.eachproject(sln) do
for _, cfgname in ipairs(sln.configurations) do
_p('\t\t{%s}.%s.ActiveCfg = %s|%s', prj.uuid, cfgname, cfgname, _VS.arch(prj))
_p('\t\t{%s}.%s.Build.0 = %s|%s', prj.uuid, cfgname, cfgname, _VS.arch(prj))
_p(2,'{%s}.%s.ActiveCfg = %s|%s', prj.uuid, cfgname, cfgname, _VS.arch(prj))
_p(2,'{%s}.%s.Build.0 = %s|%s', prj.uuid, cfgname, cfgname, _VS.arch(prj))
end
end
_p('\tEndGlobalSection')
_p('\tGlobalSection(ExtensibilityGlobals) = postSolution')
_p('\tEndGlobalSection')
_p('\tGlobalSection(ExtensibilityAddIns) = postSolution')
_p('\tEndGlobalSection')
_p(1,'EndGlobalSection')
_p(1,'GlobalSection(ExtensibilityGlobals) = postSolution')
_p(1,'EndGlobalSection')
_p(1,'GlobalSection(ExtensibilityAddIns) = postSolution')
_p(1,'EndGlobalSection')
_p('EndGlobal')
end

File diff suppressed because one or more lines are too long