diff options
Diffstat (limited to 'src/actions/codelite')
-rw-r--r-- | src/actions/codelite/_codelite.lua | 14 | ||||
-rw-r--r-- | src/actions/codelite/codelite_project.lua | 34 | ||||
-rw-r--r-- | src/actions/codelite/codelite_workspace.lua | 6 |
3 files changed, 27 insertions, 27 deletions
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 |