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

github.com/windirstat/premake-4.x-stable.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver Schneider <oliver@assarbad.net>2017-03-22 00:45:26 +0300
committerOliver Schneider <oliver@assarbad.net>2017-03-22 00:45:26 +0300
commitb8625c05bc96cc03d1d940aa7a7682029473f228 (patch)
treebd8befb61cd8c55ffd9ad3b55312552ada6a0786
parenta5cd805e4532da682f363e283dd6c49819173fcd (diff)
Removing trailing spaces and tabs on lines within the premake4 Lua scripts
(purely cosmetic) --HG-- branch : WDS-build
-rw-r--r--scripts/embed.lua4
-rw-r--r--src/_premake_main.lua70
-rw-r--r--src/actions/clean/_clean.lua2
-rw-r--r--src/actions/codeblocks/_codeblocks.lua14
-rw-r--r--src/actions/codeblocks/codeblocks_cbp.lua40
-rw-r--r--src/actions/codeblocks/codeblocks_workspace.lua8
-rw-r--r--src/actions/codelite/_codelite.lua14
-rw-r--r--src/actions/codelite/codelite_project.lua34
-rw-r--r--src/actions/codelite/codelite_workspace.lua6
-rw-r--r--src/actions/example/_example.lua24
-rw-r--r--src/actions/example/example_project.lua20
-rw-r--r--src/actions/example/example_solution.lua12
-rw-r--r--src/actions/make/make_csharp.lua48
-rw-r--r--src/actions/make/make_solution.lua6
-rw-r--r--src/actions/vstudio/vs2002_csproj.lua16
-rw-r--r--src/actions/vstudio/vs2002_csproj_user.lua10
-rw-r--r--src/actions/vstudio/vs2002_solution.lua7
-rw-r--r--src/actions/vstudio/vs2003_solution.lua10
-rw-r--r--src/actions/vstudio/vs2005_csproj.lua4
-rw-r--r--src/actions/vstudio/vs2005_csproj_user.lua6
-rw-r--r--src/actions/vstudio/vs200x_vcproj.lua162
-rw-r--r--src/actions/vstudio/vs200x_vcproj_user.lua22
-rw-r--r--src/actions/vstudio/vs2010_vcxproj_filters.lua14
-rw-r--r--src/actions/vstudio/vs2013.lua2
-rw-r--r--src/actions/xcode/_xcode.lua58
-rw-r--r--src/actions/xcode/xcode4_workspace.lua6
-rw-r--r--src/actions/xcode/xcode_common.lua124
-rw-r--r--src/actions/xcode/xcode_project.lua24
-rw-r--r--src/base/action.lua16
-rw-r--r--src/base/bake.lua182
-rw-r--r--src/base/cmdline.lua11
-rw-r--r--src/base/config.lua14
-rw-r--r--src/base/globals.lua59
-rw-r--r--src/base/help.lua10
-rw-r--r--src/base/io.lua16
-rw-r--r--src/base/solution.lua6
-rw-r--r--src/base/string.lua6
-rw-r--r--src/base/table.lua21
-rw-r--r--src/base/tree.lua28
-rw-r--r--src/base/validate.lua34
-rw-r--r--src/tools/dotnet.lua14
-rw-r--r--src/tools/gcc.lua4
-rw-r--r--src/tools/msc.lua2
-rw-r--r--src/tools/ow.lua42
-rw-r--r--src/tools/snc.lua50
45 files changed, 639 insertions, 643 deletions
diff --git a/scripts/embed.lua b/scripts/embed.lua
index b874149..b02adec 100644
--- a/scripts/embed.lua
+++ b/scripts/embed.lua
@@ -25,7 +25,7 @@
-- escape line feeds
s = s:gsub("\n", "\\n")
-
+
-- escape double quote marks
s = s:gsub("\"", "\\\"")
return s
@@ -88,7 +88,7 @@
fnames = fnames .. "\n" .. "\t\"@" .. fn .. "\","
writefile(out, fn, s)
end
-
+
out:write("\t0\n};\n\n");
out:write(fnames);
out:write("\n\t0\n};\n");
diff --git a/src/_premake_main.lua b/src/_premake_main.lua
index d0cef0a..0cb82b4 100644
--- a/src/_premake_main.lua
+++ b/src/_premake_main.lua
@@ -8,7 +8,7 @@
local scriptfile = "premake4.lua"
local shorthelp = "Type 'premake4 --help' for help"
local versionhelp = "premake4 (Premake Build Script Generator) %s"
-
+
_WORKING_DIR = os.getcwd()
@@ -20,53 +20,53 @@
local function injectplatform(platform)
if not platform then return true end
platform = premake.checkvalue(platform, premake.fields.platforms.allowed)
-
+
for sln in premake.solution.each() do
local platforms = sln.platforms or { }
-
+
-- an empty table is equivalent to a native build
if #platforms == 0 then
table.insert(platforms, "Native")
end
-
+
-- the solution must provide a native build in order to support this feature
if not table.contains(platforms, "Native") then
return false, sln.name .. " does not target native platform\nNative platform settings are required for the --platform feature."
end
-
+
-- add it to the end of the list, if it isn't in there already
if not table.contains(platforms, platform) then
table.insert(platforms, platform)
end
-
+
sln.platforms = platforms
end
-
+
return true
end
-
+
--
-- Script-side program entry point.
--
function _premake_main(scriptpath)
-
- -- if running off the disk (in debug mode), load everything
+
+ -- if running off the disk (in debug mode), load everything
-- listed in _manifest.lua; the list divisions make sure
-- everything gets initialized in the proper order.
-
+
if (scriptpath) then
local scripts = dofile(scriptpath .. "/_manifest.lua")
for _,v in ipairs(scripts) do
dofile(scriptpath .. "/" .. v)
end
end
-
+
-- Now that the scripts are loaded, I can use path.getabsolute() to properly
-- canonicalize the executable path.
-
+
_PREMAKE_COMMAND = path.getabsolute(_PREMAKE_COMMAND)
@@ -75,15 +75,15 @@
premake.action.set(_ACTION)
-
+
-- Seed the random number generator so actions don't have to do it themselves
-
+
math.randomseed(os.time())
-
-
+
+
-- If there is a project script available, run it to get the
-- project information, available options and actions, etc.
-
+
local fname = _OPTIONS["file"] or scriptfile
if (os.isfile(fname)) then
dofile(fname)
@@ -91,36 +91,36 @@
-- Process special options
-
+
if (_OPTIONS["version"]) then
printf(versionhelp, _PREMAKE_VERSION)
return 1
end
-
+
if (_OPTIONS["help"]) then
premake.showhelp()
return 1
end
-
-
+
+
-- If no action was specified, show a short help message
-
+
if (not _ACTION) then
print(shorthelp)
return 1
end
-
+
-- If there wasn't a project script I've got to bail now
-
+
if (not os.isfile(fname)) then
error("No Premake script ("..scriptfile..") found!", 2)
end
-
+
-- Validate the command-line arguments. This has to happen after the
-- script has run to allow for project-specific options
-
+
action = premake.action.current()
if (not action) then
error("Error: no such action '" .. _ACTION .. "'", 0)
@@ -128,28 +128,28 @@
ok, err = premake.option.validate(_OPTIONS)
if (not ok) then error("Error: " .. err, 0) end
-
+
-- Sanity check the current project setup
ok, err = premake.checktools()
if (not ok) then error("Error: " .. err, 0) end
-
-
+
+
-- If a platform was specified on the command line, inject it now
ok, err = injectplatform(_OPTIONS["platform"])
if (not ok) then error("Error: " .. err, 0) end
-
+
-- work-in-progress: build the configurations
print("Building configurations...")
premake.bake.buildconfigs()
-
+
ok, err = premake.checkprojects()
if (not ok) then error("Error: " .. err, 0) end
-
-
+
+
-- Hand over control to the action
printf("Running action '%s'...", action.trigger)
premake.action.call(action.trigger)
@@ -158,4 +158,4 @@
return 0
end
-
+
diff --git a/src/actions/clean/_clean.lua b/src/actions/clean/_clean.lua
index 0e0ead0..ca73e8b 100644
--- a/src/actions/clean/_clean.lua
+++ b/src/actions/clean/_clean.lua
@@ -56,7 +56,7 @@
end
end
end,
-
+
onproject = function(prj)
for action in premake.action.each() do
if action.oncleanproject then
diff --git a/src/actions/codeblocks/_codeblocks.lua b/src/actions/codeblocks/_codeblocks.lua
index 1d378be..114173a 100644
--- a/src/actions/codeblocks/_codeblocks.lua
+++ b/src/actions/codeblocks/_codeblocks.lua
@@ -10,27 +10,27 @@
trigger = "codeblocks",
shortname = "Code::Blocks",
description = "Generate Code::Blocks project files",
-
+
valid_kinds = { "ConsoleApp", "WindowedApp", "StaticLib", "SharedLib" },
-
+
valid_languages = { "C", "C++" },
-
+
valid_tools = {
cc = { "gcc", "ow" },
},
-
+
onsolution = function(sln)
premake.generate(sln, "%%.workspace", premake.codeblocks.workspace)
end,
-
+
onproject = function(prj)
premake.generate(prj, "%%.cbp", premake.codeblocks.cbp)
end,
-
+
oncleansolution = function(sln)
premake.clean.file(sln, "%%.workspace")
end,
-
+
oncleanproject = function(prj)
premake.clean.file(prj, "%%.cbp")
premake.clean.file(prj, "%%.depend")
diff --git a/src/actions/codeblocks/codeblocks_cbp.lua b/src/actions/codeblocks/codeblocks_cbp.lua
index 6f31e29..3abd92e 100644
--- a/src/actions/codeblocks/codeblocks_cbp.lua
+++ b/src/actions/codeblocks/codeblocks_cbp.lua
@@ -16,7 +16,7 @@
if (prj.pchheader) then
pchheader = path.getrelative(prj.location, prj.pchheader)
end
-
+
for fcfg in premake.project.eachfile(prj) do
_p(2,'<Unit filename="%s">', premake.esc(fcfg.name))
if fcfg.name ~= fcfg.vpath then
@@ -47,7 +47,7 @@
local args = ''
local sz = #cfg.debugenvs
for idx, v in ipairs(cfg.debugenvs) do
- args = args .. 'set env ' .. v
+ args = args .. 'set env ' .. v
if sz ~= idx then args = args .. '&#x0A;' end
end
_p(5,'<options additional_cmds_before="%s" />',args)
@@ -57,19 +57,19 @@
error('Sorry at this moment there is no support for debug environment variables with this debugger and codeblocks')
end
end
-
+
--
-- The main function: write out the project file.
--
-
+
function premake.codeblocks.cbp(prj)
-- alias the C/C++ compiler interface
local cc = premake.gettool(prj)
-
+
_p('<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>')
_p('<CodeBlocks_project_file>')
_p(1,'<FileVersion major="1" minor="6" />')
-
+
-- write project block header
_p(1,'<Project>')
_p(2,'<Option title="%s" />', premake.esc(prj.name))
@@ -82,20 +82,20 @@
if premake.platforms[platforms[i]].iscrosscompiler then
table.remove(platforms, i)
end
- end
-
+ end
+
-- write configuration blocks
_p(2,'<Build>')
- for _, platform in ipairs(platforms) do
+ for _, platform in ipairs(platforms) do
for cfg in premake.eachconfig(prj, platform) do
_p(3,'<Target title="%s">', premake.esc(cfg.longname))
-
+
_p(4,'<Option output="%s" prefix_auto="0" extension_auto="0" />', premake.esc(cfg.buildtarget.fullpath))
-
+
if cfg.debugdir then
_p(4,'<Option working_dir="%s" />', premake.esc(cfg.debugdir))
end
-
+
_p(4,'<Option object_output="%s" />', premake.esc(cfg.objectsdir))
-- identify the type of binary
@@ -103,7 +103,7 @@
_p(4,'<Option type="%d" />', types[cfg.kind])
_p(4,'<Option compiler="%s" />', _OPTIONS.cc)
-
+
if (cfg.kind == "SharedLib") then
_p(4,'<Option createDefFile="0" />')
_p(4,'<Option createStaticLib="%s" />', iif(cfg.flags.NoImportLib, 0, 1))
@@ -123,7 +123,7 @@
end
_p(4,'</Compiler>')
-- end compiler block --
-
+
-- begin linker block --
_p(4,'<Linker>')
for _,flag in ipairs(table.join(cc.getldflags(cfg), cfg.linkoptions)) do
@@ -137,7 +137,7 @@
end
_p(4,'</Linker>')
-- end linker block --
-
+
-- begin resource compiler block --
if premake.findfile(cfg, ".rc") then
_p(4,'<ResourceCompiler>')
@@ -150,7 +150,7 @@
_p(4,'</ResourceCompiler>')
end
-- end resource compiler block --
-
+
-- begin build steps --
if #cfg.prebuildcommands > 0 or #cfg.postbuildcommands > 0 then
_p(4,'<ExtraCommands>')
@@ -164,14 +164,14 @@
_p(4,'</ExtraCommands>')
end
-- end build steps --
-
+
_p(3,'</Target>')
end
end
_p(2,'</Build>')
-
+
codeblocks.files(prj)
-
+
_p(2,'<Extensions>')
for _, platform in ipairs(platforms) do
for cfg in premake.eachconfig(prj, platform) do
@@ -185,5 +185,5 @@
_p(1,'</Project>')
_p('</CodeBlocks_project_file>')
_p('')
-
+
end
diff --git a/src/actions/codeblocks/codeblocks_workspace.lua b/src/actions/codeblocks/codeblocks_workspace.lua
index 4a01a46..e026eb9 100644
--- a/src/actions/codeblocks/codeblocks_workspace.lua
+++ b/src/actions/codeblocks/codeblocks_workspace.lua
@@ -8,19 +8,19 @@
_p('<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>')
_p('<CodeBlocks_workspace_file>')
_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(2,'<Project filename="%s.cbp"%s>', fname, active)
for _,dep in ipairs(premake.getdependencies(prj)) do
_p(3,'<Depends filename="%s.cbp" />', path.join(path.getrelative(sln.location, dep.location), dep.name))
end
-
+
_p(2,'</Project>')
end
-
+
_p(1,'</Workspace>')
_p('</CodeBlocks_workspace_file>')
end
diff --git a/src/actions/codelite/_codelite.lua b/src/actions/codelite/_codelite.lua
index e7da871..efbe3cd 100644
--- a/src/actions/codelite/_codelite.lua
+++ b/src/actions/codelite/_codelite.lua
@@ -10,29 +10,29 @@
trigger = "codelite",
shortname = "CodeLite",
description = "Generate CodeLite project files",
-
+
valid_kinds = { "ConsoleApp", "WindowedApp", "StaticLib", "SharedLib" },
-
+
valid_languages = { "C", "C++" },
-
+
valid_tools = {
cc = { "gcc" },
},
-
+
onsolution = function(sln)
premake.generate(sln, "%%.workspace", premake.codelite.workspace)
end,
-
+
onproject = function(prj)
premake.generate(prj, "%%.project", premake.codelite.project)
end,
-
+
oncleansolution = function(sln)
premake.clean.file(sln, "%%.workspace")
premake.clean.file(sln, "%%_wsp.mk")
premake.clean.file(sln, "%%.tags")
end,
-
+
oncleanproject = function(prj)
premake.clean.file(prj, "%%.project")
premake.clean.file(prj, "%%.mk")
diff --git a/src/actions/codelite/codelite_project.lua b/src/actions/codelite/codelite_project.lua
index 0d65863..95783bb 100644
--- a/src/actions/codelite/codelite_project.lua
+++ b/src/actions/codelite/codelite_project.lua
@@ -15,7 +15,7 @@
function codelite.files(prj)
local tr = premake.project.buildsourcetree(prj)
tree.traverse(tr, {
-
+
-- folders are handled at the internal nodes
onbranchenter = function(node, depth)
_p(depth, '<VirtualDirectory Name="%s">', node.name)
@@ -29,10 +29,10 @@
onleaf = function(node, depth)
_p(depth, '<File Name="%s"/>', node.cfg.name)
end,
-
+
}, true, 1)
end
-
+
--
-- The main function: write out the project file.
@@ -40,35 +40,35 @@
function premake.codelite.project(prj)
io.indent = " "
-
+
_p('<?xml version="1.0" encoding="utf-8"?>')
_p('<CodeLite_Project Name="%s">', premake.esc(prj.name))
-- Write out the list of source code files in the project
codelite.files(prj)
- local types = {
- ConsoleApp = "Executable",
- WindowedApp = "Executable",
+ local types = {
+ ConsoleApp = "Executable",
+ WindowedApp = "Executable",
StaticLib = "Static Library",
SharedLib = "Dynamic Library",
}
_p(' <Settings Type="%s">', types[prj.kind])
-
+
-- build a list of supported target platforms; I don't support cross-compiling yet
local platforms = premake.filterplatforms(prj.solution, premake[_OPTIONS.cc].platforms, "Native")
for i = #platforms, 1, -1 do
if premake.platforms[platforms[i]].iscrosscompiler then
table.remove(platforms, i)
end
- end
+ end
for _, platform in ipairs(platforms) do
for cfg in premake.eachconfig(prj, platform) do
local name = premake.esc(cfg.longname):gsub("|","_")
local compiler = iif(cfg.language == "C", "gcc", "g++")
_p(' <Configuration Name="%s" CompilerType="gnu %s" DebuggerType="GNU gdb debugger" Type="%s">', name, compiler, types[cfg.kind])
-
+
local fname = premake.esc(cfg.buildtarget.fullpath)
local objdir = premake.esc(cfg.objectsdir)
local runcmd = cfg.buildtarget.name
@@ -76,7 +76,7 @@
local runargs = table.concat(cfg.debugargs, " ")
local pause = iif(cfg.kind == "WindowedApp", "no", "yes")
_p(' <General OutputFile="%s" IntermediateDirectory="%s" Command="./%s" CommandArguments="%s" WorkingDirectory="%s" PauseExecWhenProcTerminates="%s"/>', fname, objdir, runcmd, runargs, rundir, pause)
-
+
-- begin compiler block --
local flags = premake.esc(table.join(premake.gcc.getcflags(cfg), premake.gcc.getcxxflags(cfg), cfg.buildoptions))
_p(' <Compiler Required="yes" Options="%s">', table.concat(flags, ";"))
@@ -88,7 +88,7 @@
end
_p(' </Compiler>')
-- end compiler block --
-
+
-- begin linker block --
flags = premake.esc(table.join(premake.gcc.getldflags(cfg), cfg.linkoptions))
_p(' <Linker Required="yes" Options="%s">', table.concat(flags, ";"))
@@ -100,10 +100,10 @@
end
for _,v in ipairs(premake.getlinks(cfg, "system", "name")) do
_p(' <Library Value="%s" />', premake.esc(v))
- end
+ end
_p(' </Linker>')
-- end linker block --
-
+
-- begin resource compiler block --
if premake.findfile(cfg, ".rc") then
local defines = table.implode(table.join(cfg.defines, cfg.resdefines), "-D", ";", "")
@@ -117,7 +117,7 @@
_p(' <ResourceCompiler Required="no" Options=""/>')
end
-- end resource compiler block --
-
+
-- begin build steps --
if #cfg.prebuildcommands > 0 then
_p(' <PreBuild>')
@@ -134,7 +134,7 @@
_p(' </PostBuild>')
end
-- end build steps --
-
+
_p(' <CustomBuild Enabled="no">')
_p(' <CleanCommand></CleanCommand>')
_p(' <BuildCommand></BuildCommand>')
@@ -161,6 +161,6 @@
_p(' </Dependencies>')
end
end
-
+
_p('</CodeLite_Project>')
end
diff --git a/src/actions/codelite/codelite_workspace.lua b/src/actions/codelite/codelite_workspace.lua
index 295bb08..9fc35ec 100644
--- a/src/actions/codelite/codelite_workspace.lua
+++ b/src/actions/codelite/codelite_workspace.lua
@@ -7,21 +7,21 @@
function premake.codelite.workspace(sln)
_p('<?xml version="1.0" encoding="utf-8"?>')
_p('<CodeLite_Workspace Name="%s" Database="./%s.tags">', premake.esc(sln.name), premake.esc(sln.name))
-
+
for i,prj in ipairs(sln.projects) do
local name = premake.esc(prj.name)
local fname = path.join(path.getrelative(sln.location, prj.location), prj.name)
local active = iif(i==1, "Yes", "No")
_p(' <Project Name="%s" Path="%s.project" Active="%s" />', name, fname, active)
end
-
+
-- build a list of supported target platforms; I don't support cross-compiling yet
local platforms = premake.filterplatforms(sln, premake[_OPTIONS.cc].platforms, "Native")
for i = #platforms, 1, -1 do
if premake.platforms[platforms[i]].iscrosscompiler then
table.remove(platforms, i)
end
- end
+ end
_p(' <BuildMatrix>')
for _, platform in ipairs(platforms) do
diff --git a/src/actions/example/_example.lua b/src/actions/example/_example.lua
index 66aa94a..b05ea5e 100644
--- a/src/actions/example/_example.lua
+++ b/src/actions/example/_example.lua
@@ -5,20 +5,20 @@
premake.example = { }
local example = premake.example
-
+
-- The description of the action. Note that only the first three fields are required;
-- you can remove any of the additional fields that are not required by your action.
- newaction
+ newaction
{
- -- The trigger is what needs to be typed on the command line to cause
+ -- The trigger is what needs to be typed on the command line to cause
-- this action this run (premake4 example)
trigger = "example",
-
+
-- The short name is used when this toolset name needs to be shown to
-- the user, such as in status or error messages
shortname = "Super Studio 3000",
-
+
-- The description is shown in the help text (premake4 /help)
description = "An example action that prints simple text files",
@@ -42,22 +42,22 @@
dotnet = { "mono", "msnet", "pnet" },
},
-
+
-- This function is called during state validation. If your action has some
-- special requirements you can check them here and error if necessary.
-
-
+
+
oncheckproject = function(prj)
-- if this_project_is_no_good(prj) then
-- error("Project " .. prj.name .. " is no good", 0)
-- end
end,
-
+
-- These functions will get called for each solution and project. The function
-- premake.generate() creates a file for you in the correct place, taking into
-- account any location information specified in the script. The sequence "%%"
- -- will be replaced by the solution/project name. The last parameter is the
+ -- will be replaced by the solution/project name. The last parameter is the
-- function that will actually do the work of generating the file contents.
onsolution = function(sln)
@@ -81,7 +81,7 @@
oncleansolution = function(sln)
premake.clean.file(sln, "%%.sln.txt")
end,
-
+
oncleanproject = function(prj)
if premake.isdotnetproject(prj) then
premake.clean.file(prj, "%%.csprj.txt")
@@ -89,7 +89,7 @@
premake.clean.file(prj, "%%.cprj.txt")
end
end,
-
+
oncleantarget = function(trg)
-- 'trg' is the path and base name of the target being cleaned,
-- like 'bin/debug/MyApplication'. So you might do something like:
diff --git a/src/actions/example/example_project.lua b/src/actions/example/example_project.lua
index 3fe4cf3..da5f1e1 100644
--- a/src/actions/example/example_project.lua
+++ b/src/actions/example/example_project.lua
@@ -1,6 +1,6 @@
-- An example project generator; see _example.lua for action description
---
+--
-- The project generation function, attached to the action in _example.lua.
-- By now, premake.generate() has created the project file using the name
-- provided in _example.lua, and redirected input to this new file.
@@ -9,7 +9,7 @@
function premake.example.project(prj)
-- If necessary, set an explicit line ending sequence
-- io.eol = '\r\n'
-
+
-- Let's start with a header
_p('-- Example project file version 1.0')
_p('Name: %s', prj.name)
@@ -18,7 +18,7 @@
_p('ID: {%s}', prj.uuid)
_p('')
-
+
-- List the build configurations, and the settings for each
for cfg in premake.eachconfig(prj) do
_p('Configuration %s:', cfg.name)
@@ -42,13 +42,13 @@
end
_p(2, 'Options: %s', table.concat(cfg.buildoptions, " "))
_p('')
-
+
_p(1, 'Linking:')
_p(2, 'Library paths: %s', table.concat(cfg.libdirs, ";"))
_p(2, 'Options: %s', table.concat(cfg.linkoptions, " "))
_p(2, 'Libraries: %s', table.concat(premake.getlinks(cfg, "all", "fullpath")))
_p('')
-
+
if #cfg.prebuildcommands > 0 then
_p(1, 'Prebuild commands:')
for _, cmd in ipairs(cfg.prebuildcommands) do
@@ -56,7 +56,7 @@
end
_p('')
end
-
+
if #cfg.prelinkcommands > 0 then
_p(1, 'Prelink commands:')
for _, cmd in ipairs(cfg.prelinkcommands) do
@@ -64,7 +64,7 @@
end
_p('')
end
-
+
if #cfg.postbuildcommands > 0 then
_p(1, 'Postbuild commands:')
for _, cmd in ipairs(cfg.postbuildcommands) do
@@ -74,7 +74,7 @@
end
end
-
+
-- List out the folders and files that make up the build
local tr = premake.project.buildsourcetree(prj)
premake.tree.sort(tr)
@@ -82,10 +82,10 @@
onbranch = function(node, depth)
_p(depth, path.getname(node.name) .. "/")
end,
-
+
onleaf = function(node, depth)
_p(depth, path.getname(node.name))
end
})
-
+
end
diff --git a/src/actions/example/example_solution.lua b/src/actions/example/example_solution.lua
index 8d434f5..b93eb48 100644
--- a/src/actions/example/example_solution.lua
+++ b/src/actions/example/example_solution.lua
@@ -1,6 +1,6 @@
-- An example solution generator; see _example.lua for action description
---
+--
-- The solution generation function, attached to the action in _example.lua.
-- By now, premake.generate() has created the solution file using the name
-- provided in _example.lua, and redirected input to this new file.
@@ -9,12 +9,12 @@
function premake.example.solution(sln)
-- If necessary, set an explicit line ending sequence
-- io.eol = '\r\n'
-
+
-- Let's start with a header
_p('-- Example solution file version 1.0')
_p('Name: %s', sln.name)
_p('')
-
+
-- List the build configurations
for _, cfgname in ipairs(sln.configurations) do
@@ -22,7 +22,7 @@
end
_p('')
-
+
-- List the projects contained by the solution, with some info on each
for prj in premake.solution.eachproject(sln) do
_p('Project: %s', prj.name)
@@ -30,7 +30,7 @@
_p(1, 'Language: %s', prj.language)
_p(1, 'ID: {%s}', prj.uuid)
_p(1, 'Relative path: %s', path.getrelative(sln.location, prj.location))
-
+
-- List dependencies, if there are any
local deps = premake.getdependencies(prj)
if #deps > 0 then
@@ -42,5 +42,5 @@
_p('')
end
-
+
end
diff --git a/src/actions/make/make_csharp.lua b/src/actions/make/make_csharp.lua
index 102db6e..12dfda5 100644
--- a/src/actions/make/make_csharp.lua
+++ b/src/actions/make/make_csharp.lua
@@ -8,12 +8,12 @@
-- Given a .resx resource file, builds the path to corresponding .resource
-- file, matching the behavior and naming of Visual Studio.
--
-
+
local function getresourcefilename(cfg, fname)
if path.getextension(fname) == ".resx" then
local name = cfg.buildtarget.basename .. "."
local dir = path.getdirectory(fname)
- if dir ~= "." then
+ if dir ~= "." then
name = name .. path.translate(dir, ".") .. "."
end
return "$(OBJDIR)/" .. _MAKE.esc(name .. path.getbasename(fname)) .. ".resources"
@@ -27,7 +27,7 @@
--
-- Main function
--
-
+
function premake.make_csharp(prj)
local csc = premake.dotnet
@@ -47,12 +47,12 @@
end
end
end
-
+
-- sort the files into categories, based on their build action
local sources = {}
local embedded = { }
local copypairs = { }
-
+
for fcfg in premake.project.eachfile(prj) do
local action = csc.getbuildaction(fcfg)
if action == "Compile" then
@@ -78,29 +78,29 @@
copypairs[target] = _MAKE.esc(source)
end
end
-
+
-- end of preprocessing --
-- set up the environment
_p('# %s project makefile autogenerated by Premake', premake.action.current().shortname)
_p('')
-
+
_p('ifndef config')
_p(' config=%s', _MAKE.esc(prj.configurations[1]:lower()))
_p('endif')
_p('')
-
+
_p('ifndef verbose')
_p(' SILENT = @')
_p('endif')
_p('')
-
+
_p('ifndef CSC')
_p(' CSC=%s', csc.getcompilervar(prj))
_p('endif')
_p('')
-
+
_p('ifndef RESGEN')
_p(' RESGEN=resgen')
_p('endif')
@@ -123,14 +123,14 @@
_p('FLAGS += /t:%s %s', csc.getkind(prj):lower(), table.implode(_MAKE.esc(prj.libdirs), "/lib:", "", " "))
_p('REFERENCES += %s', table.implode(_MAKE.esc(premake.getlinks(prj, "system", "basename")), "/r:", ".dll", " "))
_p('')
-
+
-- list source files
_p('SOURCES := \\')
for _, fname in ipairs(sources) do
_p('\t%s \\', _MAKE.esc(path.translate(fname)))
end
_p('')
-
+
_p('EMBEDFILES := \\')
for _, fname in ipairs(embedded) do
_p('\t%s \\', getresourcefilename(prj, fname))
@@ -159,10 +159,10 @@
-- main build rule(s)
_p('.PHONY: clean prebuild prelink')
_p('')
-
+
_p('all: $(TARGETDIR) $(OBJDIR) prebuild $(EMBEDFILES) $(COPYFILES) prelink $(TARGET)')
_p('')
-
+
_p('$(TARGET): $(SOURCES) $(EMBEDFILES) $(DEPENDS)')
_p('\t$(SILENT) $(CSC) /nologo /out:$@ $(FLAGS) $(REFERENCES) $(SOURCES) $(patsubst %%,/resource:%%,$(EMBEDFILES))')
_p('\t$(POSTBUILDCMDS)')
@@ -172,7 +172,7 @@
-- escaping, causing issues with spaces and parenthesis
_p('$(TARGETDIR):')
premake.make_mkdirrule("$(TARGETDIR)")
-
+
_p('$(OBJDIR):')
premake.make_mkdirrule("$(OBJDIR)")
@@ -198,7 +198,7 @@
_p('prebuild:')
_p('\t$(PREBUILDCMDS)')
_p('')
-
+
_p('prelink:')
_p('\t$(PRELINKCMDS)')
_p('')
@@ -213,21 +213,21 @@
_p('endif')
_p('')
end
-
+
_p('# Copied file rules')
for target, source in pairs(copypairs) do
premake.make_copyrule(source, target)
end
_p('# Embedded file rules')
- for _, fname in ipairs(embedded) do
+ for _, fname in ipairs(embedded) do
if path.getextension(fname) == ".resx" then
_p('%s: %s', getresourcefilename(prj, fname), _MAKE.esc(fname))
_p('\t$(SILENT) $(RESGEN) $^ $@')
end
_p('')
end
-
+
end
@@ -236,35 +236,35 @@
--
function premake.gmake_cs_config(cfg, csc, cfglibs)
-
+
_p('ifneq (,$(findstring %s,$(config)))', _MAKE.esc(cfg.name:lower()))
_p(' TARGETDIR := %s', _MAKE.esc(cfg.buildtarget.directory))
_p(' OBJDIR := %s', _MAKE.esc(cfg.objectsdir))
_p(' DEPENDS := %s', table.concat(_MAKE.esc(premake.getlinks(cfg, "dependencies", "fullpath")), " "))
_p(' REFERENCES := %s', table.implode(_MAKE.esc(cfglibs[cfg]), "/r:", "", " "))
_p(' FLAGS += %s %s', table.implode(cfg.defines, "/d:", "", " "), table.concat(table.join(csc.getflags(cfg), cfg.buildoptions), " "))
-
+
_p(' define PREBUILDCMDS')
if #cfg.prebuildcommands > 0 then
_p('\t@echo Running pre-build commands')
_p('\t%s', table.implode(cfg.prebuildcommands, "", "", "\n\t"))
end
_p(' endef')
-
+
_p(' define PRELINKCMDS')
if #cfg.prelinkcommands > 0 then
_p('\t@echo Running pre-link commands')
_p('\t%s', table.implode(cfg.prelinkcommands, "", "", "\n\t"))
end
_p(' endef')
-
+
_p(' define POSTBUILDCMDS')
if #cfg.postbuildcommands > 0 then
_p('\t@echo Running post-build commands')
_p('\t%s', table.implode(cfg.postbuildcommands, "", "", "\n\t"))
end
_p(' endef')
-
+
_p('endif')
_p('')
diff --git a/src/actions/make/make_solution.lua b/src/actions/make/make_solution.lua
index 9f0fc30..4145212 100644
--- a/src/actions/make/make_solution.lua
+++ b/src/actions/make/make_solution.lua
@@ -15,7 +15,7 @@
_p('# %s solution makefile autogenerated by Premake', premake.action.current().shortname)
_p('# Type "make help" for usage help')
_p('')
-
+
-- set a default configuration
_p('ifndef config')
_p(' config=%s', _MAKE.esc(premake.getconfigname(sln.configurations[1], platforms[1], true)))
@@ -45,7 +45,7 @@
_p('\t@${MAKE} --no-print-directory -C %s -f %s clean', _MAKE.esc(path.getrelative(sln.location, prj.location)), _MAKE.esc(_MAKE.getmakefilename(prj, true)))
end
_p('')
-
+
-- help rule
_p('help:')
_p(1,'@echo "Usage: make [config=name] [target]"')
@@ -70,5 +70,5 @@
_p(1,'@echo ""')
_p(1,'@echo "For more information, see http://industriousone.com/premake/quick-start"')
-
+
end
diff --git a/src/actions/vstudio/vs2002_csproj.lua b/src/actions/vstudio/vs2002_csproj.lua
index a4ee47f..b4dd54e 100644
--- a/src/actions/vstudio/vs2002_csproj.lua
+++ b/src/actions/vstudio/vs2002_csproj.lua
@@ -8,14 +8,14 @@
local vstudio = premake.vstudio
local cs2002 = premake.vstudio.cs2002
-
+
--
-- Figure out what elements a particular file need in its item block,
-- based on its build action and any related files in the project.
---
+--
local function getelements(prj, action, fname)
-
+
if action == "Compile" and fname:endswith(".cs") then
return "SubTypeCode"
end
@@ -28,7 +28,7 @@
return "Dependency", testname
end
end
-
+
return "None"
end
@@ -76,7 +76,7 @@
_p(1,'>')
_p(2,'<Build>')
-
+
-- Write out project-wide settings
_p(3,'<Settings')
_p(4,'ApplicationIcon = ""')
@@ -102,7 +102,7 @@
_p(4,'StartupObject = ""')
_p(3,'>')
- -- Write out configuration blocks
+ -- Write out configuration blocks
for cfg in premake.eachconfig(prj) do
_p(4,'<Config')
_p(5,'Name = "%s"', premake.esc(cfg.name))
@@ -148,7 +148,7 @@
_p(4,'/>')
end
_p(3,'</References>')
-
+
_p(2,'</Build>')
-- List source files
@@ -157,7 +157,7 @@
cs2002.Files(prj)
_p(3,'</Include>')
_p(2,'</Files>')
-
+
_p(1,'</CSHARP>')
_p('</VisualStudioProject>')
diff --git a/src/actions/vstudio/vs2002_csproj_user.lua b/src/actions/vstudio/vs2002_csproj_user.lua
index fa64e03..15d79cc 100644
--- a/src/actions/vstudio/vs2002_csproj_user.lua
+++ b/src/actions/vstudio/vs2002_csproj_user.lua
@@ -12,11 +12,11 @@
_p('<VisualStudioProject>')
_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(3,'<Settings ReferencePath = "%s">', path.translate(table.concat(refpaths, ";"), "\\"))
-
+
for cfg in premake.eachconfig(prj) do
_p(4,'<Config')
_p(5,'Name = "%s"', premake.esc(cfg.name))
@@ -35,7 +35,7 @@
_p(5,'StartWithIE = "false"')
_p(4,'/>')
end
-
+
_p(3,'</Settings>')
_p(2,'</Build>')
_p(2,'<OtherProjectSettings')
@@ -45,8 +45,8 @@
_p(3,'ProjectView = "ProjectFiles"')
_p(3,'ProjectTrust = "0"')
_p(2,'/>')
-
+
_p(1,'</CSHARP>')
_p('</VisualStudioProject>')
-
+
end
diff --git a/src/actions/vstudio/vs2002_solution.lua b/src/actions/vstudio/vs2002_solution.lua
index f8845fd..acdacba 100644
--- a/src/actions/vstudio/vs2002_solution.lua
+++ b/src/actions/vstudio/vs2002_solution.lua
@@ -16,7 +16,7 @@
sln.vstudio_configs = premake.vstudio.buildconfigs(sln)
_p('Microsoft Visual Studio Solution File, Format Version 7.00')
-
+
-- Write out the list of project entries
for prj in premake.solution.eachproject(sln) do
local projpath = path.translate(path.getrelative(sln.location, vstudio.projectfile(prj)))
@@ -33,7 +33,7 @@
_p(1,'GlobalSection(ProjectDependencies) = postSolution')
_p(1,'EndGlobalSection')
-
+
_p(1,'GlobalSection(ProjectConfiguration) = postSolution')
for prj in premake.solution.eachproject(sln) do
for _, cfgname in ipairs(sln.configurations) do
@@ -46,7 +46,6 @@
_p(1,'EndGlobalSection')
_p(1,'GlobalSection(ExtensibilityAddIns) = postSolution')
_p(1,'EndGlobalSection')
-
+
_p('EndGlobal')
end
- \ No newline at end of file
diff --git a/src/actions/vstudio/vs2003_solution.lua b/src/actions/vstudio/vs2003_solution.lua
index bb5ca27..1cc9b20 100644
--- a/src/actions/vstudio/vs2003_solution.lua
+++ b/src/actions/vstudio/vs2003_solution.lua
@@ -22,7 +22,7 @@
for prj in premake.solution.eachproject(sln) do
local projpath = path.translate(path.getrelative(sln.location, vstudio.projectfile(prj)))
_p('Project("{%s}") = "%s", "%s", "{%s}"', vstudio.tool(prj), prj.name, projpath, prj.uuid)
-
+
local deps = premake.getdependencies(prj)
if #deps > 0 then
_p('\tProjectSection(ProjectDependencies) = postProject')
@@ -31,7 +31,7 @@
end
_p('\tEndProjectSection')
end
-
+
_p('EndProject')
end
@@ -41,10 +41,10 @@
_p('\t\t%s = %s', cfgname, cfgname)
end
_p('\tEndGlobalSection')
-
+
_p('\tGlobalSection(ProjectDependencies) = postSolution')
_p('\tEndGlobalSection')
-
+
_p('\tGlobalSection(ProjectConfiguration) = postSolution')
for prj in premake.solution.eachproject(sln) do
for _, cfgname in ipairs(sln.configurations) do
@@ -58,6 +58,6 @@
_p('\tEndGlobalSection')
_p('\tGlobalSection(ExtensibilityAddIns) = postSolution')
_p('\tEndGlobalSection')
-
+
_p('EndGlobal')
end
diff --git a/src/actions/vstudio/vs2005_csproj.lua b/src/actions/vstudio/vs2005_csproj.lua
index afa3710..37258e2 100644
--- a/src/actions/vstudio/vs2005_csproj.lua
+++ b/src/actions/vstudio/vs2005_csproj.lua
@@ -39,7 +39,7 @@
local testname = basename .. ".xaml"
if premake.findfile(prj, testname) then
return "SubTypeCode", testname
- end
+ end
else
-- is there a *.Designer.cs file?
local basename = fname:sub(1, -4)
@@ -68,7 +68,7 @@
end
end
end
-
+
if fname:endswith(".xaml") then
return "XamlDesigner"
end
diff --git a/src/actions/vstudio/vs2005_csproj_user.lua b/src/actions/vstudio/vs2005_csproj_user.lua
index a5801f9..8eb0a0b 100644
--- a/src/actions/vstudio/vs2005_csproj_user.lua
+++ b/src/actions/vstudio/vs2005_csproj_user.lua
@@ -9,13 +9,13 @@
function cs2005.generate_user(prj)
io.eol = "\r\n"
-
+
_p('<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">')
_p(' <PropertyGroup>')
-
+
local refpaths = table.translate(prj.libdirs, function(v) return path.getabsolute(prj.location .. "/" .. v) end)
_p(' <ReferencePath>%s</ReferencePath>', path.translate(table.concat(refpaths, ";"), "\\"))
_p(' </PropertyGroup>')
_p('</Project>')
-
+
end
diff --git a/src/actions/vstudio/vs200x_vcproj.lua b/src/actions/vstudio/vs200x_vcproj.lua
index 3ef4e8b..90b7a1e 100644
--- a/src/actions/vstudio/vs200x_vcproj.lua
+++ b/src/actions/vstudio/vs200x_vcproj.lua
@@ -91,7 +91,7 @@
if (cfg.flags.MFC) then
_p(3, 'UseOfMFC="%d"', iif(cfg.flags.StaticRuntime, 1, 2))
- end
+ end
if (cfg.flags.ATL or cfg.flags.StaticATL) then
_p(3, 'UseOfATL="%d"', iif(cfg.flags.StaticATL, 1, 2))
end
@@ -101,7 +101,7 @@
end
_p(3,'>')
end
-
+
--
-- Write out the <Files> element.
@@ -109,7 +109,7 @@
function vc200x.Files(prj)
local tr = premake.project.buildsourcetree(prj)
-
+
tree.traverse(tr, {
-- folders are handled at the internal nodes
onbranchenter = function(node, depth)
@@ -126,7 +126,7 @@
-- source files are handled at the leaves
onleaf = function(node, depth)
local fname = node.cfg.name
-
+
_p(depth, '<File')
_p(depth, '\tRelativePath="%s"', path.translate(fname, "\\"))
_p(depth, '\t>')
@@ -137,30 +137,30 @@
for _, cfginfo in ipairs(prj.solution.vstudio_configs) do
if cfginfo.isreal then
local cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform)
-
+
local usePCH = (not prj.flags.NoPCH and prj.pchsource == node.cfg.name)
local isSourceCode = path.iscppfile(fname)
local needsCompileAs = (path.iscfile(fname) ~= premake.project.iscproject(prj))
-
+
if usePCH or (isSourceCode and needsCompileAs) then
_p(depth, '<FileConfiguration')
_p(depth, '\tName="%s"', cfginfo.name)
_p(depth, '\t>')
_p(depth, '\t<Tool')
- _p(depth, '\t\tName="%s"', iif(cfg.system == "Xbox360",
- "VCCLX360CompilerTool",
+ _p(depth, '\t\tName="%s"', iif(cfg.system == "Xbox360",
+ "VCCLX360CompilerTool",
"VCCLCompilerTool"))
if needsCompileAs then
_p(depth, '\t\tCompileAs="%s"', iif(path.iscfile(fname), 1, 2))
end
-
+
if usePCH then
if cfg.system == "PS3" then
- local options = table.join(premake.snc.getcflags(cfg),
- premake.snc.getcxxflags(cfg),
+ local options = table.join(premake.snc.getcflags(cfg),
+ premake.snc.getcxxflags(cfg),
cfg.buildoptions)
options = table.concat(options, " ");
- options = options .. ' --create_pch="$(IntDir)/$(TargetName).pch"'
+ options = options .. ' --create_pch="$(IntDir)/$(TargetName).pch"'
_p(depth, '\t\tAdditionalOptions="%s"', premake.esc(options))
else
_p(depth, '\t\tUsePrecompiledHeader="1"')
@@ -181,7 +181,7 @@
end
-
+
--
-- Write out the <Platforms> element; ensures that each target platform
-- is listed only once. Skips over .NET's pseudo-platforms (like "Any CPU").
@@ -211,9 +211,9 @@
return 0
else
-- Edit-and-continue does't work for some configurations
- if cfg.flags.NoEditAndContinue or
- vc200x.optimization(cfg) ~= 0 or
- cfg.flags.Managed or
+ if cfg.flags.NoEditAndContinue or
+ vc200x.optimization(cfg) ~= 0 or
+ cfg.flags.Managed or
cfg.platform == "x64" then
return 3
else
@@ -230,42 +230,42 @@
function vc200x.VCCLCompilerTool(cfg)
_p(3,'<Tool')
_p(4,'Name="%s"', iif(cfg.platform ~= "Xbox360", "VCCLCompilerTool", "VCCLX360CompilerTool"))
-
+
if #cfg.buildoptions > 0 then
_p(4,'AdditionalOptions="%s"', table.concat(premake.esc(cfg.buildoptions), " "))
end
-
+
_p(4,'Optimization="%s"', vc200x.optimization(cfg))
-
+
if cfg.flags.NoFramePointer then
_p(4,'OmitFramePointers="%s"', bool(true))
end
-
+
if #cfg.includedirs > 0 then
_p(4,'AdditionalIncludeDirectories="%s"', premake.esc(path.translate(table.concat(cfg.includedirs, ";"), '\\')))
end
-
+
if #cfg.defines > 0 then
_p(4,'PreprocessorDefinitions="%s"', premake.esc(table.concat(cfg.defines, ";")))
end
-
+
if premake.config.isdebugbuild(cfg) and not cfg.flags.NoMinimalRebuild and not cfg.flags.Managed then
_p(4,'MinimalRebuild="%s"', bool(true))
end
-
+
if cfg.flags.NoExceptions then
_p(4,'ExceptionHandling="%s"', iif(_ACTION < "vs2005", "FALSE", 0))
elseif cfg.flags.SEH and _ACTION > "vs2003" then
_p(4,'ExceptionHandling="2"')
end
-
+
if vc200x.optimization(cfg) == 0 and not cfg.flags.Managed then
_p(4,'BasicRuntimeChecks="3"')
end
if vc200x.optimization(cfg) ~= 0 then
_p(4,'StringPooling="%s"', bool(true))
end
-
+
local runtime
if premake.config.isdebugbuild(cfg) then
runtime = iif(cfg.flags.StaticRuntime, 1, 3)
@@ -283,7 +283,7 @@
_p(4,'EnableEnhancedInstructionSet="2"')
end
end
-
+
if _ACTION < "vs2005" then
if cfg.flags.FloatFast then
_p(4,'ImproveFloatingPointConsistency="%s"', bool(false))
@@ -297,36 +297,36 @@
_p(4,'FloatingPointModel="1"')
end
end
-
+
if _ACTION < "vs2005" and not cfg.flags.NoRTTI then
_p(4,'RuntimeTypeInfo="%s"', bool(true))
elseif _ACTION > "vs2003" and cfg.flags.NoRTTI and not cfg.flags.Managed then
_p(4,'RuntimeTypeInfo="%s"', bool(false))
end
-
+
if cfg.flags.NativeWChar then
_p(4,'TreatWChar_tAsBuiltInType="%s"', bool(true))
elseif cfg.flags.NoNativeWChar then
_p(4,'TreatWChar_tAsBuiltInType="%s"', bool(false))
end
-
+
if not cfg.flags.NoPCH and cfg.pchheader then
_p(4,'UsePrecompiledHeader="%s"', iif(_ACTION < "vs2005", 3, 2))
_p(4,'PrecompiledHeaderThrough="%s"', cfg.pchheader)
else
_p(4,'UsePrecompiledHeader="%s"', iif(_ACTION > "vs2003" or cfg.flags.NoPCH, 0, 2))
end
-
+
_p(4,'WarningLevel="%s"', iif(cfg.flags.ExtraWarnings, 4, 3))
-
+
if cfg.flags.FatalWarnings then
_p(4,'WarnAsError="%s"', bool(true))
end
-
+
if _ACTION < "vs2008" and not cfg.flags.Managed then
_p(4,'Detect64BitPortabilityProblems="%s"', bool(not cfg.flags.No64BitChecks))
end
-
+
_p(4,'ProgramDataBaseFileName="$(OutDir)\\%s.pdb"', path.getbasename(cfg.buildtarget.name))
_p(4,'DebugInformationFormat="%s"', vc200x.Symbols(cfg))
if cfg.language == "C" then
@@ -334,8 +334,8 @@
end
_p(3,'/>')
end
-
-
+
+
--
-- Linker block for Windows and Xbox 360 platforms.
@@ -345,66 +345,66 @@
_p(3,'<Tool')
if cfg.kind ~= "StaticLib" then
_p(4,'Name="%s"', iif(cfg.platform ~= "Xbox360", "VCLinkerTool", "VCX360LinkerTool"))
-
+
if cfg.flags.NoImportLib then
_p(4,'IgnoreImportLibrary="%s"', bool(true))
end
-
+
if #cfg.linkoptions > 0 then
_p(4,'AdditionalOptions="%s"', table.concat(premake.esc(cfg.linkoptions), " "))
end
-
+
if #cfg.links > 0 then
_p(4,'AdditionalDependencies="%s"', table.concat(premake.getlinks(cfg, "all", "fullpath"), " "))
end
-
+
_p(4,'OutputFile="$(OutDir)\\%s"', cfg.buildtarget.name)
- _p(4,'LinkIncremental="%s"',
+ _p(4,'LinkIncremental="%s"',
iif(premake.config.isincrementallink(cfg) , 2, 1))
-
+
_p(4,'AdditionalLibraryDirectories="%s"', table.concat(premake.esc(path.translate(cfg.libdirs, '\\')) , ";"))
-
+
local deffile = premake.findfile(cfg, ".def")
if deffile then
_p(4,'ModuleDefinitionFile="%s"', deffile)
end
-
+
if cfg.flags.NoManifest then
_p(4,'GenerateManifest="%s"', bool(false))
end
-
+
_p(4,'GenerateDebugInformation="%s"', bool(vc200x.Symbols(cfg) ~= 0))
-
+
if vc200x.Symbols(cfg) ~= 0 then
_p(4,'ProgramDataBaseFileName="$(OutDir)\\%s.pdb"', path.getbasename(cfg.buildtarget.name))
end
-
+
_p(4,'SubSystem="%s"', iif(cfg.kind == "ConsoleApp", 1, 2))
-
+
if vc200x.optimization(cfg) ~= 0 then
_p(4,'OptimizeReferences="2"')
_p(4,'EnableCOMDATFolding="2"')
end
-
+
if (cfg.kind == "ConsoleApp" or cfg.kind == "WindowedApp") and not cfg.flags.WinMain then
_p(4,'EntryPointSymbol="mainCRTStartup"')
end
-
+
if cfg.kind == "SharedLib" then
local implibname = cfg.linktarget.fullpath
_p(4,'ImportLibrary="%s"', iif(cfg.flags.NoImportLib, cfg.objectsdir .. "\\" .. path.getname(implibname), implibname))
end
-
+
_p(4,'TargetMachine="%d"', iif(cfg.platform == "x64", 17, 1))
-
+
else
_p(4,'Name="VCLibrarianTool"')
-
+
if #cfg.links > 0 then
_p(4,'AdditionalDependencies="%s"', table.concat(premake.getlinks(cfg, "all", "fullpath"), " "))
end
-
+
_p(4,'OutputFile="$(OutDir)\\%s"', cfg.buildtarget.name)
if #cfg.libdirs > 0 then
@@ -422,11 +422,11 @@
_p(4,'AdditionalOptions="%s"', table.concat(premake.esc(addlOptions), " "))
end
end
-
+
_p(3,'/>')
end
-
-
+
+
--
-- Compiler and linker blocks for the PS3 platform, which uses Sony's SNC.
--
@@ -464,23 +464,23 @@
_p(3,'<Tool')
if cfg.kind ~= "StaticLib" then
_p(4,'Name="VCLinkerTool"')
-
+
local buildoptions = table.join(premake.snc.getldflags(cfg), cfg.linkoptions)
if #buildoptions > 0 then
_p(4,'AdditionalOptions="%s"', premake.esc(table.concat(buildoptions, " ")))
end
-
+
if #cfg.links > 0 then
_p(4,'AdditionalDependencies="%s"', table.concat(premake.getlinks(cfg, "all", "fullpath"), " "))
end
-
+
_p(4,'OutputFile="$(OutDir)\\%s"', cfg.buildtarget.name)
_p(4,'LinkIncremental="0"')
_p(4,'AdditionalLibraryDirectories="%s"', table.concat(premake.esc(path.translate(cfg.libdirs, '\\')) , ";"))
_p(4,'GenerateManifest="%s"', bool(false))
_p(4,'ProgramDatabaseFile=""')
_p(4,'RandomizedBaseAddress="1"')
- _p(4,'DataExecutionPrevention="0"')
+ _p(4,'DataExecutionPrevention="0"')
else
_p(4,'Name="VCLibrarianTool"')
@@ -488,21 +488,21 @@
if #buildoptions > 0 then
_p(4,'AdditionalOptions="%s"', premake.esc(table.concat(buildoptions, " ")))
end
-
+
if #cfg.links > 0 then
_p(4,'AdditionalDependencies="%s"', table.concat(premake.getlinks(cfg, "all", "fullpath"), " "))
end
-
+
_p(4,'OutputFile="$(OutDir)\\%s"', cfg.buildtarget.name)
if #cfg.libdirs > 0 then
_p(4,'AdditionalLibraryDirectories="%s"', premake.esc(path.translate(table.concat(cfg.libdirs , ";"))))
end
end
-
+
_p(3,'/>')
end
-
+
--
@@ -528,8 +528,8 @@
_p(3,'/>')
end
-
-
+
+
--
-- Manifest block.
@@ -543,7 +543,7 @@
table.insert(manifests, fname)
end
end
-
+
_p(3,'<Tool')
_p(4,'Name="VCManifestTool"')
if #manifests > 0 then
@@ -567,7 +567,7 @@
_p(3,'/>')
end
-
+
--
-- Write out a custom build steps block.
@@ -589,7 +589,7 @@
-- an empty <Tool> element.
--
- vc200x.toolmap =
+ vc200x.toolmap =
{
VCCLCompilerTool = vc200x.VCCLCompilerTool,
VCCLCompilerTool_PS3 = vc200x.VCCLCompilerTool_PS3,
@@ -680,9 +680,9 @@
"VCAppVerifierTool",
"VCWebDeploymentTool",
"VCPostBuildEventTool"
- }
+ }
else
- return {
+ return {
"VCPreBuildEventTool",
"VCCustomBuildTool",
"VCXMLDataGeneratorTool",
@@ -701,7 +701,7 @@
"VCAppVerifierTool",
"VCWebDeploymentTool",
"VCPostBuildEventTool"
- }
+ }
end
end
@@ -713,7 +713,7 @@
function vc200x.generate(prj)
vc200x.header('VisualStudioProject')
-
+
_p(1,'Name="%s"', premake.esc(prj.name))
_p(1,'ProjectGUID="{%s}"', prj.uuid)
if _ACTION > "vs2003" then
@@ -734,11 +734,11 @@
for _, cfginfo in ipairs(prj.solution.vstudio_configs) do
if cfginfo.isreal then
local cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform)
-
+
-- Start a configuration
vc200x.Configuration(cfginfo.name, cfg)
for _, block in ipairs(getsections(_ACTION, cfginfo.src_platform)) do
-
+
if vc200x.toolmap[block] then
vc200x.toolmap[block](cfg)
@@ -762,19 +762,19 @@
_p(4,'OutputFileName="%s"', premake.esc(path.translate(cfg.imagepath)))
end
_p(3,'/>')
-
+
elseif block == "DebuggerTool" then
_p(3,'<DebuggerTool')
_p(3,'/>')
-
+
-- End Xbox 360 custom sections --
-
+
else
_p(3,'<Tool')
_p(4,'Name="%s"', block)
_p(3,'/>')
end
-
+
end
_p(2,'</Configuration>')
@@ -784,11 +784,11 @@
_p(1,'<References>')
_p(1,'</References>')
-
+
_p(1,'<Files>')
vc200x.Files(prj)
_p(1,'</Files>')
-
+
_p(1,'<Globals>')
_p(1,'</Globals>')
_p('</VisualStudioProject>')
diff --git a/src/actions/vstudio/vs200x_vcproj_user.lua b/src/actions/vstudio/vs200x_vcproj_user.lua
index 6431a7d..b3b9900 100644
--- a/src/actions/vstudio/vs200x_vcproj_user.lua
+++ b/src/actions/vstudio/vs200x_vcproj_user.lua
@@ -18,25 +18,25 @@
function vc200x.generate_user(prj)
vc200x.header('VisualStudioUserFile')
-
+
_p(1,'ShowAllFiles="false"')
_p(1,'>')
_p(1,'<Configurations>')
-
+
for _, cfginfo in ipairs(prj.solution.vstudio_configs) do
if cfginfo.isreal then
local cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform)
-
+
_p(2,'<Configuration')
_p(3,'Name="%s"', premake.esc(cfginfo.name))
_p(3,'>')
-
+
vc200x.debugdir(cfg)
-
+
_p(2,'</Configuration>')
end
- end
-
+ end
+
_p(1,'</Configurations>')
_p('</VisualStudioUserFile>')
end
@@ -53,19 +53,19 @@
end
end
end
-
+
function vc200x.debugdir(cfg)
_p(3,'<DebugSettings')
-
+
if cfg.debugdir then
_p(4,'WorkingDirectory="%s"', path.translate(cfg.debugdir, '\\'))
end
-
+
if #cfg.debugargs > 0 then
_p(4,'CommandArguments="%s"', table.concat(cfg.debugargs, " "))
end
vc200x.environmentargs(cfg)
-
+
_p(3,'/>')
end
diff --git a/src/actions/vstudio/vs2010_vcxproj_filters.lua b/src/actions/vstudio/vs2010_vcxproj_filters.lua
index 0744e08..7b90a10 100644
--- a/src/actions/vstudio/vs2010_vcxproj_filters.lua
+++ b/src/actions/vstudio/vs2010_vcxproj_filters.lua
@@ -6,7 +6,7 @@
local vc2010 = premake.vstudio.vc2010
local project = premake.project
-
+
--
-- The first portion of the filters file assigns unique IDs to each
@@ -28,7 +28,7 @@
filterfound = true
_p(1,'<ItemGroup>')
end
-
+
path = path .. folders[i]
-- have I seen this path before?
@@ -43,7 +43,7 @@
path = path .. "\\"
end
end
-
+
if filterfound then
_p(1,'</ItemGroup>')
end
@@ -52,7 +52,7 @@
--
-- The second portion of the filters file assigns filters to each source
--- code file, as needed. Section is one of "ClCompile", "ClInclude",
+-- code file, as needed. Section is one of "ClCompile", "ClInclude",
-- "ResourceCompile", or "None".
--
@@ -66,8 +66,8 @@
filter = path.getdirectory(file.vpath)
else
filter = path.getdirectory(file.name)
- end
-
+ end
+
if filter ~= "." then
_p(2,'<%s Include=\"%s\">', section, path.translate(file.name, "\\"))
_p(3,'<Filter>%s</Filter>', path.translate(filter, "\\"))
@@ -84,7 +84,7 @@
--
-- Output the VC2010 filters file
--
-
+
function vc2010.generate_filters(prj)
io.indent = " "
vc2010.header()
diff --git a/src/actions/vstudio/vs2013.lua b/src/actions/vstudio/vs2013.lua
index 6d25981..c1cdb46 100644
--- a/src/actions/vstudio/vs2013.lua
+++ b/src/actions/vstudio/vs2013.lua
@@ -7,7 +7,7 @@
premake.vstudio.vc2013 = {}
local vc2013 = premake.vstudio.vc2013
local vstudio = premake.vstudio
-
+
---
-- Register a command-line action for Visual Studio 2013.
diff --git a/src/actions/xcode/_xcode.lua b/src/actions/xcode/_xcode.lua
index a505977..f0bab79 100644
--- a/src/actions/xcode/_xcode.lua
+++ b/src/actions/xcode/_xcode.lua
@@ -5,8 +5,8 @@
--
premake.xcode = { }
-
- newaction
+
+ newaction
{
trigger = "xcode3",
shortname = "Xcode 3",
@@ -14,37 +14,37 @@
os = "macosx",
valid_kinds = { "ConsoleApp", "WindowedApp", "SharedLib", "StaticLib" },
-
+
valid_languages = { "C", "C++" },
-
+
valid_tools = {
cc = { "gcc" },
},
- valid_platforms = {
- Native = "Native",
- x32 = "Native 32-bit",
- x64 = "Native 64-bit",
- Universal32 = "32-bit Universal",
- Universal64 = "64-bit Universal",
+ valid_platforms = {
+ Native = "Native",
+ x32 = "Native 32-bit",
+ x64 = "Native 64-bit",
+ Universal32 = "32-bit Universal",
+ Universal64 = "64-bit Universal",
Universal = "Universal",
},
-
+
default_platform = "Universal",
-
+
onsolution = function(sln)
-- Assign IDs needed for inter-project dependencies
premake.xcode.preparesolution(sln)
end,
-
+
onproject = function(prj)
premake.generate(prj, "%%.xcodeproj/project.pbxproj", premake.xcode.project)
end,
-
+
oncleanproject = function(prj)
premake.clean.directory(prj, "%%.xcodeproj")
end,
-
+
oncheckproject = function(prj)
-- Xcode can't mix target kinds within a project
local last
@@ -57,7 +57,7 @@
end,
}
- newaction
+ newaction
{
trigger = "xcode4",
shortname = "Xcode 4",
@@ -65,37 +65,37 @@
os = "macosx",
valid_kinds = { "ConsoleApp", "WindowedApp", "SharedLib", "StaticLib" },
-
+
valid_languages = { "C", "C++" },
-
+
valid_tools = {
cc = { "gcc" },
},
- valid_platforms = {
- Native = "Native",
- x32 = "Native 32-bit",
- x64 = "Native 64-bit",
- Universal32 = "32-bit Universal",
- Universal64 = "64-bit Universal",
+ valid_platforms = {
+ Native = "Native",
+ x32 = "Native 32-bit",
+ x64 = "Native 64-bit",
+ Universal32 = "32-bit Universal",
+ Universal64 = "64-bit Universal",
Universal = "Universal",
},
-
+
default_platform = "Universal",
-
+
onsolution = function(sln)
premake.generate(sln, "%%.xcworkspace/contents.xcworkspacedata", premake.xcode4.workspace_generate)
end,
-
+
onproject = function(prj)
premake.generate(prj, "%%.xcodeproj/project.pbxproj", premake.xcode.project)
end,
-
+
oncleanproject = function(prj)
premake.clean.directory(prj, "%%.xcodeproj")
premake.clean.directory(prj, "%%.xcworkspace")
end,
-
+
oncheckproject = function(prj)
-- Xcode can't mix target kinds within a project
local last
diff --git a/src/actions/xcode/xcode4_workspace.lua b/src/actions/xcode/xcode4_workspace.lua
index a17e654..9c2bc43 100644
--- a/src/actions/xcode/xcode4_workspace.lua
+++ b/src/actions/xcode/xcode4_workspace.lua
@@ -16,8 +16,8 @@ end
function xcode4.workspace_file_ref(prj)
local projpath = path.getrelative(prj.solution.location, prj.location)
- if projpath == '.' then projpath = ''
- else projpath = projpath ..'/'
+ if projpath == '.' then projpath = ''
+ else projpath = projpath ..'/'
end
_p(1,'<FileRef')
_p(2,'location = "group:%s">',projpath .. prj.name .. '.xcodeproj')
@@ -32,7 +32,7 @@ function xcode4.workspace_generate(sln)
for prj in premake.solution.eachproject(sln) do
xcode4.workspace_file_ref(prj)
end
-
+
xcode4.workspace_tail()
end
diff --git a/src/actions/xcode/xcode_common.lua b/src/actions/xcode/xcode_common.lua
index 4d413d4..626b826 100644
--- a/src/actions/xcode/xcode_common.lua
+++ b/src/actions/xcode/xcode_common.lua
@@ -135,7 +135,7 @@
--
--- Return a unique file name for a project. Since Xcode uses .xcodeproj's to
+-- Return a unique file name for a project. Since Xcode uses .xcodeproj's to
-- represent both solutions and projects there is a likely change of a name
-- collision. Tack on a number to differentiate them.
--
@@ -186,7 +186,7 @@
--
--- Create a product tree node and all projects in a solution; assigning IDs
+-- Create a product tree node and all projects in a solution; assigning IDs
-- that are needed for inter-project dependencies.
--
-- @param sln
@@ -197,7 +197,7 @@
-- create and cache a list of supported platforms
sln.xcode = { }
sln.xcode.platforms = premake.filterplatforms(sln, premake.action.current().valid_platforms, "Universal")
-
+
for prj in premake.solution.eachproject(sln) do
-- need a configuration to get the target information
local cfg = premake.getconfig(prj, prj.configurations[1], sln.xcode.platforms[1])
@@ -207,7 +207,7 @@
node.cfg = cfg
node.id = premake.xcode.newid(node, "product")
node.targetid = premake.xcode.newid(node, "target")
-
+
-- attach it to the project
prj.xcode = {}
prj.xcode.projectnode = node
@@ -258,7 +258,7 @@
tree.traverse(tr, {
onnode = function(node)
if node.buildid then
- _p(2,'%s /* %s in %s */ = {isa = PBXBuildFile; fileRef = %s /* %s */; };',
+ _p(2,'%s /* %s in %s */ = {isa = PBXBuildFile; fileRef = %s /* %s */; };',
node.buildid, node.name, xcode.getbuildcategory(node), node.id, node.name)
end
end
@@ -295,25 +295,25 @@
function xcode.PBXFileReference(tr)
_p('/* Begin PBXFileReference section */')
-
+
tree.traverse(tr, {
onleaf = function(node)
-- I'm only listing files here, so ignore anything without a path
if not node.path then
return
end
-
+
-- is this the product node, describing the output target?
if node.kind == "product" then
_p(2,'%s /* %s */ = {isa = PBXFileReference; explicitFileType = %s; includeInIndex = 0; name = "%s"; path = "%s"; sourceTree = BUILT_PRODUCTS_DIR; };',
node.id, node.name, xcode.gettargettype(node), node.name, path.getname(node.cfg.buildtarget.bundlepath))
-
+
-- is this a project dependency?
elseif node.parent.parent == tr.projects then
local relpath = path.getrelative(tr.project.location, node.parent.project.location)
_p(2,'%s /* %s */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = "%s"; path = "%s"; sourceTree = SOURCE_ROOT; };',
node.parent.id, node.parent.name, node.parent.name, path.join(relpath, node.parent.name))
-
+
-- something else
else
local pth, src
@@ -358,13 +358,13 @@
pth = tree.getlocalpath(node)
end
end
-
+
_p(2,'%s /* %s */ = {isa = PBXFileReference; lastKnownFileType = %s; name = "%s"; path = "%s"; sourceTree = "%s"; };',
node.id, node.name, xcode.getfiletype(node), node.name, pth, src)
end
end
})
-
+
_p('/* End PBXFileReference section */')
_p('')
end
@@ -376,21 +376,21 @@
_p(3,'isa = PBXFrameworksBuildPhase;')
_p(3,'buildActionMask = 2147483647;')
_p(3,'files = (')
-
+
-- write out library dependencies
tree.traverse(tr.frameworks, {
onleaf = function(node)
_p(4,'%s /* %s in Frameworks */,', node.buildid, node.name)
end
})
-
+
-- write out project dependencies
tree.traverse(tr.projects, {
onleaf = function(node)
_p(4,'%s /* %s in Frameworks */,', node.buildid, node.name)
end
})
-
+
_p(3,');')
_p(3,'runOnlyForDeploymentPostprocessing = 0;')
_p(2,'};')
@@ -408,21 +408,21 @@
if (node.path and #node.children == 0) or node.kind == "vgroup" then
return
end
-
+
-- project references get special treatment
if node.parent == tr.projects then
_p(2,'%s /* Products */ = {', node.productgroupid)
else
_p(2,'%s /* %s */ = {', node.id, node.name)
end
-
+
_p(3,'isa = PBXGroup;')
_p(3,'children = (')
for _, childnode in ipairs(node.children) do
_p(4,'%s /* %s */,', childnode.id, childnode.name)
end
_p(3,');')
-
+
if node.parent == tr.projects then
_p(3,'name = Products;')
else
@@ -435,22 +435,22 @@
_p(3,'path = "%s";', p)
end
end
-
+
_p(3,'sourceTree = "<group>";')
_p(2,'};')
end
}, true)
-
+
_p('/* End PBXGroup section */')
_p('')
- end
+ end
function xcode.PBXNativeTarget(tr)
_p('/* Begin PBXNativeTarget section */')
for _, node in ipairs(tr.products.children) do
local name = tr.project.name
-
+
-- This function checks whether there are build commands of a specific
-- type to be executed; they will be generated correctly, but the project
-- commands will not contain any per-configuration commands, so the logic
@@ -467,7 +467,7 @@
end
end
end
-
+
_p(2,'%s /* %s */ = {', node.targetid, name)
_p(3,'isa = PBXNativeTarget;')
_p(3,'buildConfigurationList = %s /* Build configuration list for PBXNativeTarget "%s" */;', node.cfgsection, name)
@@ -487,15 +487,15 @@
_p(3,');')
_p(3,'buildRules = (')
_p(3,');')
-
+
_p(3,'dependencies = (')
for _, node in ipairs(tr.projects.children) do
_p(4,'%s /* PBXTargetDependency */,', node.targetdependid)
end
_p(3,');')
-
+
_p(3,'name = "%s";', name)
-
+
local p
if node.cfg.kind == "ConsoleApp" then
p = "$(HOME)/bin"
@@ -505,7 +505,7 @@
if p then
_p(3,'productInstallPath = "%s";', p)
end
-
+
_p(3,'productName = "%s";', name)
_p(3,'productReference = %s /* %s */;', node.id, node.name)
_p(3,'productType = "%s";', xcode.getproducttype(node))
@@ -525,7 +525,7 @@
_p(3,'hasScannedForEncodings = 1;')
_p(3,'mainGroup = %s /* %s */;', tr.id, tr.name)
_p(3,'projectDirPath = "";')
-
+
if #tr.projects.children > 0 then
_p(3,'projectReferences = (')
for _, node in ipairs(tr.projects.children) do
@@ -536,7 +536,7 @@
end
_p(3,');')
end
-
+
_p(3,'projectRoot = "";')
_p(3,'targets = (')
for _, node in ipairs(tr.products.children) do
@@ -567,7 +567,7 @@
_p('')
end
end
-
+
function xcode.PBXResourcesBuildPhase(tr)
_p('/* Begin PBXResourcesBuildPhase section */')
@@ -590,7 +590,7 @@
_p('/* End PBXResourcesBuildPhase section */')
_p('')
end
-
+
function xcode.PBXShellScriptBuildPhase(tr)
local wrapperWritten = false
@@ -610,7 +610,7 @@
table.insert(commands, 'fi')
end
end
-
+
if #commands > 0 then
if not wrapperWritten then
_p('/* Begin PBXShellScriptBuildPhase section */')
@@ -632,17 +632,17 @@
_p(2,'};')
end
end
-
+
doblock("9607AE1010C857E500CD1376", "Prebuild", "prebuildcommands")
doblock("9607AE3510C85E7E00CD1376", "Prelink", "prelinkcommands")
doblock("9607AE3710C85E8F00CD1376", "Postbuild", "postbuildcommands")
-
+
if wrapperWritten then
_p('/* End PBXShellScriptBuildPhase section */')
end
end
-
-
+
+
function xcode.PBXSourcesBuildPhase(tr)
_p('/* Begin PBXSourcesBuildPhase section */')
for _, target in ipairs(tr.products.children) do
@@ -709,7 +709,7 @@
function xcode.XCBuildConfiguration_Target(tr, target, cfg)
local cfgname = xcode.getconfigname(cfg)
-
+
_p(2,'%s /* %s */ = {', cfg.xcode.targetid, cfgname)
_p(3,'isa = XCBuildConfiguration;')
_p(3,'buildSettings = {')
@@ -718,11 +718,11 @@
if not cfg.flags.Symbols then
_p(4,'DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";')
end
-
+
if cfg.kind ~= "StaticLib" and cfg.buildtarget.prefix ~= "" then
_p(4,'EXECUTABLE_PREFIX = %s;', cfg.buildtarget.prefix)
end
-
+
if cfg.targetextension then
local ext = cfg.targetextension
ext = iif(ext:startswith("."), ext:sub(2), ext)
@@ -754,15 +754,15 @@
_p(3,'name = "%s";', cfgname)
_p(2,'};')
end
-
-
+
+
function xcode.XCBuildConfiguration_Project(tr, cfg)
local cfgname = xcode.getconfigname(cfg)
_p(2,'%s /* %s */ = {', cfg.xcode.projectid, cfgname)
_p(3,'isa = XCBuildConfiguration;')
_p(3,'buildSettings = {')
-
+
local archs = {
Native = "$(NATIVE_ARCH_ACTUAL)",
x32 = "i386",
@@ -772,36 +772,36 @@
Universal = "$(ARCHS_STANDARD_32_64_BIT)",
}
_p(4,'ARCHS = "%s";', archs[cfg.platform])
-
+
local targetdir = path.getdirectory(cfg.buildtarget.bundlepath)
if targetdir ~= "." then
_p(4,'CONFIGURATION_BUILD_DIR = "$(SYMROOT)";');
end
-
+
_p(4,'CONFIGURATION_TEMP_DIR = "$(OBJROOT)";')
-
+
if cfg.flags.Symbols then
_p(4,'COPY_PHASE_STRIP = NO;')
end
-
+
_p(4,'GCC_C_LANGUAGE_STANDARD = gnu99;')
-
+
if cfg.flags.NoExceptions then
_p(4,'GCC_ENABLE_CPP_EXCEPTIONS = NO;')
end
-
+
if cfg.flags.NoRTTI then
_p(4,'GCC_ENABLE_CPP_RTTI = NO;')
end
-
+
if _ACTION ~= "xcode4" and cfg.flags.Symbols and not cfg.flags.NoEditAndContinue then
_p(4,'GCC_ENABLE_FIX_AND_CONTINUE = YES;')
end
-
+
if cfg.flags.NoExceptions then
_p(4,'GCC_ENABLE_OBJC_EXCEPTIONS = NO;')
end
-
+
if cfg.flags.Optimize or cfg.flags.OptimizeSize then
_p(4,'GCC_OPTIMIZATION_LEVEL = s;')
elseif cfg.flags.OptimizeSpeed then
@@ -809,37 +809,37 @@
else
_p(4,'GCC_OPTIMIZATION_LEVEL = 0;')
end
-
+
if cfg.pchheader and not cfg.flags.NoPCH then
_p(4,'GCC_PRECOMPILE_PREFIX_HEADER = YES;')
_p(4,'GCC_PREFIX_HEADER = "%s";', cfg.pchheader)
end
-
+
xcode.printlist(cfg.defines, 'GCC_PREPROCESSOR_DEFINITIONS')
_p(4,'GCC_SYMBOLS_PRIVATE_EXTERN = NO;')
-
+
if cfg.flags.FatalWarnings then
_p(4,'GCC_TREAT_WARNINGS_AS_ERRORS = YES;')
end
-
+
_p(4,'GCC_WARN_ABOUT_RETURN_TYPE = YES;')
_p(4,'GCC_WARN_UNUSED_VARIABLE = YES;')
xcode.printlist(cfg.includedirs, 'HEADER_SEARCH_PATHS')
xcode.printlist(cfg.libdirs, 'LIBRARY_SEARCH_PATHS')
-
+
_p(4,'OBJROOT = "%s";', cfg.objectsdir)
_p(4,'ONLY_ACTIVE_ARCH = %s;',iif(premake.config.isdebugbuild(cfg),'YES','NO'))
-
+
-- build list of "other" C/C++ flags
local checks = {
["-ffast-math"] = cfg.flags.FloatFast,
["-ffloat-store"] = cfg.flags.FloatStrict,
["-fomit-frame-pointer"] = cfg.flags.NoFramePointer,
}
-
+
local flags = { }
for flag, check in pairs(checks) do
if check then
@@ -859,19 +859,19 @@
end
flags = table.join(flags, cfg.linkoptions)
xcode.printlist(flags, 'OTHER_LDFLAGS')
-
+
if cfg.flags.StaticRuntime then
_p(4,'STANDARD_C_PLUS_PLUS_LIBRARY_TYPE = static;')
end
-
+
if targetdir ~= "." then
_p(4,'SYMROOT = "%s";', targetdir)
end
-
+
if cfg.flags.ExtraWarnings then
_p(4,'WARNING_CFLAGS = "-Wall";')
end
-
+
_p(3,'};')
_p(3,'name = "%s";', cfgname)
_p(2,'};')
@@ -895,7 +895,7 @@
function xcode.XCBuildConfigurationList(tr)
local sln = tr.project.solution
-
+
_p('/* Begin XCConfigurationList section */')
for _, target in ipairs(tr.products.children) do
_p(2,'%s /* Build configuration list for PBXNativeTarget "%s" */ = {', target.cfgsection, target.name)
diff --git a/src/actions/xcode/xcode_project.lua b/src/actions/xcode/xcode_project.lua
index b7f0285..b352c79 100644
--- a/src/actions/xcode/xcode_project.lua
+++ b/src/actions/xcode/xcode_project.lua
@@ -19,7 +19,7 @@
function xcode.buildprjtree(prj)
local tr = premake.project.buildsourcetree(prj)
-
+
-- create a list of build configurations and assign IDs
tr.configs = {}
for _, cfgname in ipairs(prj.solution.configurations) do
@@ -31,14 +31,14 @@
table.insert(tr.configs, cfg)
end
end
-
+
-- convert localized resources from their filesystem layout (English.lproj/MainMenu.xib)
-- to Xcode's display layout (MainMenu.xib/English).
tree.traverse(tr, {
onbranch = function(node)
if path.getextension(node.name) == ".lproj" then
local lang = path.getbasename(node.name) -- "English", "French", etc.
-
+
-- create a new language group for each file it contains
for _, filenode in ipairs(node.children) do
local grpnode = node.parent.children[filenode.name]
@@ -46,18 +46,18 @@
grpnode = tree.insert(node.parent, tree.new(filenode.name))
grpnode.kind = "vgroup"
end
-
+
-- convert the file node to a language node and add to the group
filenode.name = path.getbasename(lang)
tree.insert(grpnode, filenode)
end
-
+
-- remove this directory from the tree
tree.remove(node)
end
end
})
-
+
-- the special folder "Frameworks" lists all linked frameworks
tr.frameworks = tree.new("Frameworks")
for cfg in premake.eachconfig(prj) do
@@ -69,12 +69,12 @@
end
end
end
-
+
-- only add it to the tree if there are frameworks to link
- if #tr.frameworks.children > 0 then
+ if #tr.frameworks.children > 0 then
tree.insert(tr, tr.frameworks)
end
-
+
-- the special folder "Products" holds the target produced by the project; this
-- is populated below
tr.products = tree.insert(tr, tree.new("Products"))
@@ -91,7 +91,7 @@
xcnode.productproxyid = xcode.newid(xcnode, "prodprox")
xcnode.targetproxyid = xcode.newid(xcnode, "targprox")
xcnode.targetdependid = xcode.newid(xcnode, "targdep")
-
+
-- create a grandchild node for the dependency's link target
local cfg = premake.getconfig(dep, prj.configurations[1])
node = tree.insert(xcnode, tree.new(cfg.linktarget.name))
@@ -108,7 +108,7 @@
onnode = function(node)
-- assign IDs to every node in the tree
node.id = xcode.newid(node)
-
+
-- assign build IDs to buildable files
if xcode.getbuildcategory(node) then
node.buildid = xcode.newid(node, "build")
@@ -117,7 +117,7 @@
-- remember key files that are needed elsewhere
if string.endswith(node.name, "Info.plist") then
tr.infoplist = node
- end
+ end
end
}, true)
diff --git a/src/base/action.lua b/src/base/action.lua
index 6adbcad..80bfce4 100644
--- a/src/base/action.lua
+++ b/src/base/action.lua
@@ -12,14 +12,14 @@
--
premake.action.list = { }
-
+
--
-- Register a new action.
--
-- @param a
-- The new action object.
---
+--
function premake.action.add(a)
-- validate the action object, at least a little bit
@@ -29,13 +29,13 @@
missing = field
end
end
-
+
if (missing) then
error("action needs a " .. missing, 3)
end
-- add it to the master list
- premake.action.list[a.trigger] = a
+ premake.action.list[a.trigger] = a
end
@@ -60,7 +60,7 @@
end
end
end
-
+
if a.execute then
a.execute()
end
@@ -77,8 +77,8 @@
function premake.action.current()
return premake.action.get(_ACTION)
end
-
-
+
+
--
-- Retrieve an action by name.
--
@@ -104,7 +104,7 @@
table.insert(keys, action.trigger)
end
table.sort(keys)
-
+
local i = 0
return function()
i = i + 1
diff --git a/src/base/bake.lua b/src/base/bake.lua
index 9276af8..20aad72 100644
--- a/src/base/bake.lua
+++ b/src/base/bake.lua
@@ -2,8 +2,8 @@
-- base/bake.lua
--
-- Takes all the configuration information provided by the project scripts
--- and stored in the solution->project->block hierarchy and flattens it all
--- down into one object per configuration. These objects are cached with the
+-- and stored in the solution->project->block hierarchy and flattens it all
+-- down into one object per configuration. These objects are cached with the
-- project, and can be retrieved by calling the getconfig() or eachconfig().
--
-- Copyright (c) 2008-2011 Jason Perkins and the Premake project
@@ -15,7 +15,7 @@
-- do not copy these fields into the configurations
- local nocopy =
+ local nocopy =
{
blocks = true,
keywords = true,
@@ -25,11 +25,11 @@
-- do not cascade these fields from projects to configurations
- local nocascade =
+ local nocascade =
{
makesettings = true,
}
-
+
-- leave these paths as absolute, rather than converting to project relative
local keeprelative =
@@ -47,7 +47,7 @@
function premake.getactiveterms()
local terms = { _action = _ACTION:lower(), os = os.get() }
-
+
-- add option keys or values
for key, value in pairs(_OPTIONS) do
if value ~= "" then
@@ -56,15 +56,15 @@
table.insert(terms, key:lower())
end
end
-
+
return terms
end
-
-
+
+
--
-- Test a single configuration block keyword against a list of terms.
-- The terms are a mix of key/value pairs. The keyword is tested against
--- the values; on a match, the corresponding key is returned. This
+-- the values; on a match, the corresponding key is returned. This
-- enables testing for required values in iskeywordsmatch(), below.
--
@@ -73,7 +73,7 @@
if keyword:startswith("not ") then
return not premake.iskeywordmatch(keyword:sub(5), terms)
end
-
+
for _, pattern in ipairs(keyword:explode(" or ")) do
for termkey, term in pairs(terms) do
if term:match(pattern) == term then
@@ -82,9 +82,9 @@
end
end
end
-
-
-
+
+
+
--
-- Checks a set of configuration block keywords against a list of terms.
-- The required flag is used by the file configurations: only blocks
@@ -104,7 +104,7 @@
hasrequired = true
end
end
-
+
if terms.required and not hasrequired then
return false
else
@@ -125,15 +125,15 @@
local function adjustpaths(location, obj)
function adjustpathlist(list)
for i, p in ipairs(list) do
- list[i] = path.getrelative(location, p)
+ list[i] = path.getrelative(location, p)
end
end
-
+
for name, value in pairs(obj) do
local field = premake.fields[name]
if field and value and not keeprelative[name] then
if field.kind == "path" then
- obj[name] = path.getrelative(location, value)
+ obj[name] = path.getrelative(location, value)
elseif field.kind == "dirlist" or field.kind == "filelist" then
adjustpathlist(value)
elseif field.kind == "keypath" then
@@ -144,8 +144,8 @@
end
end
end
-
-
+
+
--
-- Merge all of the fields from one object into another. String values are overwritten,
@@ -173,13 +173,13 @@
end
return tbl
end
-
+
local function mergeobject(dest, src)
-- if there's nothing to add, quick out
- if not src then
- return
+ if not src then
+ return
end
-
+
for fieldname, value in pairs(src) do
if not nocopy[fieldname] then
-- fields that are included in the API are merged...
@@ -190,7 +190,7 @@
else
dest[fieldname] = value
end
-
+
-- ...everything else is just copied as-is
else
dest[fieldname] = value
@@ -198,8 +198,8 @@
end
end
end
-
-
+
+
--
-- Merges the settings from a solution's or project's list of configuration blocks,
@@ -228,33 +228,33 @@
if pltname ~= "Native" then
key = key .. pltname
end
-
+
-- add the configuration and platform to the block filter terms
terms.config = (cfgname or ""):lower()
terms.platform = pltname:lower()
-
+
-- build the configuration base by merging the solution and project level settings
local cfg = {}
mergeobject(cfg, basis[key])
adjustpaths(obj.location, cfg)
mergeobject(cfg, obj)
-
+
-- add `kind` to the filter terms
- if (cfg.kind) then
+ if (cfg.kind) then
terms['kind']=cfg.kind:lower()
end
-
+
-- now add in any blocks that match the filter terms
for _, blk in ipairs(obj.blocks) do
if (premake.iskeywordsmatch(blk.keywords, terms))then
mergeobject(cfg, blk)
- if (cfg.kind and not cfg.terms.kind) then
+ if (cfg.kind and not cfg.terms.kind) then
cfg.terms['kind'] = cfg.kind:lower()
terms['kind'] = cfg.kind:lower()
end
end
end
-
+
-- package it all up and add it to the result set
cfg.name = cfgname
cfg.platform = pltname
@@ -263,9 +263,9 @@
end
dest[key] = cfg
end
-
-
-
+
+
+
--
-- Collapse a solution or project object down to a canonical set of configuration settings,
-- keyed by configuration block/platform pairs, and taking into account the current
@@ -283,15 +283,15 @@
local function collapse(obj, basis)
local result = {}
basis = basis or {}
-
+
-- find the solution, which contains the configuration and platform lists
local sln = obj.solution or obj
- -- build a set of configuration filter terms; only those configuration blocks
+ -- build a set of configuration filter terms; only those configuration blocks
-- with a matching set of keywords will be included in the merged results
local terms = premake.getactiveterms()
- -- build a project-level configuration.
+ -- build a project-level configuration.
merge(result, obj, basis, terms)--this adjusts terms
-- now build configurations for each build config/platform pair
@@ -305,7 +305,7 @@
end
end
end
-
+
return result
end
@@ -322,12 +322,12 @@
local function builduniquedirs()
local num_variations = 4
-
+
-- Start by listing out each possible object directory for each configuration.
-- Keep a count of how many times each path gets used across the session.
local cfg_dirs = {}
local hit_counts = {}
-
+
for sln in premake.solution.each() do
for _, prj in ipairs(sln.projects) do
for _, cfg in pairs(prj.__configs) do
@@ -338,7 +338,7 @@
dirs[3] = path.join(dirs[2], cfg.name)
dirs[4] = path.join(dirs[3], cfg.project.name)
cfg_dirs[cfg] = dirs
-
+
-- configurations other than the root should bias toward a more
-- description path, including the platform or config name
local start = iif(cfg.name, 2, 1)
@@ -350,7 +350,7 @@
end
end
end
-
+
-- Now assign an object directory to each configuration, skipping those
-- that are in use somewhere else in the session
for sln in premake.solution.each() do
@@ -366,10 +366,10 @@
cfg.objectsdir = path.getrelative(cfg.location, dir)
end
end
- end
-
+ end
+
end
-
+
--
@@ -393,24 +393,24 @@
end
end
- end
+ end
end
-
+
local function getCfgKind(cfg)
if(cfg.kind) then
return cfg.kind;
end
-
+
if(cfg.project.__configs[""] and cfg.project.__configs[""].kind) then
return cfg.project.__configs[""].kind;
end
-
+
return nil
end
-
+
local function getprojrec(dstArray, foundList, cfg, cfgname, searchField, bLinkage)
if(not cfg) then return end
-
+
local foundUsePrjs = {};
for _, useName in ipairs(cfg[searchField]) do
local testName = useName:lower();
@@ -426,7 +426,7 @@
end
end
end
-
+
--Must connect to a usage project.
if(theUseProj) then
foundList[testName] = true;
@@ -441,7 +441,7 @@
end
end
end
-
+
for _, usePrj in ipairs(foundUsePrjs) do
--Links can only recurse through static libraries.
if((searchField ~= "links") or
@@ -451,7 +451,7 @@
end
end
end
-
+
--
-- This function will recursively get all projects that the given configuration has in its "uses"
-- field. The return values are a list of tables. Each table in that list contains the following:
@@ -469,27 +469,27 @@
local dstArray = {};
local foundList = {};
foundList[cfg.project.name:lower()] = true;
-
+
--First, follow the uses recursively.
getprojrec(dstArray, foundList, cfg, cfgname, "uses", false);
-
+
--Next, go through all of the usage projects and recursively get their links.
--But only if they're not already there. Get the links as linkage-only.
local linkArray = {};
for prjName, prjEntry in pairs(dstArray) do
- getprojrec(linkArray, foundList, prjEntry.usageProj.__configs[cfgname], cfgname,
+ getprojrec(linkArray, foundList, prjEntry.usageProj.__configs[cfgname], cfgname,
"links", true);
end
-
+
--Copy from linkArray into dstArray.
for prjName, prjEntry in pairs(linkArray) do
dstArray[prjName] = prjEntry;
end
-
+
return dstArray;
end
-
-
+
+
local function isnameofproj(cfg, strName)
local sln = cfg.project.solution;
local strTest = strName:lower();
@@ -498,18 +498,18 @@
return true;
end
end
-
+
return false;
end
-
-
+
+
--
-- Copies the field from dstCfg to srcCfg.
--
local function copydependentfield(srcCfg, dstCfg, strSrcField)
local srcField = premake.fields[strSrcField];
local strDstField = strSrcField;
-
+
if type(srcCfg[strSrcField]) == "table" then
--handle paths.
if (srcField.kind == "dirlist" or srcField.kind == "filelist") and
@@ -543,8 +543,8 @@
end
end
end
-
-
+
+
--
-- This function will take the list of project entries and apply their usage project data
-- to the given configuration. It will copy compiling information for the projects that are
@@ -552,15 +552,15 @@
-- the source project is not a static library. It won't copy linking information
-- if the project is in this solution; instead it will add that project to the configuration's
-- links field, expecting that Premake will handle the rest.
- --
+ --
local function copyusagedata(cfg, cfgname, linkToProjs)
local myPrj = cfg.project;
local bIsStaticLib = (getCfgKind(cfg) == "StaticLib");
-
+
for prjName, prjEntry in pairs(linkToProjs) do
local srcPrj = prjEntry.usageProj;
local srcCfg = srcPrj.__configs[cfgname];
-
+
for name, field in pairs(premake.fields) do
if(srcCfg[name]) then
if(field.usagecopy) then
@@ -577,7 +577,7 @@
end
end
end
-
+
if((not bIsStaticLib) and prjEntry.proj) then
table.insert(cfg.links, prjEntry.proj.name);
end
@@ -588,9 +588,9 @@
--
-- Main function, controls the process of flattening the configurations.
--
-
+
function premake.bake.buildconfigs()
-
+
-- convert project path fields to be relative to project location
for sln in premake.solution.each() do
for _, prj in ipairs(sln.projects) do
@@ -602,9 +602,9 @@
end
sln.location = sln.location or sln.basedir
end
-
+
-- collapse configuration blocks, so that there is only one block per build
- -- configuration/platform pair, filtered to the current operating environment
+ -- configuration/platform pair, filtered to the current operating environment
for sln in premake.solution.each() do
local basis = collapse(sln)
for _, prj in ipairs(sln.projects) do
@@ -613,8 +613,8 @@
bake.postprocess(prj, cfg)
end
end
- end
-
+ end
+
-- This loop finds the projects that a configuration is connected to
-- via its "uses" field. It will then copy any usage project information from that
-- usage project to the configuration in question.
@@ -627,7 +627,7 @@
end
end
end
- end
+ end
-- Remove all usage projects.
for sln in premake.solution.each() do
@@ -637,20 +637,20 @@
table.insert(removeList, 1, index); --Add in reverse order.
end
end
-
+
for _, index in ipairs(removeList) do
table.remove(sln.projects, index);
end
end
-
+
-- assign unique object directories to each configuration
builduniquedirs()
-
+
-- walk it again and build the targets and unique directories
buildtargets(cfg)
end
-
+
--
-- Post-process a project configuration, applying path fix-ups and other adjustments
@@ -666,10 +666,10 @@
cfg.project = prj
cfg.shortname = premake.getconfigname(cfg.name, cfg.platform, true)
cfg.longname = premake.getconfigname(cfg.name, cfg.platform)
-
+
-- set the project location, if not already set
cfg.location = cfg.location or cfg.basedir
-
+
-- figure out the target system
local platform = premake.platforms[cfg.platform]
if platform.iscrosscompiler then
@@ -677,12 +677,12 @@
else
cfg.system = os.get()
end
-
+
-- adjust the kind as required by the target system
if cfg.kind == "SharedLib" and platform.nosharedlibs then
cfg.kind = "StaticLib"
end
-
+
-- remove excluded files from the file list
local files = { }
for _, fname in ipairs(cfg.files) do
@@ -691,14 +691,14 @@
excluded = (fname == exclude)
if (excluded) then break end
end
-
+
if (not excluded) then
table.insert(files, fname)
end
end
cfg.files = files
- -- fixup the data
+ -- fixup the data
for name, field in pairs(premake.fields) do
-- re-key flag fields for faster lookups
if field.isflags then
diff --git a/src/base/cmdline.lua b/src/base/cmdline.lua
index 5bfe02d..0dda002 100644
--- a/src/base/cmdline.lua
+++ b/src/base/cmdline.lua
@@ -9,7 +9,7 @@
-- Built-in command line options
--
- newoption
+ newoption
{
trigger = "cc",
value = "VALUE",
@@ -38,13 +38,13 @@
value = "FILE",
description = "Read FILE as a Premake script; default is 'premake4.lua'"
}
-
+
newoption
{
trigger = "help",
description = "Display this information"
}
-
+
newoption
{
trigger = "os",
@@ -75,14 +75,14 @@
{ "xbox360", "Xbox 360 (experimental)" },
}
}
-
+
newoption
{
trigger = "scripts",
value = "path",
description = "Search for additional scripts on the given path"
}
-
+
newoption
{
trigger = "version",
@@ -94,4 +94,3 @@
trigger = "generate_user",
description = "Generate (and remove when cleaning) .user VStudio files"
}
- \ No newline at end of file
diff --git a/src/base/config.lua b/src/base/config.lua
index 4be034a..949da97 100644
--- a/src/base/config.lua
+++ b/src/base/config.lua
@@ -11,7 +11,7 @@
local config = premake.config
---
+--
-- Determine if a configuration represents a "debug" or "release" build.
-- This controls the runtime library selected for Visual Studio builds
-- (and might also be useful elsewhere).
@@ -32,10 +32,10 @@
--
-- Determines if this configuration can be linked incrementally.
---
-
+--
+
function premake.config.isincrementallink(cfg)
- if cfg.kind == "StaticLib"
+ if cfg.kind == "StaticLib"
or config.isoptimizedbuild(cfg.flags)
or cfg.flags.NoIncrementalLink then
return false
@@ -45,11 +45,11 @@
--
--- Determine if this configuration uses one of the optimize flags.
--- Optimized builds get different treatment, such as full linking
+-- Determine if this configuration uses one of the optimize flags.
+-- Optimized builds get different treatment, such as full linking
-- instead of incremental.
--
-
+
function premake.config.isoptimizedbuild(flags)
return flags.Optimize or flags.OptimizeSize or flags.OptimizeSpeed
end
diff --git a/src/base/globals.lua b/src/base/globals.lua
index 99c8ac7..a0253b9 100644
--- a/src/base/globals.lua
+++ b/src/base/globals.lua
@@ -3,43 +3,43 @@
-- Global tables and variables, replacements and extensions to Lua's global functions.
-- Copyright (c) 2002-2009 Jason Perkins and the Premake project
--
-
-
+
+
-- A top-level namespace for support functions
premake = { }
-
+
-- The list of supported platforms; also update list in cmdline.lua
- premake.platforms =
+ premake.platforms =
{
- Native =
- {
+ Native =
+ {
cfgsuffix = "",
},
- x32 =
- {
+ x32 =
+ {
cfgsuffix = "32",
},
- x64 =
- {
+ x64 =
+ {
cfgsuffix = "64",
},
- Universal =
- {
+ Universal =
+ {
cfgsuffix = "univ",
},
- Universal32 =
- {
+ Universal32 =
+ {
cfgsuffix = "univ32",
},
- Universal64 =
- {
+ Universal64 =
+ {
cfgsuffix = "univ64",
},
- PS3 =
- {
+ PS3 =
+ {
cfgsuffix = "ps3",
iscrosscompiler = true,
nosharedlibs = true,
@@ -51,8 +51,8 @@
iscrosscompiler = true,
namestyle = "PS3",
},
- Xbox360 =
- {
+ Xbox360 =
+ {
cfgsuffix = "xbox360",
iscrosscompiler = true,
namestyle = "windows",
@@ -83,14 +83,14 @@
-- use the absolute path to the script file, to avoid any file name
-- ambiguity if an error should arise
_SCRIPT = path.getabsolute(fname)
-
+
-- switch the working directory to the new script location
local newcwd = path.getdirectory(_SCRIPT)
os.chdir(newcwd)
-
+
-- run the chunk. How can I catch variable return values?
local a, b, c, d, e, f = builtin_dofile(_SCRIPT)
-
+
-- restore the previous working directory when done
_SCRIPT = oldfile
os.chdir(oldcwd)
@@ -110,9 +110,9 @@
return falseval
end
end
-
-
-
+
+
+
--
-- A shortcut for including another "premake4.lua" file, often used for projects.
--
@@ -131,14 +131,14 @@
print(string.format(msg, unpack(arg)))
end
-
-
+
+
--
-- An extension to type() to identify project object types by reading the
-- "__type" field from the metatable.
--
- local builtin_type = type
+ local builtin_type = type
function type(t)
local mt = getmetatable(t)
if (mt) then
@@ -148,4 +148,3 @@
end
return builtin_type(t)
end
- \ No newline at end of file
diff --git a/src/base/help.lua b/src/base/help.lua
index 2235826..7998ff3 100644
--- a/src/base/help.lua
+++ b/src/base/help.lua
@@ -6,7 +6,7 @@
function premake.showhelp()
-
+
-- display the basic usage
printf("Premake %s, a build script generator", _PREMAKE_VERSION)
printf(_PREMAKE_COPYRIGHT)
@@ -15,7 +15,7 @@
printf("Usage: premake4 [options] action [arguments]")
printf("")
-
+
-- display all options
printf("OPTIONS")
printf("")
@@ -24,8 +24,8 @@
local description = option.description
if (option.value) then trigger = trigger .. "=" .. option.value end
if (option.allowed) then description = description .. "; one of:" end
-
- printf(" --%-15s %s", trigger, description)
+
+ printf(" --%-15s %s", trigger, description)
if (option.allowed) then
for _, value in ipairs(option.allowed) do
printf(" %-14s %s", value[1], value[2])
@@ -45,7 +45,7 @@
-- see more
printf("For additional information, see http://industriousone.com/premake")
-
+
end
diff --git a/src/base/io.lua b/src/base/io.lua
index b694adf..164647e 100644
--- a/src/base/io.lua
+++ b/src/base/io.lua
@@ -6,16 +6,16 @@
--
--- Prepare to capture the output from all subsequent calls to io.printf(),
+-- Prepare to capture the output from all subsequent calls to io.printf(),
-- used for automated testing of the generators.
--
function io.capture()
io.captured = ''
end
-
-
-
+
+
+
--
-- Returns the captured text and stops capturing.
--
@@ -25,8 +25,8 @@
io.captured = nil
return captured
end
-
-
+
+
--
-- Open an overload of the io.open() function, which will create any missing
-- subdirectories in the filename if "mode" is set to writeable.
@@ -48,7 +48,7 @@
---
+--
-- A shortcut for printing formatted output to an output stream.
--
@@ -66,7 +66,7 @@
else
s = string.format(msg, unpack(arg))
end
-
+
if io.captured then
io.captured = io.captured .. s .. io.eol
else
diff --git a/src/base/solution.lua b/src/base/solution.lua
index 5094ede..5d69c5f 100644
--- a/src/base/solution.lua
+++ b/src/base/solution.lua
@@ -25,12 +25,12 @@
-- add to master list keyed by both name and index
table.insert(premake.solution.list, sln)
premake.solution.list[name] = sln
-
+
-- attach a type descriptor
setmetatable(sln, { __type="solution" })
sln.name = name
- sln.basedir = os.getcwd()
+ sln.basedir = os.getcwd()
sln.projects = { }
sln.blocks = { }
sln.configurations = { }
@@ -106,7 +106,7 @@
-- the global (not configuration specific) settings collapsed
local prj = sln.projects[idx]
local cfg = premake.getconfig(prj)
-
+
-- root configuration doesn't have a name; use the project's
cfg.name = prj.name
return cfg
diff --git a/src/base/string.lua b/src/base/string.lua
index 56fae4d..4163f72 100644
--- a/src/base/string.lua
+++ b/src/base/string.lua
@@ -8,7 +8,7 @@
--
-- Returns an array of strings, each of which is a substring of s
-- formed by splitting on boundaries formed by `pattern`.
---
+--
function string.explode(s, pattern, plain)
if (pattern == '') then return false end
@@ -21,7 +21,7 @@
table.insert(arr, s:sub(pos))
return arr
end
-
+
--
@@ -36,7 +36,7 @@
until (not next)
if (curr > 0) then
return curr
- end
+ end
end
diff --git a/src/base/table.lua b/src/base/table.lua
index 3076cb0..93cae03 100644
--- a/src/base/table.lua
+++ b/src/base/table.lua
@@ -3,7 +3,7 @@
-- Additions to Lua's built-in table functions.
-- Copyright (c) 2002-2008 Jason Perkins and the Premake project
--
-
+
--
-- Returns true if the table contains the specified value.
@@ -17,8 +17,8 @@
end
return false
end
-
-
+
+
--
-- Enumerates an array of objects and returns a new table containing
-- only the value of one particular field.
@@ -31,8 +31,8 @@
end
return result
end
-
-
+
+
--
-- Flattens a hierarchy of tables into a single array containing all
@@ -41,7 +41,7 @@
function table.flatten(arr)
local result = { }
-
+
local function flatten(arr)
for _, v in ipairs(arr) do
if type(v) == "table" then
@@ -51,7 +51,7 @@
end
end
end
-
+
flatten(arr)
return result
end
@@ -75,7 +75,7 @@
--
-- Inserts a value of array of values into a table. If the value is
--- itself a table, its contents are enumerated and added instead. So
+-- itself a table, its contents are enumerated and added instead. So
-- these inputs give these outputs:
--
-- "x" -> { "x" }
@@ -154,7 +154,7 @@
end
return result
end
-
+
--
@@ -177,5 +177,4 @@
end
return result
end
-
- \ No newline at end of file
+
diff --git a/src/base/tree.lua b/src/base/tree.lua
index 73c85af..d4947f8 100644
--- a/src/base/tree.lua
+++ b/src/base/tree.lua
@@ -43,7 +43,7 @@
if p == "." then
return tr
end
-
+
-- Look for the immediate parent for this new node, creating it if necessary.
-- Recurses to create as much of the tree as necessary.
local parentnode = tree.add(tr, path.getdirectory(p), onaddfunc)
@@ -53,7 +53,7 @@
if childname == ".." then
return parentnode
end
-
+
-- Create the child if necessary. If two children with the same name appear
-- at the same level, make sure they have the same path to prevent conflicts
-- i.e. ../Common and ../../Common can both appear at the top of the tree
@@ -66,7 +66,7 @@
onaddfunc(childnode)
end
end
-
+
return childnode
end
@@ -176,32 +176,32 @@
-- process an individual node
donode = function(node, fn, depth)
- if node.isremoved then
- return
+ if node.isremoved then
+ return
end
- if fn.onnode then
- fn.onnode(node, depth)
+ if fn.onnode then
+ fn.onnode(node, depth)
end
-
+
if #node.children > 0 then
if fn.onbranchenter then
fn.onbranchenter(node, depth)
end
- if fn.onbranch then
- fn.onbranch(node, depth)
+ if fn.onbranch then
+ fn.onbranch(node, depth)
end
dochildren(node, fn, depth + 1)
if fn.onbranchexit then
fn.onbranchexit(node, depth)
end
else
- if fn.onleaf then
- fn.onleaf(node, depth)
+ if fn.onleaf then
+ fn.onleaf(node, depth)
end
end
end
-
+
-- this goofy iterator allows nodes to be removed during the traversal
dochildren = function(parent, fn, depth)
local i = 1
@@ -213,7 +213,7 @@
end
end
end
-
+
-- set a default initial traversal depth, if one wasn't set
if not initialdepth then
initialdepth = 0
diff --git a/src/base/validate.lua b/src/base/validate.lua
index 0274186..82f235f 100644
--- a/src/base/validate.lua
+++ b/src/base/validate.lua
@@ -6,32 +6,32 @@
--
--- Performs a sanity check of all of the solutions and projects
+-- Performs a sanity check of all of the solutions and projects
-- in the session to be sure they meet some minimum requirements.
--
function premake.checkprojects()
local action = premake.action.current()
-
+
for sln in premake.solution.each() do
-
+
-- every solution must have at least one project
if (#sln.projects == 0) then
return nil, "solution '" .. sln.name .. "' needs at least one project"
end
-
+
-- every solution must provide a list of configurations
if (#sln.configurations == 0) then
return nil, "solution '" .. sln.name .. "' needs configurations"
end
-
+
for prj in premake.solution.eachproject(sln) do
-- every project must have a language
if (not prj.language) then
return nil, "project '" ..prj.name .. "' needs a language"
end
-
+
-- and the action must support it
if (action.valid_languages) then
if (not table.contains(action.valid_languages, prj.language)) then
@@ -39,29 +39,29 @@
end
end
- for cfg in premake.eachconfig(prj) do
-
+ for cfg in premake.eachconfig(prj) do
+
-- every config must have a kind
if (not cfg.kind) then
return nil, "project '" ..prj.name .. "' needs a kind in configuration '" .. cfg.name .. "'"
end
-
+
-- and the action must support it
if (action.valid_kinds) then
if (not table.contains(action.valid_kinds, cfg.kind)) then
return nil, "the " .. action.shortname .. " action does not support " .. cfg.kind .. " projects"
end
end
-
+
end
-
+
-- some actions have custom validation logic
if action.oncheckproject then
action.oncheckproject(prj)
end
-
+
end
- end
+ end
return true
end
@@ -73,10 +73,10 @@
function premake.checktools()
local action = premake.action.current()
- if (not action.valid_tools) then
- return true
+ if (not action.valid_tools) then
+ return true
end
-
+
for tool, values in pairs(action.valid_tools) do
if (_OPTIONS[tool]) then
if (not table.contains(values, _OPTIONS[tool])) then
@@ -86,6 +86,6 @@
_OPTIONS[tool] = values[1]
end
end
-
+
return true
end
diff --git a/src/tools/dotnet.lua b/src/tools/dotnet.lua
index c52d326..31993d3 100644
--- a/src/tools/dotnet.lua
+++ b/src/tools/dotnet.lua
@@ -3,10 +3,10 @@
-- Interface for the C# compilers, all of which are flag compatible.
-- Copyright (c) 2002-2009 Jason Perkins and the Premake project
--
-
+
premake.dotnet = { }
premake.dotnet.namestyle = "windows"
-
+
--
-- Translation of Premake flags into CSC flags
@@ -45,9 +45,9 @@
return "None"
end
end
-
-
-
+
+
+
--
-- Returns the compiler filename (they all use the same arguments)
--
@@ -60,7 +60,7 @@
return "mcs"
elseif (cfg.framework >= "4.0") then
return "dmcs"
- else
+ else
return "gmcs"
end
else
@@ -76,7 +76,7 @@
function premake.dotnet.getflags(cfg)
local result = table.translate(cfg.flags, flags)
- return result
+ return result
end
diff --git a/src/tools/gcc.lua b/src/tools/gcc.lua
index 403f532..2268d7d 100644
--- a/src/tools/gcc.lua
+++ b/src/tools/gcc.lua
@@ -186,8 +186,8 @@
--
--- This is poorly named: returns a list of linker flags for external
--- (i.e. system, or non-sibling) libraries. See bug #1729227 for
+-- This is poorly named: returns a list of linker flags for external
+-- (i.e. system, or non-sibling) libraries. See bug #1729227 for
-- background on why the path must be split.
--
diff --git a/src/tools/msc.lua b/src/tools/msc.lua
index 28e3d8b..383de37 100644
--- a/src/tools/msc.lua
+++ b/src/tools/msc.lua
@@ -4,6 +4,6 @@
-- Copyright (c) 2009 Jason Perkins and the Premake project
--
-
+
premake.msc = { }
premake.msc.namestyle = "windows"
diff --git a/src/tools/ow.lua b/src/tools/ow.lua
index 7be8f26..2104550 100644
--- a/src/tools/ow.lua
+++ b/src/tools/ow.lua
@@ -6,8 +6,8 @@
premake.ow = { }
premake.ow.namestyle = "windows"
-
-
+
+
--
-- Set default tools
--
@@ -15,8 +15,8 @@
premake.ow.cc = "WCL386"
premake.ow.cxx = "WCL386"
premake.ow.ar = "ar"
-
-
+
+
--
-- Translation of Premake flags into OpenWatcom flags
--
@@ -38,22 +38,22 @@
NoExceptions = "-xd",
NoRTTI = "-xr",
}
-
+
--
-- No specific platform support yet
--
- premake.ow.platforms =
+ premake.ow.platforms =
{
- Native = {
- flags = ""
+ Native = {
+ flags = ""
},
}
-
+
--
-- Returns a list of compiler flags, based on the supplied configuration.
--
@@ -63,18 +63,18 @@
end
function premake.ow.getcflags(cfg)
- local result = table.translate(cfg.flags, cflags)
+ local result = table.translate(cfg.flags, cflags)
if (cfg.flags.Symbols) then
table.insert(result, "-hw") -- Watcom debug format for Watcom debugger
end
- return result
+ return result
end
-
+
function premake.ow.getcxxflags(cfg)
local result = table.translate(cfg.flags, cxxflags)
return result
end
-
+
--
@@ -83,17 +83,17 @@
function premake.ow.getldflags(cfg)
local result = { }
-
+
if (cfg.flags.Symbols) then
table.insert(result, "op symf")
end
-
+
return result
end
-
-
+
+
--
--- Returns a list of linker flags for library search directories and
+-- Returns a list of linker flags for library search directories and
-- library names.
--
@@ -101,8 +101,8 @@
local result = { }
return result
end
-
-
+
+
--
-- Decorate defines for the command line.
@@ -117,7 +117,7 @@
end
-
+
--
-- Decorate include file search paths for the command line.
--
diff --git a/src/tools/snc.lua b/src/tools/snc.lua
index e829d68..4596e61 100644
--- a/src/tools/snc.lua
+++ b/src/tools/snc.lua
@@ -4,9 +4,9 @@
-- Copyright (c) 2010 Jason Perkins and the Premake project
--
-
+
premake.snc = { }
-
+
-- TODO: Will cfg.system == "windows" ever be true for SNC? If
-- not, remove the conditional blocks that use this test.
@@ -18,8 +18,8 @@
premake.snc.cc = "snc"
premake.snc.cxx = "g++"
premake.snc.ar = "ar"
-
-
+
+
--
-- Translation of Premake flags into SNC flags
--
@@ -35,13 +35,13 @@
NoExceptions = "", -- No exceptions is the default in the SNC compiler.
NoRTTI = "-Xc-=rtti",
}
-
-
+
+
--
-- Map platforms to flags
--
- premake.snc.platforms =
+ premake.snc.platforms =
{
PS3 = {
cc = "ppu-lv2-g++",
@@ -52,7 +52,7 @@
}
local platforms = premake.snc.platforms
-
+
--
-- Returns a list of compiler flags, based on the supplied configuration.
@@ -70,15 +70,15 @@
if cfg.kind == "SharedLib" then
table.insert(result, "-fPIC")
end
-
- return result
+
+ return result
end
-
+
function premake.snc.getcxxflags(cfg)
local result = table.translate(cfg.flags, cxxflags)
return result
end
-
+
--
@@ -87,29 +87,29 @@
function premake.snc.getldflags(cfg)
local result = { }
-
+
if not cfg.flags.Symbols then
table.insert(result, "-s")
end
-
+
if cfg.kind == "SharedLib" then
- table.insert(result, "-shared")
+ table.insert(result, "-shared")
if not cfg.flags.NoImportLib then
table.insert(result, '-Wl,--out-implib="' .. cfg.linktarget.fullpath .. '"')
end
end
-
+
local platform = platforms[cfg.platform]
table.insert(result, platform.flags)
table.insert(result, platform.ldflags)
-
+
return result
end
-
+
--
-- Return a list of library search paths. Technically part of LDFLAGS but need to
--- be separated because of the way Visual Studio calls SNC for the PS3. See bug
+-- be separated because of the way Visual Studio calls SNC for the PS3. See bug
-- #1729227 for background on why library paths must be split.
--
@@ -120,12 +120,12 @@
end
return result
end
-
+
--
- -- This is poorly named: returns a list of linker flags for external
- -- (i.e. system, or non-sibling) libraries. See bug #1729227 for
+ -- This is poorly named: returns a list of linker flags for external
+ -- (i.e. system, or non-sibling) libraries. See bug #1729227 for
-- background on why the path must be split.
--
@@ -136,8 +136,8 @@
end
return result
end
-
-
+
+
--
-- Decorate defines for the SNC command line.
@@ -152,7 +152,7 @@
end
-
+
--
-- Decorate include file search paths for the SNC command line.
--