-- -- Name: codelite/codelite_workspace.lua -- Purpose: Generate a CodeLite workspace. -- Author: Ryan Pusztai -- Modified by: Andrea Zanellato -- Manu Evans -- Created: 2013/05/06 -- Copyright: (c) 2008-2015 Jason Perkins and the Premake project -- local p = premake local project = p.project local workspace = p.workspace local tree = p.tree local codelite = p.modules.codelite codelite.workspace = {} local m = codelite.workspace -- -- Generate a CodeLite workspace -- function m.generate(wks) p.utf8() -- -- Header -- p.w('') local tagsdb = "" -- local tagsdb = "./" .. wks.name .. ".tags" p.push('', wks.name, tagsdb) -- -- Project list -- local tr = workspace.grouptree(wks) tree.traverse(tr, { onleaf = function(n) local prj = n.project -- Build a relative path from the workspace file to the project file local prjpath = p.filename(prj, ".project") prjpath = path.getrelative(prj.workspace.location, prjpath) if (prj.name == wks.startproject) then p.w('', prj.name, prjpath) else p.w('', prj.name, prjpath) end end, onbranchenter = function(n) p.push('', n.name) end, onbranchexit = function(n) p.pop('') end, }) -- -- Configurations -- -- count the number of platforms local platformsPresent = {} local numPlatforms = 0 for cfg in workspace.eachconfig(wks) do local platform = cfg.platform if platform and not platformsPresent[platform] then numPlatforms = numPlatforms + 1 platformsPresent[platform] = true end end if numPlatforms >= 2 then codelite.workspace.multiplePlatforms = true end -- for each workspace config p.push('') for cfg in workspace.eachconfig(wks) do local cfgname = codelite.cfgname(cfg) p.push('', cfgname) local tr = workspace.grouptree(wks) tree.traverse(tr, { onleaf = function(n) local prj = n.project p.w('', prj.name, cfgname) end }) p.pop('') end p.pop('') p.pop('') end