More easy sln to wks renames
This commit is contained in:
parent
bf3e68287c
commit
d1ea0e81b1
@ -101,13 +101,13 @@
|
||||
|
||||
function make.getmakefilename(this, searchprjs)
|
||||
local count = 0
|
||||
for sln in p.global.eachWorkspace() do
|
||||
if sln.location == this.location then
|
||||
for wks in p.global.eachWorkspace() do
|
||||
if wks.location == this.location then
|
||||
count = count + 1
|
||||
end
|
||||
|
||||
if searchprjs then
|
||||
for _, prj in ipairs(sln.projects) do
|
||||
for _, prj in ipairs(wks.projects) do
|
||||
if prj.location == this.location then
|
||||
count = count + 1
|
||||
end
|
||||
|
@ -14,20 +14,20 @@
|
||||
-- Generate a GNU make "workspace" makefile, with support for the new platforms API.
|
||||
--
|
||||
|
||||
function make.generate_solution(sln)
|
||||
function make.generate_solution(wks)
|
||||
premake.eol("\n")
|
||||
|
||||
make.header(sln)
|
||||
make.header(wks)
|
||||
|
||||
make.configmap(sln)
|
||||
make.projects(sln)
|
||||
make.configmap(wks)
|
||||
make.projects(wks)
|
||||
|
||||
make.solutionPhonyRule(sln)
|
||||
make.groupRules(sln)
|
||||
make.solutionPhonyRule(wks)
|
||||
make.groupRules(wks)
|
||||
|
||||
make.projectrules(sln)
|
||||
make.cleanrules(sln)
|
||||
make.helprule(sln)
|
||||
make.projectrules(wks)
|
||||
make.cleanrules(wks)
|
||||
make.helprule(wks)
|
||||
end
|
||||
|
||||
|
||||
@ -36,10 +36,10 @@
|
||||
-- level configurations to the project level equivalents.
|
||||
--
|
||||
|
||||
function make.configmap(sln)
|
||||
for cfg in p.workspace.eachconfig(sln) do
|
||||
function make.configmap(wks)
|
||||
for cfg in p.workspace.eachconfig(wks) do
|
||||
_p('ifeq ($(config),%s)', cfg.shortname)
|
||||
for prj in p.workspace.eachproject(sln) do
|
||||
for prj in p.workspace.eachproject(wks) do
|
||||
local prjcfg = project.getconfig(prj, cfg.buildcfg, cfg.platform)
|
||||
if prjcfg then
|
||||
_p(' %s_config = %s', make.tovar(prj.name), prjcfg.shortname)
|
||||
@ -55,11 +55,11 @@
|
||||
-- Write out the rules for the `make clean` action.
|
||||
--
|
||||
|
||||
function make.cleanrules(sln)
|
||||
function make.cleanrules(wks)
|
||||
_p('clean:')
|
||||
for prj in p.workspace.eachproject(sln) do
|
||||
for prj in p.workspace.eachproject(wks) do
|
||||
local prjpath = premake.filename(prj, make.getmakefilename(prj, true))
|
||||
local prjdir = path.getdirectory(path.getrelative(sln.location, prjpath))
|
||||
local prjdir = path.getdirectory(path.getrelative(wks.location, prjpath))
|
||||
local prjname = path.getname(prjpath)
|
||||
_x(1,'@${MAKE} --no-print-directory -C %s -f %s clean', prjdir, prjname)
|
||||
end
|
||||
@ -71,13 +71,13 @@
|
||||
-- Write out the make file help rule and configurations list.
|
||||
--
|
||||
|
||||
function make.helprule(sln)
|
||||
function make.helprule(wks)
|
||||
_p('help:')
|
||||
_p(1,'@echo "Usage: make [config=name] [target]"')
|
||||
_p(1,'@echo ""')
|
||||
_p(1,'@echo "CONFIGURATIONS:"')
|
||||
|
||||
for cfg in p.workspace.eachconfig(sln) do
|
||||
for cfg in p.workspace.eachconfig(wks) do
|
||||
_x(1, '@echo " %s"', cfg.shortname)
|
||||
end
|
||||
|
||||
@ -87,7 +87,7 @@
|
||||
_p(1,'@echo " all (default)"')
|
||||
_p(1,'@echo " clean"')
|
||||
|
||||
for prj in p.workspace.eachproject(sln) do
|
||||
for prj in p.workspace.eachproject(wks) do
|
||||
_p(1,'@echo " %s"', prj.name)
|
||||
end
|
||||
|
||||
@ -100,8 +100,8 @@
|
||||
-- Write out the list of projects that comprise the workspace.
|
||||
--
|
||||
|
||||
function make.projects(sln)
|
||||
_p('PROJECTS := %s', table.concat(premake.esc(table.extract(sln.projects, "name")), " "))
|
||||
function make.projects(wks)
|
||||
_p('PROJECTS := %s', table.concat(premake.esc(table.extract(wks.projects, "name")), " "))
|
||||
_p('')
|
||||
end
|
||||
|
||||
@ -109,9 +109,9 @@
|
||||
-- Write out the workspace PHONY rule
|
||||
--
|
||||
|
||||
function make.solutionPhonyRule(sln)
|
||||
function make.solutionPhonyRule(wks)
|
||||
local groups = {}
|
||||
local tr = p.workspace.grouptree(sln)
|
||||
local tr = p.workspace.grouptree(wks)
|
||||
tree.traverse(tr, {
|
||||
onbranch = function(n)
|
||||
table.insert(groups, n.path)
|
||||
@ -127,9 +127,9 @@
|
||||
--
|
||||
-- Write out the phony rules representing project groups
|
||||
--
|
||||
function make.groupRules(sln)
|
||||
function make.groupRules(wks)
|
||||
-- Transform workspace groups into target aggregate
|
||||
local tr = p.workspace.grouptree(sln)
|
||||
local tr = p.workspace.grouptree(wks)
|
||||
tree.traverse(tr, {
|
||||
onbranch = function(n)
|
||||
local rule = n.path .. ":"
|
||||
@ -163,8 +163,8 @@
|
||||
-- Write out the rules to build each of the workspace's projects.
|
||||
--
|
||||
|
||||
function make.projectrules(sln)
|
||||
for prj in p.workspace.eachproject(sln) do
|
||||
function make.projectrules(wks)
|
||||
for prj in p.workspace.eachproject(wks) do
|
||||
local deps = project.getdependencies(prj)
|
||||
deps = table.extract(deps, "name")
|
||||
_p('%s:%s', premake.esc(prj.name), make.list(deps))
|
||||
@ -175,7 +175,7 @@
|
||||
_p(1,'@echo "==== Building %s ($(%s_config)) ===="', prj.name, cfgvar)
|
||||
|
||||
local prjpath = premake.filename(prj, make.getmakefilename(prj, true))
|
||||
local prjdir = path.getdirectory(path.getrelative(sln.location, prjpath))
|
||||
local prjdir = path.getdirectory(path.getrelative(wks.location, prjpath))
|
||||
local prjname = path.getname(prjpath)
|
||||
|
||||
_x(1,'@${MAKE} --no-print-directory -C %s -f %s config=$(%s_config)', prjdir, prjname, cfgvar)
|
||||
|
@ -15,12 +15,12 @@
|
||||
-- Register a command-line action for Visual Studio 2006.
|
||||
---
|
||||
|
||||
function vs2005.generateSolution(sln)
|
||||
function vs2005.generateSolution(wks)
|
||||
p.indent("\t")
|
||||
p.eol("\r\n")
|
||||
p.escaper(vs2005.esc)
|
||||
|
||||
premake.generate(sln, ".sln", vstudio.sln2005.generate)
|
||||
premake.generate(wks, ".sln", vstudio.sln2005.generate)
|
||||
end
|
||||
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
-- Return the list of sections contained in the solution.
|
||||
--
|
||||
|
||||
function sln2005.solutionSections(sln)
|
||||
function sln2005.solutionSections(wks)
|
||||
return {
|
||||
"ConfigurationPlatforms",
|
||||
"SolutionProperties",
|
||||
@ -30,17 +30,17 @@
|
||||
-- Generate a Visual Studio 200x solution, with support for the new platforms API.
|
||||
--
|
||||
|
||||
function sln2005.generate(sln)
|
||||
function sln2005.generate(wks)
|
||||
-- Mark the file as Unicode
|
||||
_p('\239\187\191')
|
||||
|
||||
sln2005.reorderProjects(sln)
|
||||
sln2005.reorderProjects(wks)
|
||||
|
||||
sln2005.header()
|
||||
sln2005.projects(sln)
|
||||
sln2005.projects(wks)
|
||||
|
||||
_p('Global')
|
||||
sln2005.sections(sln)
|
||||
sln2005.sections(wks)
|
||||
_p('EndGlobal')
|
||||
|
||||
end
|
||||
@ -68,13 +68,13 @@
|
||||
-- in the IDE will cause the orderings to get rewritten.
|
||||
--
|
||||
|
||||
function sln2005.reorderProjects(sln)
|
||||
if sln.startproject then
|
||||
function sln2005.reorderProjects(wks)
|
||||
if wks.startproject then
|
||||
local np
|
||||
local tr = p.workspace.grouptree(sln)
|
||||
local tr = p.workspace.grouptree(wks)
|
||||
tree.traverse(tr, {
|
||||
onleaf = function(n)
|
||||
if n.project.name == sln.startproject then
|
||||
if n.project.name == wks.startproject then
|
||||
np = n
|
||||
end
|
||||
end
|
||||
@ -95,8 +95,8 @@
|
||||
-- Write out the list of projects and groups contained by the solution.
|
||||
--
|
||||
|
||||
function sln2005.projects(sln)
|
||||
local tr = p.workspace.grouptree(sln)
|
||||
function sln2005.projects(wks)
|
||||
local tr = p.workspace.grouptree(wks)
|
||||
tree.traverse(tr, {
|
||||
onleaf = function(n)
|
||||
local prj = n.project
|
||||
@ -142,12 +142,12 @@
|
||||
-- Write out the tables that map solution configurations to project configurations.
|
||||
--
|
||||
|
||||
function sln2005.configurationPlatforms(sln)
|
||||
function sln2005.configurationPlatforms(wks)
|
||||
|
||||
local descriptors = {}
|
||||
local sorted = {}
|
||||
|
||||
for cfg in p.workspace.eachconfig(sln) do
|
||||
for cfg in p.workspace.eachconfig(wks) do
|
||||
|
||||
-- Create a Visual Studio solution descriptor (i.e. Debug|Win32) for
|
||||
-- this solution configuration. I need to use it in a few different places
|
||||
@ -172,10 +172,10 @@
|
||||
-- Now I can output the sorted list of solution configuration descriptors
|
||||
|
||||
-- Visual Studio assumes the first configurations as the defaults.
|
||||
if sln.defaultplatform then
|
||||
if wks.defaultplatform then
|
||||
_p(1,'GlobalSection(SolutionConfigurationPlatforms) = preSolution')
|
||||
table.foreachi(sorted, function (cfg)
|
||||
if cfg.platform == sln.defaultplatform then
|
||||
if cfg.platform == wks.defaultplatform then
|
||||
_p(2,'%s = %s', descriptors[cfg], descriptors[cfg])
|
||||
end
|
||||
end)
|
||||
@ -184,7 +184,7 @@
|
||||
|
||||
_p(1,'GlobalSection(SolutionConfigurationPlatforms) = preSolution')
|
||||
table.foreachi(sorted, function (cfg)
|
||||
if not sln.defaultplatform or cfg.platform ~= sln.defaultplatform then
|
||||
if not wks.defaultplatform or cfg.platform ~= wks.defaultplatform then
|
||||
_p(2,'%s = %s', descriptors[cfg], descriptors[cfg])
|
||||
end
|
||||
end)
|
||||
@ -194,7 +194,7 @@
|
||||
|
||||
_p(1,"GlobalSection(ProjectConfigurationPlatforms) = postSolution")
|
||||
|
||||
local tr = p.workspace.grouptree(sln)
|
||||
local tr = p.workspace.grouptree(wks)
|
||||
tree.traverse(tr, {
|
||||
onleaf = function(n)
|
||||
local prj = n.project
|
||||
@ -241,7 +241,7 @@
|
||||
-- Write out contents of the SolutionProperties section; currently unused.
|
||||
--
|
||||
|
||||
function sln2005.properties(sln)
|
||||
function sln2005.properties(wks)
|
||||
_p('\tGlobalSection(SolutionProperties) = preSolution')
|
||||
_p('\t\tHideSolutionNode = FALSE')
|
||||
_p('\tEndGlobalSection')
|
||||
@ -253,8 +253,8 @@
|
||||
-- any solution groups.
|
||||
--
|
||||
|
||||
function sln2005.NestedProjects(sln)
|
||||
local tr = p.workspace.grouptree(sln)
|
||||
function sln2005.NestedProjects(wks)
|
||||
local tr = p.workspace.grouptree(wks)
|
||||
if tree.hasbranches(tr) then
|
||||
_p(1,'GlobalSection(NestedProjects) = preSolution')
|
||||
tree.traverse(tr, {
|
||||
@ -285,10 +285,10 @@
|
||||
-- Write out all of the workspace sections.
|
||||
--
|
||||
|
||||
function sln2005.sections(sln)
|
||||
for _, section in ipairs(sln2005.solutionSections(sln)) do
|
||||
function sln2005.sections(wks)
|
||||
for _, section in ipairs(sln2005.solutionSections(wks)) do
|
||||
if sln2005.sectionmap[section] then
|
||||
sln2005.sectionmap[section](sln)
|
||||
sln2005.sectionmap[section](wks)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user