Added custom build step support

This commit is contained in:
starkos 2008-11-23 14:35:52 +00:00
parent 6eedbd8537
commit ef8d8d0edc
5 changed files with 94 additions and 41 deletions

View File

@ -22,6 +22,24 @@ ifeq ($(CONFIG),<%= _MAKE.esc(cfg.name)%>)
<% else %>
LINKCMD = $(<%= iif(cfg.language == "C", "CC", "CXX") %>) -o $(TARGET) $(OBJECTS) $(LDFLAGS) $(RESOURCES) $(ARCH)
<% end %>
define PREBUILDCMDS
<% if #cfg.prebuildcommands > 0 then %>
@echo Running pre-build commands
<%= table.implode(cfg.prebuildcommands, "", "", "\n\t") %>
<% end %>
endef
define PRELINKCMDS
<% if #cfg.prelinkcommands > 0 then %>
@echo Running pre-link commands
<%= table.implode(cfg.prelinkcommands, "", "", "\n\t") %>
<% end %>
endef
define POSTBUILDCMDS
<% if #cfg.postbuildcommands > 0 then %>
@echo Running post-build commands
<%= table.implode(cfg.postbuildcommands, "", "", "\n\t") %>
<% end %>
endef
endif
<% end %>
@ -60,7 +78,7 @@ SYS_TARGET := $(subst /,$(PATHSEP),$(TARGET))
SYS_TARGETDIR := $(subst /,$(PATHSEP),$(TARGETDIR))
SYS_OBJDIR := $(subst /,$(PATHSEP),$(OBJDIR))
.PHONY: clean
.PHONY: clean prebuild prelink
<% if os.is("MacOSX") and this.kind == "WindowedApp" then %>
all: $(TARGET) $(dir $(TARGETDIR))PkgInfo $(dir $(TARGETDIR))Info.plist
@ -70,10 +88,10 @@ $(dir $(TARGETDIR))PkgInfo:
$(dir $(TARGETDIR))Info.plist:
<% end %>
$(TARGET): $(TARGETDIR) $(OBJDIR) $(OBJECTS) $(LDDEPS) $(RESOURCES)
$(TARGET): $(TARGETDIR) $(OBJDIR) prebuild $(OBJECTS) $(LDDEPS) $(RESOURCES) prelink
@echo Linking <%= this.name %>
@$(LINKCMD)
$(POSTBUILDCMDS)
$(TARGETDIR):
@echo Creating $@
@ -93,6 +111,12 @@ else
@if exist $(SYS_OBJDIR) rmdir /s /q $(SYS_OBJDIR)
endif
prebuild:
$(PREBUILDCMDS)
prelink:
$(PRELINKCMDS)
<% for _, file in ipairs(this.files) do %>
<% if path.iscppfile(file) then %>
$(OBJDIR)/<%= _MAKE.esc(path.getbasename(file)) %>.o: <%= _MAKE.esc(file) %>

View File

@ -72,7 +72,7 @@
<% if #cfg.defines > 0 then %>
PreprocessorDefinitions="<%= table.concat(premake.esc(cfg.defines), ";") %>"
<% end %>
<% if _VS.optimization(cfg) == 0 and not cfg.flags.Managed then %>
<% if cfg.flags.Symbols and not cfg.flags.Managed then %>
MinimalRebuild="<%= _VS.bool(true) %>"
<% end %>
<% if cfg.flags.NoExceptions then %>
@ -183,14 +183,23 @@
<% elseif (block == "VCPreBuildEventTool") then %>
<Tool
Name="VCPreBuildEventTool"
<% if #cfg.prebuildcommands > 0 then %>
CommandLine="<%= premake.esc(table.implode(cfg.prebuildcommands, "", "", "\r\n")) %>"
<% end %>
/>
<% elseif (block == "VCPreLinkEventTool") then %>
<Tool
Name="VCPreLinkEventTool"
<% if #cfg.prelinkcommands > 0 then %>
CommandLine="<%= premake.esc(table.implode(cfg.prelinkcommands, "", "", "\r\n")) %>"
<% end %>
/>
<% elseif (block == "VCPostBuildEventTool") then %>
<Tool
Name="VCPostBuildEventTool"
<% if #cfg.postbuildcommands > 0 then %>
CommandLine="<%= premake.esc(table.implode(cfg.postbuildcommands, "", "", "\r\n")) %>"
<% end %>
/>
<% elseif (block == "VCResourceCompilerTool") then %>
<Tool
@ -201,8 +210,8 @@
<% if #cfg.defines > 0 or #cfg.resdefines > 0 then %>
PreprocessorDefinitions="<%= table.concat(premake.esc(table.join(cfg.defines, cfg.resdefines)), ";") %>"
<% end %>
<% if #cfg.includedirs > 0 or #cfg.resincdirs > 0 then %>
AdditionalIncludeDirectories="<%= table.concat(premake.esc(table.join(cfg.includedirs, cfg.resincdirs)), ";") %>"
<% if #cfg.includedirs > 0 or #cfg.resincludedirs > 0 then %>
AdditionalIncludeDirectories="<%= table.concat(premake.esc(table.join(cfg.includedirs, cfg.resincludedirs)), ";") %>"
<% end %>
/>
<% elseif (block == "VCWebDeploymentTool") then %>

View File

@ -173,6 +173,24 @@
scope = "config",
},
prebuildcommands =
{
kind = "list",
scope = "config",
},
prelinkcommands =
{
kind = "list",
scope = "config",
},
postbuildcommands =
{
kind = "list",
scope = "config",
},
resdefines =
{
kind = "list",

View File

@ -110,11 +110,13 @@
end
return result
else
value = value:gsub('&', "&amp;")
value = value:gsub('"', "&quot;")
value = value:gsub("'", "&apos;")
value = value:gsub('<', "&lt;")
value = value:gsub('>', "&gt;")
value = value:gsub('&', "&amp;")
value = value:gsub('"', "&quot;")
value = value:gsub("'", "&apos;")
value = value:gsub('<', "&lt;")
value = value:gsub('>', "&gt;")
value = value:gsub('\r', "&#x0D;")
value = value:gsub('\n', "&#x0A;")
return value
end
end

File diff suppressed because one or more lines are too long