Stripped out premake.tools namespace to keep templates cleaner
This commit is contained in:
parent
be26ccfb9d
commit
79f26b0063
@ -76,7 +76,7 @@
|
||||
<% for _,v in ipairs(cfg.libdirs) do %>
|
||||
<Add directory="<%= premake.esc(v) %>" />
|
||||
<% end %>
|
||||
<% local dirs, links = premake.tools.gcc.getlinks(cfg) %>
|
||||
<% local dirs, links = premake.gcc.getlinks(cfg) %>
|
||||
<% for _,v in ipairs(dirs) do %>
|
||||
<Add directory="<%= premake.esc(v) %>" />
|
||||
<% end %>
|
||||
|
@ -6,7 +6,7 @@
|
||||
<% 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), ";") %>">
|
||||
<Compiler Required="yes" Options="<%= table.concat(table.join(premake.gcc.getcflags(cfg), premake.gcc.getcxxflags(cfg), cfg.buildoptions), ";") %>">
|
||||
<% for _,v in ipairs(cfg.includedirs) do %>
|
||||
<IncludePath Value="<%= premake.esc(v) %>"/>
|
||||
<% end %>
|
||||
@ -14,8 +14,8 @@
|
||||
<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) %>
|
||||
<Linker Required="yes" Options="<%= table.concat(table.join(premake.gcc.getldflags(cfg), cfg.linkoptions), ";") %>">
|
||||
<% local dirs, links = premake.gcc.getlinks(cfg) %>
|
||||
<% for _,v in ipairs(dirs) do %>
|
||||
<LibraryPath Value="<%= premake.esc(v) %>" />
|
||||
<% end %>
|
||||
|
@ -9,12 +9,12 @@ ifeq ($(CONFIG),<%= _MAKE.esc(cfg.name)%>)
|
||||
TARGETDIR = <%= _MAKE.esc(path.getdirectory(cfg.target)) %>
|
||||
TARGET = $(TARGETDIR)/<%= _MAKE.esc(path.getname(premake.gettargetfile(cfg, "target", nil, true))) %>
|
||||
OBJDIR = <%= _MAKE.esc(premake.getobjdir(cfg)) %>
|
||||
DEFINES += <%= premake.tools[_OPTIONS.cc].make_defines(cfg) %>
|
||||
INCLUDES += <%= premake.tools[_OPTIONS.cc].make_includes(cfg) %>
|
||||
CPPFLAGS += <%= premake.tools[_OPTIONS.cc].make_cppflags(cfg) %> $(DEFINES) $(INCLUDES)
|
||||
CFLAGS += $(CPPFLAGS) $(ARCH) <%= premake.tools[_OPTIONS.cc].make_cflags(cfg) %> <%= table.concat(cfg.buildoptions, " ") %>
|
||||
CXXFLAGS += $(CFLAGS) <%= premake.tools[_OPTIONS.cc].make_cxxflags(cfg) %>
|
||||
LDFLAGS += <%= premake.tools[_OPTIONS.cc].make_ldflags(cfg) %> <%= table.concat(cfg.linkoptions, " ") %>
|
||||
DEFINES += <%= premake[_OPTIONS.cc].make_defines(cfg) %>
|
||||
INCLUDES += <%= premake[_OPTIONS.cc].make_includes(cfg) %>
|
||||
CPPFLAGS += <%= premake[_OPTIONS.cc].make_cppflags(cfg) %> $(DEFINES) $(INCLUDES)
|
||||
CFLAGS += $(CPPFLAGS) $(ARCH) <%= premake[_OPTIONS.cc].make_cflags(cfg) %> <%= table.concat(cfg.buildoptions, " ") %>
|
||||
CXXFLAGS += $(CFLAGS) <%= premake[_OPTIONS.cc].make_cxxflags(cfg) %>
|
||||
LDFLAGS += <%= premake[_OPTIONS.cc].make_ldflags(cfg) %> <%= table.concat(cfg.linkoptions, " ") %>
|
||||
RESFLAGS += $(DEFINES) $(INCLUDES) <%= table.concat(cfg.resoptions, " ") %>
|
||||
LDDEPS += <%= table.concat(_MAKE.gettargetdeps(cfg), " ") %>
|
||||
<% if cfg.kind == "StaticLib" then %>
|
||||
@ -121,7 +121,7 @@ prelink:
|
||||
<% if path.iscppfile(file) then %>
|
||||
$(OBJDIR)/<%= _MAKE.esc(path.getbasename(file)) %>.o: <%= _MAKE.esc(file) %>
|
||||
@echo $(notdir $<)
|
||||
@<%= premake.tools[_OPTIONS.cc].make_file_rule(file) %>
|
||||
@<%= premake[_OPTIONS.cc].make_file_rule(file) %>
|
||||
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
@ -11,11 +11,12 @@
|
||||
--
|
||||
|
||||
|
||||
premake.tools.gcc = { }
|
||||
premake.gcc = { }
|
||||
|
||||
|
||||
--
|
||||
-- Translation of Premake flags into GCC flags
|
||||
--
|
||||
|
||||
local cflags =
|
||||
{
|
||||
@ -41,7 +42,7 @@
|
||||
-- CFLAGS
|
||||
--
|
||||
|
||||
function premake.tools.gcc.make_cflags(cfg)
|
||||
function premake.gcc.make_cflags(cfg)
|
||||
local flags = table.translate(cfg.flags, cflags)
|
||||
|
||||
if (cfg.kind == "SharedLib" and not os.is("windows")) then
|
||||
@ -56,7 +57,7 @@
|
||||
-- Returns a list of compiler flags, based on the supplied configuration.
|
||||
--
|
||||
|
||||
function premake.tools.gcc.getcflags(cfg)
|
||||
function premake.gcc.getcflags(cfg)
|
||||
local result = table.translate(cfg.flags, cflags)
|
||||
if (cfg.kind == "SharedLib" and not os.is("windows")) then
|
||||
table.insert(flags, "-fPIC")
|
||||
@ -64,7 +65,7 @@
|
||||
return result
|
||||
end
|
||||
|
||||
function premake.tools.gcc.getcxxflags(cfg)
|
||||
function premake.gcc.getcxxflags(cfg)
|
||||
local result = table.translate(cfg.flags, cxxflags)
|
||||
return result
|
||||
end
|
||||
@ -75,7 +76,7 @@
|
||||
-- Returns a list of linker flags, based on the supplied configuration.
|
||||
--
|
||||
|
||||
function premake.tools.gcc.getldflags(cfg)
|
||||
function premake.gcc.getldflags(cfg)
|
||||
local result = { }
|
||||
|
||||
if (cfg.kind == "SharedLib") then
|
||||
@ -118,7 +119,7 @@
|
||||
-- See bug #1729227 for background on why the path must be split for GCC.
|
||||
--
|
||||
|
||||
function premake.tools.gcc.getlinks(cfg)
|
||||
function premake.gcc.getlinks(cfg)
|
||||
local dirs = { }
|
||||
local names = { }
|
||||
for _, link in ipairs(premake.getlibraries(cfg)) do
|
||||
@ -141,7 +142,7 @@
|
||||
-- CPPFLAGS
|
||||
--
|
||||
|
||||
function premake.tools.gcc.make_cppflags(cfg)
|
||||
function premake.gcc.make_cppflags(cfg)
|
||||
-- if $(ARCH) contains multiple targets, then disable the incompatible automatic
|
||||
-- dependency generation. This allows building universal binaries on MacOSX, sorta.
|
||||
return "$(if $(word 2, $(ARCH)), , -MMD)"
|
||||
@ -152,7 +153,7 @@
|
||||
-- CXXFLAGS
|
||||
--
|
||||
|
||||
function premake.tools.gcc.make_cxxflags(cfg)
|
||||
function premake.gcc.make_cxxflags(cfg)
|
||||
local flags = table.translate(cfg.flags, cxxflags)
|
||||
return table.concat(flags, " ")
|
||||
end
|
||||
@ -162,12 +163,12 @@
|
||||
-- DEFINES and INCLUDES
|
||||
--
|
||||
|
||||
function premake.tools.gcc.make_defines(cfg)
|
||||
function premake.gcc.make_defines(cfg)
|
||||
return table.implode(cfg.defines, '-D "', '"', ' ')
|
||||
end
|
||||
|
||||
|
||||
function premake.tools.gcc.make_includes(cfg)
|
||||
function premake.gcc.make_includes(cfg)
|
||||
return table.implode(cfg.includedirs, '-I "', '"', ' ')
|
||||
end
|
||||
|
||||
@ -176,7 +177,7 @@
|
||||
-- LDFLAGS
|
||||
--
|
||||
|
||||
function premake.tools.gcc.make_ldflags(cfg)
|
||||
function premake.gcc.make_ldflags(cfg)
|
||||
local flags = { }
|
||||
|
||||
if (cfg.kind == "SharedLib") then
|
||||
@ -229,7 +230,7 @@
|
||||
-- SOURCE FILE RULES
|
||||
--
|
||||
|
||||
function premake.tools.gcc.make_file_rule(file)
|
||||
function premake.gcc.make_file_rule(file)
|
||||
if (path.iscfile(file)) then
|
||||
return "$(CC) $(CFLAGS) -o $@ -c $<"
|
||||
else
|
||||
|
@ -23,11 +23,6 @@
|
||||
-- The list of registered actions
|
||||
|
||||
premake.actions = { }
|
||||
|
||||
|
||||
-- The list of tool interfaces
|
||||
|
||||
premake.tools = { }
|
||||
|
||||
|
||||
--
|
||||
|
Loading…
Reference in New Issue
Block a user