Merged CodeLite support(r591:595)
This commit is contained in:
parent
7d81da1474
commit
be26ccfb9d
@ -34,6 +34,8 @@
|
|||||||
{
|
{
|
||||||
"actions/codeblocks/codeblocks_workspace.tmpl",
|
"actions/codeblocks/codeblocks_workspace.tmpl",
|
||||||
"actions/codeblocks/codeblocks_cbp.tmpl",
|
"actions/codeblocks/codeblocks_cbp.tmpl",
|
||||||
|
"actions/codelite/codelite_workspace.tmpl",
|
||||||
|
"actions/codelite/codelite_project.tmpl",
|
||||||
"actions/make/make_solution.tmpl",
|
"actions/make/make_solution.tmpl",
|
||||||
"actions/make/make_cpp.tmpl",
|
"actions/make/make_cpp.tmpl",
|
||||||
"actions/vstudio/vs2002_solution.tmpl",
|
"actions/vstudio/vs2002_solution.tmpl",
|
||||||
@ -49,6 +51,7 @@
|
|||||||
{
|
{
|
||||||
"actions/clean/_clean.lua",
|
"actions/clean/_clean.lua",
|
||||||
"actions/codeblocks/_codeblocks.lua",
|
"actions/codeblocks/_codeblocks.lua",
|
||||||
|
"actions/codelite/_codelite.lua",
|
||||||
"actions/make/_make.lua",
|
"actions/make/_make.lua",
|
||||||
"actions/vstudio/_vstudio.lua",
|
"actions/vstudio/_vstudio.lua",
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
<Build>
|
<Build>
|
||||||
<% for cfg in premake.eachconfig(this) do %>
|
<% for cfg in premake.eachconfig(this) do %>
|
||||||
<Target title="<%= premake.esc(cfg.name) %>">
|
<Target title="<%= premake.esc(cfg.name) %>">
|
||||||
<Option output="<%= premake.esc(cfg.target) %>" prefix_auto="0" extension_auto="0" />
|
<Option output="<%= premake.esc(premake.gettargetfile(cfg, "target", nil, true)) %>" prefix_auto="0" extension_auto="0" />
|
||||||
<Option object_output="<%= premake.esc(premake.getobjdir(cfg)) %>" />
|
<Option object_output="<%= premake.esc(premake.getobjdir(cfg)) %>" />
|
||||||
<% if (cfg.kind == "WindowedApp") then %>
|
<% if (cfg.kind == "WindowedApp") then %>
|
||||||
<Option type="0" />
|
<Option type="0" />
|
||||||
|
77
src/actions/codelite/_codelite.lua
Normal file
77
src/actions/codelite/_codelite.lua
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
--
|
||||||
|
-- _codelite.lua
|
||||||
|
-- Define the CodeLite action(s).
|
||||||
|
-- Copyright (c) 2008 Jason Perkins and the Premake project
|
||||||
|
--
|
||||||
|
|
||||||
|
_CODELITE = { }
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Translate Premake kind values into CodeLite kind values.
|
||||||
|
--
|
||||||
|
|
||||||
|
function _CODELITE.kind(value)
|
||||||
|
if (value == "ConsoleApp" or value == "WindowedApp") then
|
||||||
|
return "Executable"
|
||||||
|
elseif (value == "StaticLib") then
|
||||||
|
return "Static Library"
|
||||||
|
elseif (value == "SharedLib") then
|
||||||
|
return "Dynamic Library"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Write out entries for the files element; called from premake.walksources().
|
||||||
|
--
|
||||||
|
|
||||||
|
function _CODELITE.files(prj, fname, state, nestlevel)
|
||||||
|
local indent = string.rep(" ", nestlevel + 1)
|
||||||
|
|
||||||
|
if (state == "GroupStart") then
|
||||||
|
io.write(indent .. '<VirtualDirectory Name="' .. path.getname(fname) .. '">\n')
|
||||||
|
elseif (state == "GroupEnd") then
|
||||||
|
io.write(indent .. '</VirtualDirectory>\n')
|
||||||
|
else
|
||||||
|
io.write(indent .. '<File Name="' .. fname .. '"/>\n')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- The CodeLite action
|
||||||
|
--
|
||||||
|
newaction {
|
||||||
|
trigger = "codelite",
|
||||||
|
shortname = "CodeLite",
|
||||||
|
description = "CodeLite (experimental)",
|
||||||
|
|
||||||
|
valid_kinds = { "ConsoleApp", "WindowedApp", "StaticLib", "SharedLib" },
|
||||||
|
|
||||||
|
valid_languages = { "C", "C++" },
|
||||||
|
|
||||||
|
valid_tools = {
|
||||||
|
cc = { "gcc" },
|
||||||
|
},
|
||||||
|
|
||||||
|
solutiontemplates = {
|
||||||
|
{ ".workspace", _TEMPLATES.codelite_workspace },
|
||||||
|
},
|
||||||
|
|
||||||
|
projecttemplates = {
|
||||||
|
{ ".project", _TEMPLATES.codelite_project },
|
||||||
|
},
|
||||||
|
|
||||||
|
onclean = function(solutions, projects, targets)
|
||||||
|
for _,name in ipairs(projects) do
|
||||||
|
os.remove(name .. ".tags")
|
||||||
|
os.remove(name .. ".mk")
|
||||||
|
os.remove(name .. "_wsp.mk")
|
||||||
|
os.remove(name .. ".list")
|
||||||
|
os.remove(name .. ".out")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
}
|
74
src/actions/codelite/codelite_project.tmpl
Normal file
74
src/actions/codelite/codelite_project.tmpl
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<CodeLite_Project Name="<%= premake.esc(this.name) %>">
|
||||||
|
<% premake.walksources(this, this.files, _CODELITE.files) %>
|
||||||
|
<Settings Type="<%= _CODELITE.kind(this.kind) %>">
|
||||||
|
<% for cfg in premake.eachconfig(this) do %>
|
||||||
|
<% local target = premake.gettargetfile(cfg, "target", nil, true) %>
|
||||||
|
<Configuration Name="<%= premake.esc(cfg.name) %>" CompilerType="gnu <%= iif(cfg.language == "C", "gcc", "g++") %>" DebuggerType="GNU gdb debugger" Type="<%= _CODELITE.kind(cfg.kind) %>">
|
||||||
|
<General OutputFile="<%= premake.esc(target) %>" IntermediateDirectory="<%= premake.esc(premake.getobjdir(cfg)) %>" Command="./<%= path.getname(target) %>" CommandArguments="" WorkingDirectory="<%= path.getdirectory(target) %>" PauseExecWhenProcTerminates="<%= iif(cfg.kind == "WindowedApp", "no", "yes") %>"/>
|
||||||
|
<Compiler Required="yes" Options="<%= table.concat(table.join(premake.tools.gcc.getcflags(cfg), premake.tools.gcc.getcxxflags(cfg), cfg.buildoptions), ";") %>">
|
||||||
|
<% for _,v in ipairs(cfg.includedirs) do %>
|
||||||
|
<IncludePath Value="<%= premake.esc(v) %>"/>
|
||||||
|
<% end %>
|
||||||
|
<% for _,v in ipairs(cfg.defines) do %>
|
||||||
|
<Preprocessor Value="<%= premake.esc(v) %>"/>
|
||||||
|
<% end %>
|
||||||
|
</Compiler>
|
||||||
|
<Linker Required="yes" Options="<%= table.concat(table.join(premake.tools.gcc.getldflags(cfg), cfg.linkoptions), ";") %>">
|
||||||
|
<% local dirs, links = premake.tools.gcc.getlinks(cfg) %>
|
||||||
|
<% for _,v in ipairs(dirs) do %>
|
||||||
|
<LibraryPath Value="<%= premake.esc(v) %>" />
|
||||||
|
<% end %>
|
||||||
|
<% for _,v in ipairs(links) do %>
|
||||||
|
<Library Value="<%= premake.esc(v) %>" />
|
||||||
|
<% end %>
|
||||||
|
</Linker>
|
||||||
|
<% if premake.findfile(cfg, ".rc") then %>
|
||||||
|
<ResourceCompiler Required="yes" Options="<%= table.implode(table.join(cfg.defines,cfg.resdefines), "-D", ";", "") %><%= table.concat(cfg.resoptions, ";") %>">
|
||||||
|
<% for _,v in ipairs(cfg.includedirs) do %>
|
||||||
|
<IncludePath Value="<%= premake.esc(v) %>"/>
|
||||||
|
<% end %>
|
||||||
|
<% for _,v in ipairs(cfg.resincludedirs) do %>
|
||||||
|
<IncludePath Value="<%= premake.esc(v) %>"/>
|
||||||
|
<% end %>
|
||||||
|
</ResourceCompiler>
|
||||||
|
<% else %>
|
||||||
|
<ResourceCompiler Required="no" Options=""/>
|
||||||
|
<% end %>
|
||||||
|
<% if #cfg.prebuildcommands > 0 then %>
|
||||||
|
<PreBuild>
|
||||||
|
<% for _,v in ipairs(cfg.prebuildcommands) do %>
|
||||||
|
<Command Enabled="yes"><%= premake.esc(v) %></Command>
|
||||||
|
<% end %>
|
||||||
|
</PreBuild>
|
||||||
|
<% end %>
|
||||||
|
<% if #cfg.postbuildcommands > 0 then %>
|
||||||
|
<PostBuild>
|
||||||
|
<% for _,v in ipairs(cfg.postbuildcommands) do %>
|
||||||
|
<Command Enabled="yes"><%= premake.esc(v) %></Command>
|
||||||
|
<% end %>
|
||||||
|
</PostBuild>
|
||||||
|
<% end %>
|
||||||
|
<CustomBuild Enabled="no">
|
||||||
|
<CleanCommand></CleanCommand>
|
||||||
|
<BuildCommand></BuildCommand>
|
||||||
|
<SingleFileCommand></SingleFileCommand>
|
||||||
|
<MakefileGenerationCommand></MakefileGenerationCommand>
|
||||||
|
<ThirdPartyToolName>None</ThirdPartyToolName>
|
||||||
|
<WorkingDirectory></WorkingDirectory>
|
||||||
|
</CustomBuild>
|
||||||
|
<AdditionalRules>
|
||||||
|
<CustomPostBuild></CustomPostBuild>
|
||||||
|
<CustomPreBuild></CustomPreBuild>
|
||||||
|
</AdditionalRules>
|
||||||
|
</Configuration>
|
||||||
|
<%end %>
|
||||||
|
</Settings>
|
||||||
|
<% for _,cfgname in ipairs(this.configurations) do %>
|
||||||
|
<Dependencies name="<%= cfgname %>">
|
||||||
|
<% for _,dep in ipairs(premake.getdependencies(this)) do %>
|
||||||
|
<Project Name="<%= dep.name %>"/>
|
||||||
|
<% end %>
|
||||||
|
</Dependencies>
|
||||||
|
<% end %>
|
||||||
|
</CodeLite_Project>
|
15
src/actions/codelite/codelite_workspace.tmpl
Normal file
15
src/actions/codelite/codelite_workspace.tmpl
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<CodeLite_Workspace Name="<%= premake.esc(this.name) %>" Database="./<%= premake.esc(this.name) %>.tags">
|
||||||
|
<% for i,prj in ipairs(this.projects) do %>
|
||||||
|
<Project Name="<%= premake.esc(prj.name) %>" Path="<%= path.join(path.getrelative(this.location, prj.location), prj.name) %>.project" Active="<%= iif(i==1, "Yes", "No") %>" />
|
||||||
|
<% end %>
|
||||||
|
<BuildMatrix>
|
||||||
|
<% for _, cfgname in ipairs(this.configurations) do %>
|
||||||
|
<WorkspaceConfiguration Name="<%= cfgname %>" Selected="yes">
|
||||||
|
<% for _,prj in ipairs(this.projects) do %>
|
||||||
|
<Project Name="<%= prj.name %>" ConfigName="<%= cfgname %>"/>
|
||||||
|
<% end %>
|
||||||
|
</WorkspaceConfiguration>
|
||||||
|
<% end %>
|
||||||
|
</BuildMatrix>
|
||||||
|
</CodeLite_Workspace>
|
@ -13,12 +13,11 @@
|
|||||||
|
|
||||||
premake.tools.gcc = { }
|
premake.tools.gcc = { }
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- CFLAGS
|
|
||||||
--
|
|
||||||
|
|
||||||
premake.tools.gcc.cflags =
|
--
|
||||||
|
-- Translation of Premake flags into GCC flags
|
||||||
|
|
||||||
|
local cflags =
|
||||||
{
|
{
|
||||||
ExtraWarnings = "-Wall",
|
ExtraWarnings = "-Wall",
|
||||||
FatalWarning = "-Werror",
|
FatalWarning = "-Werror",
|
||||||
@ -29,8 +28,21 @@
|
|||||||
Symbols = "-g",
|
Symbols = "-g",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local cxxflags =
|
||||||
|
{
|
||||||
|
NoExceptions = "--no-exceptions",
|
||||||
|
NoRTTI = "--no-rtti",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- CFLAGS
|
||||||
|
--
|
||||||
|
|
||||||
function premake.tools.gcc.make_cflags(cfg)
|
function premake.tools.gcc.make_cflags(cfg)
|
||||||
local flags = table.translate(cfg.flags, premake.tools.gcc.cflags)
|
local flags = table.translate(cfg.flags, cflags)
|
||||||
|
|
||||||
if (cfg.kind == "SharedLib" and not os.is("windows")) then
|
if (cfg.kind == "SharedLib" and not os.is("windows")) then
|
||||||
table.insert(flags, "-fPIC")
|
table.insert(flags, "-fPIC")
|
||||||
@ -40,6 +52,64 @@
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Returns a list of compiler flags, based on the supplied configuration.
|
||||||
|
--
|
||||||
|
|
||||||
|
function premake.tools.gcc.getcflags(cfg)
|
||||||
|
local result = table.translate(cfg.flags, cflags)
|
||||||
|
if (cfg.kind == "SharedLib" and not os.is("windows")) then
|
||||||
|
table.insert(flags, "-fPIC")
|
||||||
|
end
|
||||||
|
return result
|
||||||
|
end
|
||||||
|
|
||||||
|
function premake.tools.gcc.getcxxflags(cfg)
|
||||||
|
local result = table.translate(cfg.flags, cxxflags)
|
||||||
|
return result
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Returns a list of linker flags, based on the supplied configuration.
|
||||||
|
--
|
||||||
|
|
||||||
|
function premake.tools.gcc.getldflags(cfg)
|
||||||
|
local result = { }
|
||||||
|
|
||||||
|
if (cfg.kind == "SharedLib") then
|
||||||
|
if (not os.is("macosx")) then
|
||||||
|
table.insert(result, "-shared")
|
||||||
|
end
|
||||||
|
|
||||||
|
-- create import library for DLLs under Windows
|
||||||
|
if (os.is("windows") and not cfg.flags.NoImportLib) then
|
||||||
|
table.insert(result, '-Wl,--out-implib="' .. premake.gettargetfile(cfg, "implib", "linux") .. '"')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if (os.is("windows") and cfg.kind == "WindowedApp") then
|
||||||
|
table.insert(result, "-mwindows")
|
||||||
|
end
|
||||||
|
|
||||||
|
-- OS X has a bug, see http://lists.apple.com/archives/Darwin-dev/2006/Sep/msg00084.html
|
||||||
|
if (not cfg.flags.Symbols) then
|
||||||
|
if (os.is("macosx")) then
|
||||||
|
table.insert(result, "-Wl,-x")
|
||||||
|
else
|
||||||
|
table.insert(result, "-s")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if (os.is("macosx") and cfg.flags.Dylib) then
|
||||||
|
table.insert(result, "-dynamiclib -flat_namespace")
|
||||||
|
end
|
||||||
|
|
||||||
|
return result
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Process the list of libraries for a configuration. Returns a list of linker
|
-- Process the list of libraries for a configuration. Returns a list of linker
|
||||||
-- search paths, followed by a list of link names. Not all compilers need to
|
-- search paths, followed by a list of link names. Not all compilers need to
|
||||||
@ -82,14 +152,8 @@
|
|||||||
-- CXXFLAGS
|
-- CXXFLAGS
|
||||||
--
|
--
|
||||||
|
|
||||||
premake.tools.gcc.cxxflags =
|
|
||||||
{
|
|
||||||
NoExceptions = "--no-exceptions",
|
|
||||||
NoRTTI = "--no-rtti",
|
|
||||||
}
|
|
||||||
|
|
||||||
function premake.tools.gcc.make_cxxflags(cfg)
|
function premake.tools.gcc.make_cxxflags(cfg)
|
||||||
local flags = table.translate(cfg.flags, premake.tools.gcc.cxxflags)
|
local flags = table.translate(cfg.flags, cxxflags)
|
||||||
return table.concat(flags, " ")
|
return table.concat(flags, " ")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -3,23 +3,6 @@
|
|||||||
-- Additions to Lua's built-in table functions.
|
-- Additions to Lua's built-in table functions.
|
||||||
-- Copyright (c) 2002-2008 Jason Perkins and the Premake project
|
-- Copyright (c) 2002-2008 Jason Perkins and the Premake project
|
||||||
--
|
--
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Adds the values from one array to the end of another and
|
|
||||||
-- returns the result.
|
|
||||||
--
|
|
||||||
|
|
||||||
function table.join(first, second)
|
|
||||||
local result = { }
|
|
||||||
for _,v in ipairs(first) do
|
|
||||||
table.insert(result, v)
|
|
||||||
end
|
|
||||||
for _,v in ipairs(second) do
|
|
||||||
table.insert(result, v)
|
|
||||||
end
|
|
||||||
return result
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
@ -67,6 +50,22 @@
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Adds the values from one array to the end of another and
|
||||||
|
-- returns the result.
|
||||||
|
--
|
||||||
|
|
||||||
|
function table.join(...)
|
||||||
|
local result = { }
|
||||||
|
for _,t in ipairs(arg) do
|
||||||
|
for _,v in ipairs(t) do
|
||||||
|
table.insert(result, v)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return result
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Translates the values contained in array, using the specified
|
-- Translates the values contained in array, using the specified
|
||||||
-- translation table, and returns the results in a new array.
|
-- translation table, and returns the results in a new array.
|
||||||
@ -75,7 +74,9 @@
|
|||||||
function table.translate(arr, translation)
|
function table.translate(arr, translation)
|
||||||
local result = { }
|
local result = { }
|
||||||
for _, value in ipairs(arr) do
|
for _, value in ipairs(arr) do
|
||||||
table.insert(result, translation[value])
|
if (translation[value]) then
|
||||||
|
table.insert(result, translation[value])
|
||||||
|
end
|
||||||
end
|
end
|
||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user