Began porting to solution object
This commit is contained in:
parent
03b9eb3deb
commit
293e2353ba
@ -19,6 +19,7 @@
|
||||
"base/action.lua",
|
||||
"base/option.lua",
|
||||
"base/tree.lua",
|
||||
"base/solution.lua",
|
||||
"base/project.lua",
|
||||
"base/configs.lua",
|
||||
"base/api.lua",
|
||||
|
@ -9,7 +9,7 @@
|
||||
_p('<CodeBlocks_workspace_file>')
|
||||
_p('\t<Workspace title="%s">', sln.name)
|
||||
|
||||
for prj in premake.eachproject(sln) do
|
||||
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"', '')
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
_p('Microsoft Visual Studio Solution File, Format Version 7.00')
|
||||
|
||||
-- Write out the list of project entries
|
||||
for prj in premake.eachproject(sln) do
|
||||
for prj in premake.solution.eachproject(sln) do
|
||||
local projpath = path.translate(path.getrelative(sln.location, _VS.projectfile(prj)))
|
||||
_p('Project("{%s}") = "%s", "%s", "{%s}"', _VS.tool(prj), prj.name, projpath, prj.uuid)
|
||||
_p('EndProject')
|
||||
@ -30,7 +30,7 @@
|
||||
_p('\tEndGlobalSection')
|
||||
|
||||
_p('\tGlobalSection(ProjectConfiguration) = postSolution')
|
||||
for prj in premake.eachproject(sln) do
|
||||
for prj in premake.solution.eachproject(sln) do
|
||||
for _, cfgname in ipairs(sln.configurations) do
|
||||
_p('\t\t{%s}.%s.ActiveCfg = %s|%s', prj.uuid, cfgname, cfgname, _VS.arch(prj))
|
||||
_p('\t\t{%s}.%s.Build.0 = %s|%s', prj.uuid, cfgname, cfgname, _VS.arch(prj))
|
||||
|
@ -13,7 +13,7 @@
|
||||
_p('Microsoft Visual Studio Solution File, Format Version 8.00')
|
||||
|
||||
-- Write out the list of project entries
|
||||
for prj in premake.eachproject(sln) do
|
||||
for prj in premake.solution.eachproject(sln) do
|
||||
local projpath = path.translate(path.getrelative(sln.location, _VS.projectfile(prj)))
|
||||
_p('Project("{%s}") = "%s", "%s", "{%s}"', _VS.tool(prj), prj.name, projpath, prj.uuid)
|
||||
|
||||
@ -40,7 +40,7 @@
|
||||
_p('\tEndGlobalSection')
|
||||
|
||||
_p('\tGlobalSection(ProjectConfiguration) = postSolution')
|
||||
for prj in premake.eachproject(sln) do
|
||||
for prj in premake.solution.eachproject(sln) do
|
||||
for _, cfgname in ipairs(sln.configurations) do
|
||||
_p('\t\t{%s}.%s.ActiveCfg = %s|%s', prj.uuid, cfgname, cfgname, _VS.arch(prj))
|
||||
_p('\t\t{%s}.%s.Build.0 = %s|%s', prj.uuid, cfgname, cfgname, _VS.arch(prj))
|
||||
|
@ -19,7 +19,7 @@
|
||||
_p('# Visual Studio %s', iif(_ACTION == 'vs2005', '2005', '2008'))
|
||||
|
||||
-- Write out the list of project entries
|
||||
for prj in premake.eachproject(sln) do
|
||||
for prj in premake.solution.eachproject(sln) do
|
||||
-- Build a relative path from the solution file to the project file
|
||||
local projpath = path.translate(path.getrelative(sln.location, _VS.projectfile(prj)), "\\")
|
||||
|
||||
@ -66,7 +66,7 @@
|
||||
|
||||
function premake.vs2005_solution_project_platforms(sln)
|
||||
_p('\tGlobalSection(ProjectConfigurationPlatforms) = postSolution')
|
||||
for prj in premake.eachproject(sln) do
|
||||
for prj in premake.solution.eachproject(sln) do
|
||||
for _, cfg in ipairs(sln.vstudio_configs) do
|
||||
|
||||
-- .NET projects always map to the "Any CPU" platform (for now, at
|
||||
|
@ -26,7 +26,7 @@
|
||||
-- node goes with which project for later reference
|
||||
local tr = tree.new(sln.name)
|
||||
local prjnodes = {}
|
||||
for prj in premake.eachproject(sln) do
|
||||
for prj in premake.solution.eachproject(sln) do
|
||||
prjnodes[prj] = tree.insert(tr, premake.project.buildsourcetree(prj))
|
||||
end
|
||||
|
||||
@ -68,7 +68,7 @@
|
||||
-- Only add it to the tree if there are frameworks in use.
|
||||
tr.frameworks = tree.new("Frameworks")
|
||||
frameworks = { } -- remember which frameworks have already been added
|
||||
for prj in premake.eachproject(sln) do
|
||||
for prj in premake.solution.eachproject(sln) do
|
||||
for cfg in premake.eachconfig(prj) do
|
||||
for _, link in ipairs(cfg.links) do
|
||||
local name = path.getname(link)
|
||||
@ -88,7 +88,7 @@
|
||||
-- the special folder "Products" lists all of the generated targets, one target
|
||||
-- for each target kind (ConsoleApp, SharedLibrary, etc.) produced by a project.
|
||||
tr.products = tree.insert(tr, tree.new("Products"))
|
||||
for prj in premake.eachproject(sln) do
|
||||
for prj in premake.solution.eachproject(sln) do
|
||||
local kinds = {} -- remember which kinds have already been added
|
||||
for cfg in premake.eachconfig(prj) do
|
||||
if not kinds[cfg.kind] then
|
||||
|
@ -55,7 +55,7 @@
|
||||
if a.onsolution then
|
||||
a.onsolution(sln)
|
||||
end
|
||||
for prj in premake.eachproject(sln) do
|
||||
for prj in premake.solution.eachproject(sln) do
|
||||
if a.onproject then
|
||||
a.onproject(prj)
|
||||
end
|
||||
|
@ -69,28 +69,6 @@
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Iterator for a solution's projects, or rather project root configurations.
|
||||
-- These configuration objects include all settings related to the project,
|
||||
-- regardless of where they were originally specified.
|
||||
--
|
||||
|
||||
function premake.eachproject(sln)
|
||||
local i = 0
|
||||
return function ()
|
||||
i = i + 1
|
||||
if (i <= #sln.projects) then
|
||||
local prj = sln.projects[i]
|
||||
local cfg = premake.getconfig(prj)
|
||||
cfg.name = prj.name
|
||||
cfg.blocks = prj.blocks
|
||||
return cfg
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Apply XML escaping to a value.
|
||||
--
|
||||
@ -541,7 +519,7 @@
|
||||
--
|
||||
|
||||
function premake.hascppproject(sln)
|
||||
for prj in premake.eachproject(sln) do
|
||||
for prj in premake.solution.eachproject(sln) do
|
||||
if premake.iscppproject(prj) then
|
||||
return true
|
||||
end
|
||||
@ -555,7 +533,7 @@
|
||||
--
|
||||
|
||||
function premake.hasdotnetproject(sln)
|
||||
for prj in premake.eachproject(sln) do
|
||||
for prj in premake.solution.eachproject(sln) do
|
||||
if premake.isdotnetproject(prj) then
|
||||
return true
|
||||
end
|
||||
|
50
src/base/solution.lua
Normal file
50
src/base/solution.lua
Normal file
@ -0,0 +1,50 @@
|
||||
--
|
||||
-- solution.lua
|
||||
-- Work with the list of solutions loaded from the script.
|
||||
-- Copyright (c) 2002-2009 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
premake.solution = { }
|
||||
|
||||
|
||||
--
|
||||
-- Iterate over the projects of a solution.
|
||||
--
|
||||
-- @param sln
|
||||
-- The solution.
|
||||
-- @returns
|
||||
-- An iterator function.
|
||||
--
|
||||
|
||||
function premake.solution.eachproject(sln)
|
||||
local i = 0
|
||||
return function ()
|
||||
i = i + 1
|
||||
if (i <= #sln.projects) then
|
||||
return premake.solution.getproject(sln, i)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Retrieve the project at a particular index.
|
||||
--
|
||||
-- @param sln
|
||||
-- The solution.
|
||||
-- @param idx
|
||||
-- An index into the array of projects.
|
||||
-- @returns
|
||||
-- The project at the given index.
|
||||
--
|
||||
|
||||
function premake.solution.getproject(sln, idx)
|
||||
-- retrieve the root configuration of the project, with all of
|
||||
-- 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
|
||||
end
|
@ -25,7 +25,7 @@
|
||||
return nil, "solution '" .. sln.name .. "' needs configurations"
|
||||
end
|
||||
|
||||
for prj in premake.eachproject(sln) do
|
||||
for prj in premake.solution.eachproject(sln) do
|
||||
|
||||
-- every project must have a language
|
||||
if (not prj.language) then
|
||||
|
@ -24,13 +24,8 @@
|
||||
local function prepare()
|
||||
io.capture()
|
||||
premake.buildconfigs()
|
||||
|
||||
local prj = sln.projects[1]
|
||||
local cfg = premake.getconfig(prj)
|
||||
cfg.name = prj.name
|
||||
cfg.blocks = prj.blocks
|
||||
|
||||
tr = xcode.buildprjtree(cfg)
|
||||
local prj = premake.solution.getproject(sln, 1)
|
||||
tr = xcode.buildprjtree(prj)
|
||||
end
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user