codelite.lua 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. --
  2. -- Name: codelite/codelite.lua
  3. -- Purpose: Define the CodeLite action(s).
  4. -- Author: Ryan Pusztai
  5. -- Modified by: Andrea Zanellato
  6. -- Andrew Gough
  7. -- Manu Evans
  8. -- Jason Perkins
  9. -- Created: 2013/05/06
  10. -- Copyright: (c) 2008-2020 Jason Perkins and the Premake project
  11. --
  12. local p = premake
  13. p.modules.codelite = {}
  14. p.modules.codelite._VERSION = p._VERSION
  15. local codelite = p.modules.codelite
  16. local project = p.project
  17. function codelite.cfgname(cfg)
  18. local cfgname = cfg.buildcfg
  19. if codelite.workspace.multiplePlatforms then
  20. -- Codelite breaks if "|" is used here, see #1411
  21. cfgname = string.format("%s-%s", cfg.platform, cfg.buildcfg)
  22. end
  23. return cfgname
  24. end
  25. -- Element text is not escaped the same as element attributes
  26. function codelite.escElementText(value)
  27. local result = value:gsub('&', '&')
  28. result = result:gsub('<', '&lt;')
  29. result = result:gsub('>', '&gt;')
  30. return result
  31. end
  32. function codelite.esc(value)
  33. local result = value:gsub('&', '&amp;')
  34. result = result:gsub('<', '&lt;')
  35. result = result:gsub('>', '&gt;')
  36. result = result:gsub('"', '&quot;')
  37. return result
  38. end
  39. function codelite.generateWorkspace(wks)
  40. p.eol("\r\n")
  41. p.indent(" ")
  42. p.escaper(codelite.esc)
  43. p.generate(wks, ".workspace", codelite.workspace.generate)
  44. end
  45. function codelite.generateProject(prj)
  46. p.eol("\r\n")
  47. p.indent(" ")
  48. p.escaper(codelite.esc)
  49. if project.isc(prj) or project.iscpp(prj) then
  50. p.generate(prj, ".project", codelite.project.generate)
  51. end
  52. end
  53. function codelite.cleanWorkspace(wks)
  54. p.clean.file(wks, wks.name .. ".workspace")
  55. p.clean.file(wks, wks.name .. "_wsp.mk")
  56. p.clean.file(wks, wks.name .. ".tags")
  57. p.clean.file(wks, ".clang")
  58. end
  59. function codelite.cleanProject(prj)
  60. p.clean.file(prj, prj.name .. ".project")
  61. p.clean.file(prj, prj.name .. ".mk")
  62. p.clean.file(prj, prj.name .. ".list")
  63. p.clean.file(prj, prj.name .. ".out")
  64. end
  65. function codelite.cleanTarget(prj)
  66. -- TODO..
  67. end
  68. include("codelite_workspace.lua")
  69. include("codelite_project.lua")
  70. return codelite