Merge branch 'master' into server-paths
This commit is contained in:
commit
3fec411a54
@ -1,4 +1,4 @@
|
|||||||
#include <luashim.h>
|
#include "luashim.h"
|
||||||
|
|
||||||
|
|
||||||
static int example_test(lua_State* L)
|
static int example_test(lua_State* L)
|
||||||
|
@ -51,7 +51,7 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <zipconf.h>
|
#include "zipconf.h"
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
#include "luashim.h"
|
#include "luashim.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <lstate.h>
|
#include "lstate.h"
|
||||||
|
|
||||||
static const LuaFunctionTable_t* g_shimTable;
|
static const LuaFunctionTable_t* g_shimTable;
|
||||||
|
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
#ifndef HEADER_luashim_H
|
#ifndef HEADER_luashim_H
|
||||||
#define HEADER_luashim_H
|
#define HEADER_luashim_H
|
||||||
|
|
||||||
#include <lua.h>
|
#include "lua.h"
|
||||||
#include <lauxlib.h>
|
#include "lauxlib.h"
|
||||||
|
|
||||||
// premake specific helper methods.
|
// premake specific helper methods.
|
||||||
void luaL_register(lua_State *L, const char *libname, const luaL_Reg *l);
|
void luaL_register(lua_State *L, const char *libname, const luaL_Reg *l);
|
||||||
|
@ -152,14 +152,17 @@
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
function android.link(cfg, file)
|
function android.link(cfg, file)
|
||||||
local fname = path.translate(file.relpath)
|
-- default the seperator to '/' as that is what is searched for
|
||||||
|
-- below. Otherwise the function will use target seperator which
|
||||||
|
-- could be '\\' and result in failure to create links.
|
||||||
|
local fname = path.translate(file.relpath, '/')
|
||||||
|
|
||||||
-- Files that live outside of the project tree need to be "linked"
|
-- Files that live outside of the project tree need to be "linked"
|
||||||
-- and provided with a project relative pseudo-path. Check for any
|
-- and provided with a project relative pseudo-path. Check for any
|
||||||
-- leading "../" sequences and, if found, remove them and mark this
|
-- leading "../" sequences and, if found, remove them and mark this
|
||||||
-- path as external.
|
-- path as external.
|
||||||
local link, count = fname:gsub("%.%.%/", "")
|
local link, count = fname:gsub("%.%.%/", "")
|
||||||
local external = (count > 0) or fname:find(':', 1, true)
|
local external = (count > 0) or fname:find(':', 1, true) or (file.vpath and file.vpath ~= file.relpath)
|
||||||
|
|
||||||
-- Try to provide a little bit of flexibility by allowing virtual
|
-- Try to provide a little bit of flexibility by allowing virtual
|
||||||
-- paths for external files. Would be great to support them for all
|
-- paths for external files. Would be great to support them for all
|
||||||
|
@ -274,9 +274,10 @@
|
|||||||
end
|
end
|
||||||
|
|
||||||
function m.environment(cfg)
|
function m.environment(cfg)
|
||||||
|
local envs = table.concat(cfg.debugenvs, "\n")
|
||||||
|
|
||||||
_p(3, '<Environment EnvVarSetName="<Use Defaults>" DbgSetName="<Use Defaults>">')
|
_p(3, '<Environment EnvVarSetName="<Use Defaults>" DbgSetName="<Use Defaults>">')
|
||||||
local variables = ""
|
_x(4, '<![CDATA[%s]]>', envs)
|
||||||
_x(4, '<![CDATA[%s]]>', variables)
|
|
||||||
_p(3, '</Environment>')
|
_p(3, '</Environment>')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -26,11 +26,11 @@
|
|||||||
--
|
--
|
||||||
-- Header
|
-- Header
|
||||||
--
|
--
|
||||||
_p('<?xml version="1.0" encoding="UTF-8"?>')
|
p.w('<?xml version="1.0" encoding="UTF-8"?>')
|
||||||
|
|
||||||
local tagsdb = ""
|
local tagsdb = ""
|
||||||
-- local tagsdb = "./" .. wks.name .. ".tags"
|
-- local tagsdb = "./" .. wks.name .. ".tags"
|
||||||
_p('<CodeLite_Workspace Name="%s" Database="%s" SWTLW="No">', wks.name, tagsdb)
|
p.push('<CodeLite_Workspace Name="%s" Database="%s" SWTLW="No">', wks.name, tagsdb)
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Project list
|
-- Project list
|
||||||
@ -45,15 +45,18 @@
|
|||||||
prjpath = path.getrelative(prj.workspace.location, prjpath)
|
prjpath = path.getrelative(prj.workspace.location, prjpath)
|
||||||
|
|
||||||
if (prj.name == wks.startproject) then
|
if (prj.name == wks.startproject) then
|
||||||
_x(1, '<Project Name="%s" Path="%s" Active="Yes"/>', prj.name, prjpath)
|
p.w('<Project Name="%s" Path="%s" Active="Yes"/>', prj.name, prjpath)
|
||||||
else
|
else
|
||||||
_x(1, '<Project Name="%s" Path="%s"/>', prj.name, prjpath)
|
p.w('<Project Name="%s" Path="%s"/>', prj.name, prjpath)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
onbranch = function(n)
|
onbranchenter = function(n)
|
||||||
-- TODO: not sure what situation this appears...?
|
p.push('<VirtualDirectory Name="%s">', n.name)
|
||||||
-- premake5.lua emit's one of these for 'contrib', which is a top-level folder with the zip projects
|
end,
|
||||||
|
|
||||||
|
onbranchexit = function(n)
|
||||||
|
p.pop('</VirtualDirectory>')
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -78,23 +81,23 @@
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- for each workspace config
|
-- for each workspace config
|
||||||
_p(1, '<BuildMatrix>')
|
p.push('<BuildMatrix>')
|
||||||
for cfg in workspace.eachconfig(wks) do
|
for cfg in workspace.eachconfig(wks) do
|
||||||
|
|
||||||
local cfgname = codelite.cfgname(cfg)
|
local cfgname = codelite.cfgname(cfg)
|
||||||
_p(2, '<WorkspaceConfiguration Name="%s" Selected="yes">', cfgname)
|
p.push('<WorkspaceConfiguration Name="%s" Selected="yes">', cfgname)
|
||||||
|
|
||||||
local tr = workspace.grouptree(wks)
|
local tr = workspace.grouptree(wks)
|
||||||
tree.traverse(tr, {
|
tree.traverse(tr, {
|
||||||
onleaf = function(n)
|
onleaf = function(n)
|
||||||
local prj = n.project
|
local prj = n.project
|
||||||
_p(3, '<Project Name="%s" ConfigName="%s"/>', prj.name, cfgname)
|
p.w('<Project Name="%s" ConfigName="%s"/>', prj.name, cfgname)
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
_p(2, '</WorkspaceConfiguration>')
|
p.pop('</WorkspaceConfiguration>')
|
||||||
|
|
||||||
end
|
end
|
||||||
_p(1, '</BuildMatrix>')
|
p.pop('</BuildMatrix>')
|
||||||
|
|
||||||
_p('</CodeLite_Workspace>')
|
p.pop('</CodeLite_Workspace>')
|
||||||
end
|
end
|
||||||
|
@ -142,11 +142,13 @@
|
|||||||
end
|
end
|
||||||
|
|
||||||
function suite.OnProjectCfg_Environment()
|
function suite.OnProjectCfg_Environment()
|
||||||
|
debugenvs { "ENV_ONE=1", "ENV_TWO=2" }
|
||||||
prepare()
|
prepare()
|
||||||
codelite.project.environment(cfg)
|
codelite.project.environment(cfg)
|
||||||
test.capture(
|
test.capture(
|
||||||
' <Environment EnvVarSetName="<Use Defaults>" DbgSetName="<Use Defaults>">\n' ..
|
' <Environment EnvVarSetName="<Use Defaults>" DbgSetName="<Use Defaults>">\n' ..
|
||||||
' <![CDATA[]]>\n' ..
|
' <![CDATA[ENV_ONE=1\n' ..
|
||||||
|
'ENV_TWO=2]]>\n' ..
|
||||||
' </Environment>'
|
' </Environment>'
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
@ -151,3 +151,42 @@
|
|||||||
</CodeLite_Workspace>
|
</CodeLite_Workspace>
|
||||||
]])
|
]])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function suite.onGroupedProjects()
|
||||||
|
wks.projects = {}
|
||||||
|
project "MyGrouplessProject"
|
||||||
|
group "MyGroup"
|
||||||
|
project "MyGroupedProject"
|
||||||
|
group "My/Nested/Group"
|
||||||
|
project "MyNestedGroupedProject"
|
||||||
|
prepare()
|
||||||
|
test.capture([[
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<CodeLite_Workspace Name="MyWorkspace" Database="" SWTLW="No">
|
||||||
|
<VirtualDirectory Name="My">
|
||||||
|
<VirtualDirectory Name="Nested">
|
||||||
|
<VirtualDirectory Name="Group">
|
||||||
|
<Project Name="MyNestedGroupedProject" Path="MyNestedGroupedProject.project"/>
|
||||||
|
</VirtualDirectory>
|
||||||
|
</VirtualDirectory>
|
||||||
|
</VirtualDirectory>
|
||||||
|
<VirtualDirectory Name="MyGroup">
|
||||||
|
<Project Name="MyGroupedProject" Path="MyGroupedProject.project"/>
|
||||||
|
</VirtualDirectory>
|
||||||
|
<Project Name="MyGrouplessProject" Path="MyGrouplessProject.project"/>
|
||||||
|
<BuildMatrix>
|
||||||
|
<WorkspaceConfiguration Name="Debug" Selected="yes">
|
||||||
|
<Project Name="MyNestedGroupedProject" ConfigName="Debug"/>
|
||||||
|
<Project Name="MyGroupedProject" ConfigName="Debug"/>
|
||||||
|
<Project Name="MyGrouplessProject" ConfigName="Debug"/>
|
||||||
|
</WorkspaceConfiguration>
|
||||||
|
<WorkspaceConfiguration Name="Release" Selected="yes">
|
||||||
|
<Project Name="MyNestedGroupedProject" ConfigName="Release"/>
|
||||||
|
<Project Name="MyGroupedProject" ConfigName="Release"/>
|
||||||
|
<Project Name="MyGrouplessProject" ConfigName="Release"/>
|
||||||
|
</WorkspaceConfiguration>
|
||||||
|
</BuildMatrix>
|
||||||
|
</CodeLite_Workspace>
|
||||||
|
]])
|
||||||
|
end
|
||||||
|
@ -154,14 +154,24 @@
|
|||||||
p.override(cpp, "standardFileRules", function(oldfn, prj, node)
|
p.override(cpp, "standardFileRules", function(oldfn, prj, node)
|
||||||
-- D file
|
-- D file
|
||||||
if path.isdfile(node.abspath) then
|
if path.isdfile(node.abspath) then
|
||||||
_x('$(OBJDIR)/%s.o: %s', node.objname, node.relpath)
|
|
||||||
_p('\t@echo $(notdir $<)')
|
|
||||||
_p('\t$(SILENT) $(DC) $(ALL_DFLAGS) $(OUTPUTFLAG) -c $<')
|
_p('\t$(SILENT) $(DC) $(ALL_DFLAGS) $(OUTPUTFLAG) -c $<')
|
||||||
else
|
else
|
||||||
oldfn(prj, node)
|
oldfn(prj, node)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Let make know it can compile D source files
|
||||||
|
--
|
||||||
|
|
||||||
|
p.override(make, "fileType", function(oldfn, node)
|
||||||
|
if path.isdfile(node.abspath) then
|
||||||
|
return "objects"
|
||||||
|
else
|
||||||
|
return oldfn(node)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Write out the settings for a particular configuration.
|
-- Write out the settings for a particular configuration.
|
||||||
|
@ -50,9 +50,11 @@
|
|||||||
end
|
end
|
||||||
|
|
||||||
function m.dCompile(cfg)
|
function m.dCompile(cfg)
|
||||||
p.push('<DCompile>')
|
if config.hasFile(cfg, path.isdfile) then
|
||||||
p.callArray(m.elements.dCompile, cfg)
|
p.push('<DCompile>')
|
||||||
p.pop('</DCompile>')
|
p.callArray(m.elements.dCompile, cfg)
|
||||||
|
p.pop('</DCompile>')
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
---
|
---
|
||||||
|
@ -274,12 +274,9 @@
|
|||||||
|
|
||||||
|
|
||||||
function make.shellType()
|
function make.shellType()
|
||||||
_p('SHELLTYPE := msdos')
|
_p('SHELLTYPE := posix')
|
||||||
_p('ifeq (,$(ComSpec)$(COMSPEC))')
|
_p('ifeq (.exe,$(findstring .exe,$(ComSpec)))')
|
||||||
_p(' SHELLTYPE := posix')
|
_p('\tSHELLTYPE := msdos')
|
||||||
_p('endif')
|
|
||||||
_p('ifeq (/bin,$(findstring /bin,$(SHELL)))')
|
|
||||||
_p(' SHELLTYPE := posix')
|
|
||||||
_p('endif')
|
_p('endif')
|
||||||
_p('')
|
_p('')
|
||||||
end
|
end
|
||||||
|
@ -34,6 +34,9 @@
|
|||||||
make.cppObjects,
|
make.cppObjects,
|
||||||
make.shellType,
|
make.shellType,
|
||||||
make.cppTargetRules,
|
make.cppTargetRules,
|
||||||
|
make.cppCustomFilesRules,
|
||||||
|
make.cppTargetDirRules,
|
||||||
|
make.cppObjDirRules,
|
||||||
make.cppCleanRules,
|
make.cppCleanRules,
|
||||||
make.preBuildRules,
|
make.preBuildRules,
|
||||||
make.preLinkRules,
|
make.preLinkRules,
|
||||||
@ -43,18 +46,68 @@
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- should be part of the toolset?
|
||||||
|
function make.fileTypeExtensions()
|
||||||
|
return {
|
||||||
|
["objects"] = "o",
|
||||||
|
["resources"] = "res",
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
-- should be part of the toolset?
|
||||||
|
function make.fileType(node)
|
||||||
|
local kind
|
||||||
|
if path.iscppfile(node.abspath) then
|
||||||
|
kind = "objects"
|
||||||
|
elseif path.isresourcefile(node.abspath) then
|
||||||
|
kind = "resources"
|
||||||
|
end
|
||||||
|
|
||||||
|
return kind
|
||||||
|
end
|
||||||
|
|
||||||
|
function make.fileDependency(prj, node)
|
||||||
|
local filetype = make.fileType(node)
|
||||||
|
_x('$(OBJDIR)/%s.%s: %s', node.objname, make.fileTypeExtensions()[filetype], node.relpath)
|
||||||
|
_p('\t@echo $(notdir $<)')
|
||||||
|
end
|
||||||
|
|
||||||
function make.cpp.generate(prj)
|
function make.cpp.generate(prj)
|
||||||
p.eol("\n")
|
p.eol("\n")
|
||||||
p.callArray(cpp.elements.makefile, prj)
|
p.callArray(cpp.elements.makefile, prj)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Write out the commands for compiling a file
|
||||||
|
--
|
||||||
|
|
||||||
|
cpp.elements.standardFileRules = function(prj, node)
|
||||||
|
return {
|
||||||
|
make.fileDependency,
|
||||||
|
cpp.standardFileRules,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
cpp.elements.customFileRules = function(prj, node)
|
||||||
|
return {
|
||||||
|
make.fileDependency,
|
||||||
|
cpp.customFileRules,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
cpp.elements.customBuildRules = function(prj, node)
|
||||||
|
return {
|
||||||
|
cpp.customFileRules
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Write out the settings for a particular configuration.
|
-- Write out the settings for a particular configuration.
|
||||||
--
|
--
|
||||||
|
|
||||||
cpp.elements.configuration = function(cfg)
|
cpp.elements.configuration = function(cfg, toolset)
|
||||||
return {
|
return {
|
||||||
|
make.configBegin,
|
||||||
make.cppTools,
|
make.cppTools,
|
||||||
make.target,
|
make.target,
|
||||||
make.objdir,
|
make.objdir,
|
||||||
@ -76,6 +129,7 @@
|
|||||||
make.postBuildCmds,
|
make.postBuildCmds,
|
||||||
make.cppAllRules,
|
make.cppAllRules,
|
||||||
make.settings,
|
make.settings,
|
||||||
|
make.configEnd,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -89,9 +143,7 @@
|
|||||||
error("Invalid toolset '" .. cfg.toolset .. "'")
|
error("Invalid toolset '" .. cfg.toolset .. "'")
|
||||||
end
|
end
|
||||||
|
|
||||||
_x('ifeq ($(config),%s)', cfg.shortname)
|
|
||||||
p.callArray(cpp.elements.configuration, cfg, toolset)
|
p.callArray(cpp.elements.configuration, cfg, toolset)
|
||||||
_p('endif')
|
|
||||||
_p('')
|
_p('')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -105,13 +157,33 @@
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Return the start of the compilation string that corresponds to the 'compileas' enum if set
|
||||||
|
--
|
||||||
|
|
||||||
|
function cpp.compileas(prj, node)
|
||||||
|
local result
|
||||||
|
if node["compileas"] then
|
||||||
|
if p.languages.isc(node.compileas) then
|
||||||
|
result = '$(CC) $(ALL_CFLAGS)'
|
||||||
|
elseif p.languages.iscpp(node.compileas) then
|
||||||
|
result = '$(CXX) $(ALL_CXXFLAGS)'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return result
|
||||||
|
end
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Build command for a single file.
|
-- Build command for a single file.
|
||||||
--
|
--
|
||||||
|
|
||||||
function cpp.buildcommand(prj, objext, node)
|
function cpp.buildcommand(prj, objext, node)
|
||||||
local iscfile = node and path.iscfile(node.abspath) or false
|
local flags = cpp.compileas(prj, node)
|
||||||
local flags = iif(prj.language == "C" or iscfile, '$(CC) $(ALL_CFLAGS)', '$(CXX) $(ALL_CXXFLAGS)')
|
if not flags then
|
||||||
|
local iscfile = node and path.iscfile(node.abspath) or false
|
||||||
|
flags = iif(prj.language == "C" or iscfile, '$(CC) $(ALL_CFLAGS)', '$(CXX) $(ALL_CXXFLAGS)')
|
||||||
|
end
|
||||||
_p('\t$(SILENT) %s $(FORCE_INCLUDE) -o "$@" -MF "$(@:%%.%s=%%.d)" -c "$<"', flags, objext)
|
_p('\t$(SILENT) %s $(FORCE_INCLUDE) -o "$@" -MF "$(@:%%.%s=%%.d)" -c "$<"', flags, objext)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -129,17 +201,22 @@
|
|||||||
for cfg in project.eachconfig(prj) do
|
for cfg in project.eachconfig(prj) do
|
||||||
local filecfg = fileconfig.getconfig(node, cfg)
|
local filecfg = fileconfig.getconfig(node, cfg)
|
||||||
if fileconfig.hasCustomBuildRule(filecfg) then
|
if fileconfig.hasCustomBuildRule(filecfg) then
|
||||||
rules = true
|
rules = cpp.elements.customBuildRules(prj, node)
|
||||||
|
break
|
||||||
|
end
|
||||||
|
|
||||||
|
if fileconfig.hasFileSettings(filecfg) then
|
||||||
|
rules = cpp.elements.customFileRules(prj, node)
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- if it has custom rules, need to break them out
|
if not rules and make.fileType(node) then
|
||||||
-- into individual configurations
|
rules = cpp.elements.standardFileRules(prj, node)
|
||||||
|
end
|
||||||
|
|
||||||
if rules then
|
if rules then
|
||||||
cpp.customFileRules(prj, node)
|
p.callArray(rules, prj, node)
|
||||||
else
|
|
||||||
cpp.standardFileRules(prj, node)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
@ -147,18 +224,13 @@
|
|||||||
end
|
end
|
||||||
|
|
||||||
function cpp.standardFileRules(prj, node)
|
function cpp.standardFileRules(prj, node)
|
||||||
-- C/C++ file
|
local kind = make.fileType(node)
|
||||||
if path.iscppfile(node.abspath) then
|
|
||||||
_x('$(OBJDIR)/%s.o: %s', node.objname, node.relpath)
|
|
||||||
_p('\t@echo $(notdir $<)')
|
|
||||||
make.mkdir('$(OBJDIR)')
|
|
||||||
cpp.buildcommand(prj, "o", node)
|
|
||||||
|
|
||||||
|
-- C/C++ file
|
||||||
|
if kind == "objects" then
|
||||||
|
cpp.buildcommand(prj, make.fileTypeExtensions()[kind], node)
|
||||||
-- resource file
|
-- resource file
|
||||||
elseif path.isresourcefile(node.abspath) then
|
elseif kind == "resources" then
|
||||||
_x('$(OBJDIR)/%s.res: %s', node.objname, node.relpath)
|
|
||||||
_p('\t@echo $(notdir $<)')
|
|
||||||
make.mkdir('$(OBJDIR)')
|
|
||||||
_p('\t$(SILENT) $(RESCOMP) $< -O coff -o "$@" $(ALL_RESFLAGS)')
|
_p('\t$(SILENT) $(RESCOMP) $< -O coff -o "$@" $(ALL_RESFLAGS)')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -167,8 +239,9 @@
|
|||||||
for cfg in project.eachconfig(prj) do
|
for cfg in project.eachconfig(prj) do
|
||||||
local filecfg = fileconfig.getconfig(node, cfg)
|
local filecfg = fileconfig.getconfig(node, cfg)
|
||||||
if filecfg then
|
if filecfg then
|
||||||
_x('ifeq ($(config),%s)', cfg.shortname)
|
make.configBegin(cfg)
|
||||||
|
|
||||||
|
if fileconfig.hasCustomBuildRule(filecfg) then
|
||||||
local output = project.getrelative(prj, filecfg.buildoutputs[1])
|
local output = project.getrelative(prj, filecfg.buildoutputs[1])
|
||||||
local dependencies = filecfg.relpath
|
local dependencies = filecfg.relpath
|
||||||
if filecfg.buildinputs and #filecfg.buildinputs > 0 then
|
if filecfg.buildinputs and #filecfg.buildinputs > 0 then
|
||||||
@ -186,7 +259,10 @@
|
|||||||
_p('\t$(SILENT) %s', cmd)
|
_p('\t$(SILENT) %s', cmd)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
_p('endif')
|
else
|
||||||
|
cpp.standardFileRules(prj, filecfg)
|
||||||
|
end
|
||||||
|
make.configEnd(cfg)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -287,7 +363,7 @@
|
|||||||
for cfg in project.eachconfig(prj) do
|
for cfg in project.eachconfig(prj) do
|
||||||
local files = configs[cfg]
|
local files = configs[cfg]
|
||||||
if #files.objects > 0 or #files.resources > 0 or #files.customfiles > 0 then
|
if #files.objects > 0 or #files.resources > 0 or #files.customfiles > 0 then
|
||||||
_x('ifeq ($(config),%s)', cfg.shortname)
|
make.configBegin(cfg, toolset)
|
||||||
if #files.objects > 0 then
|
if #files.objects > 0 then
|
||||||
listobjects(' OBJECTS +=', files.objects)
|
listobjects(' OBJECTS +=', files.objects)
|
||||||
end
|
end
|
||||||
@ -297,7 +373,7 @@
|
|||||||
if #files.customfiles > 0 then
|
if #files.customfiles > 0 then
|
||||||
listobjects(' CUSTOMFILES +=', files.customfiles)
|
listobjects(' CUSTOMFILES +=', files.customfiles)
|
||||||
end
|
end
|
||||||
_p('endif')
|
make.configEnd(cfg, toolset)
|
||||||
_p('')
|
_p('')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -310,6 +386,18 @@
|
|||||||
--
|
--
|
||||||
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
function make.configBegin(cfg, toolset)
|
||||||
|
if cfg then
|
||||||
|
_x('ifeq ($(config),%s)', cfg.shortname)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function make.configEnd(cfg, toolset)
|
||||||
|
if cfg then
|
||||||
|
_p('endif')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function make.cFlags(cfg, toolset)
|
function make.cFlags(cfg, toolset)
|
||||||
_p(' ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS)%s', make.list(table.join(toolset.getcflags(cfg), cfg.buildoptions)))
|
_p(' ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS)%s', make.list(table.join(toolset.getcflags(cfg), cfg.buildoptions)))
|
||||||
end
|
end
|
||||||
@ -363,14 +451,31 @@
|
|||||||
|
|
||||||
|
|
||||||
function make.cppTargetRules(prj)
|
function make.cppTargetRules(prj)
|
||||||
_p('$(TARGET): $(GCH) ${CUSTOMFILES} $(OBJECTS) $(LDDEPS) $(RESOURCES)')
|
_p('$(TARGET): $(GCH) ${CUSTOMFILES} $(OBJECTS) $(LDDEPS) $(RESOURCES) | $(TARGETDIR)')
|
||||||
_p('\t@echo Linking %s', prj.name)
|
_p('\t@echo Linking %s', prj.name)
|
||||||
make.mkdir('$(TARGETDIR)')
|
|
||||||
_p('\t$(SILENT) $(LINKCMD)')
|
_p('\t$(SILENT) $(LINKCMD)')
|
||||||
_p('\t$(POSTBUILDCMDS)')
|
_p('\t$(POSTBUILDCMDS)')
|
||||||
_p('')
|
_p('')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function make.cppCustomFilesRules(prj)
|
||||||
|
_p('$(CUSTOMFILES): | $(OBJDIR)')
|
||||||
|
_p('')
|
||||||
|
end
|
||||||
|
|
||||||
|
function make.cppTargetDirRules(prj)
|
||||||
|
_p('$(TARGETDIR):')
|
||||||
|
_p('\t@echo Creating $(TARGETDIR)')
|
||||||
|
make.mkdir('$(TARGETDIR)')
|
||||||
|
_p('')
|
||||||
|
end
|
||||||
|
|
||||||
|
function make.cppObjDirRules(prj)
|
||||||
|
_p('$(OBJDIR):')
|
||||||
|
_p('\t@echo Creating $(OBJDIR)')
|
||||||
|
make.mkdir('$(OBJDIR)')
|
||||||
|
_p('')
|
||||||
|
end
|
||||||
|
|
||||||
function make.cppTools(cfg, toolset)
|
function make.cppTools(cfg, toolset)
|
||||||
local tool = toolset.gettoolname(cfg, "cc")
|
local tool = toolset.gettoolname(cfg, "cc")
|
||||||
@ -509,14 +614,15 @@
|
|||||||
|
|
||||||
function make.pchRules(prj)
|
function make.pchRules(prj)
|
||||||
_p('ifneq (,$(PCH))')
|
_p('ifneq (,$(PCH))')
|
||||||
_p('$(OBJECTS): $(GCH) $(PCH)')
|
_p('$(OBJECTS): $(GCH) $(PCH) | $(OBJDIR)')
|
||||||
_p('$(GCH): $(PCH)')
|
_p('$(GCH): $(PCH) | $(OBJDIR)')
|
||||||
_p('\t@echo $(notdir $<)')
|
_p('\t@echo $(notdir $<)')
|
||||||
make.mkdir('$(OBJDIR)')
|
|
||||||
|
|
||||||
local cmd = iif(prj.language == "C", "$(CC) -x c-header $(ALL_CFLAGS)", "$(CXX) -x c++-header $(ALL_CXXFLAGS)")
|
local cmd = iif(prj.language == "C", "$(CC) -x c-header $(ALL_CFLAGS)", "$(CXX) -x c++-header $(ALL_CXXFLAGS)")
|
||||||
_p('\t$(SILENT) %s -o "$@" -MF "$(@:%%.gch=%%.d)" -c "$<"', cmd)
|
_p('\t$(SILENT) %s -o "$@" -MF "$(@:%%.gch=%%.d)" -c "$<"', cmd)
|
||||||
|
|
||||||
|
_p('else')
|
||||||
|
_p('$(OBJECTS): | $(OBJDIR)')
|
||||||
_p('endif')
|
_p('endif')
|
||||||
_p('')
|
_p('')
|
||||||
end
|
end
|
||||||
|
@ -37,19 +37,9 @@
|
|||||||
test.capture [[
|
test.capture [[
|
||||||
$(OBJDIR)/hello.o: src/greetings/hello.cpp
|
$(OBJDIR)/hello.o: src/greetings/hello.cpp
|
||||||
@echo $(notdir $<)
|
@echo $(notdir $<)
|
||||||
ifeq (posix,$(SHELLTYPE))
|
|
||||||
$(SILENT) mkdir -p $(OBJDIR)
|
|
||||||
else
|
|
||||||
$(SILENT) mkdir $(subst /,\\,$(OBJDIR))
|
|
||||||
endif
|
|
||||||
$(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
|
$(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
|
||||||
$(OBJDIR)/hello1.o: src/hello.cpp
|
$(OBJDIR)/hello1.o: src/hello.cpp
|
||||||
@echo $(notdir $<)
|
@echo $(notdir $<)
|
||||||
ifeq (posix,$(SHELLTYPE))
|
|
||||||
$(SILENT) mkdir -p $(OBJDIR)
|
|
||||||
else
|
|
||||||
$(SILENT) mkdir $(subst /,\\,$(OBJDIR))
|
|
||||||
endif
|
|
||||||
$(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
|
$(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
|
||||||
|
|
||||||
]]
|
]]
|
||||||
@ -66,24 +56,61 @@ endif
|
|||||||
test.capture [[
|
test.capture [[
|
||||||
$(OBJDIR)/hello.o: src/hello.c
|
$(OBJDIR)/hello.o: src/hello.c
|
||||||
@echo $(notdir $<)
|
@echo $(notdir $<)
|
||||||
ifeq (posix,$(SHELLTYPE))
|
|
||||||
$(SILENT) mkdir -p $(OBJDIR)
|
|
||||||
else
|
|
||||||
$(SILENT) mkdir $(subst /,\\,$(OBJDIR))
|
|
||||||
endif
|
|
||||||
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
|
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
|
||||||
$(OBJDIR)/test.o: src/test.cpp
|
$(OBJDIR)/test.o: src/test.cpp
|
||||||
@echo $(notdir $<)
|
@echo $(notdir $<)
|
||||||
ifeq (posix,$(SHELLTYPE))
|
|
||||||
$(SILENT) mkdir -p $(OBJDIR)
|
|
||||||
else
|
|
||||||
$(SILENT) mkdir $(subst /,\\,$(OBJDIR))
|
|
||||||
endif
|
|
||||||
$(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
|
$(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
|
||||||
|
|
||||||
]]
|
]]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--
|
||||||
|
-- C files in C++ projects can be compiled as C++ with 'compileas'
|
||||||
|
--
|
||||||
|
|
||||||
|
function suite.cFilesGetsCompiledWithCXXWithCompileas()
|
||||||
|
files { "src/hello.c", "src/test.c" }
|
||||||
|
filter { "files:src/hello.c" }
|
||||||
|
compileas "C++"
|
||||||
|
prepare()
|
||||||
|
test.capture [[
|
||||||
|
$(OBJDIR)/hello.o: src/hello.c
|
||||||
|
@echo $(notdir $<)
|
||||||
|
ifeq ($(config),debug)
|
||||||
|
$(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
|
||||||
|
endif
|
||||||
|
ifeq ($(config),release)
|
||||||
|
$(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
|
||||||
|
endif
|
||||||
|
$(OBJDIR)/test.o: src/test.c
|
||||||
|
@echo $(notdir $<)
|
||||||
|
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
|
||||||
|
]]
|
||||||
|
end
|
||||||
|
|
||||||
|
--
|
||||||
|
-- C files in C++ projects can be compiled as C++ with 'compileas' on a configuration basis
|
||||||
|
--
|
||||||
|
|
||||||
|
function suite.cFilesGetsCompiledWithCXXWithCompileasDebugOnly()
|
||||||
|
files { "src/test.c", "src/hello.c" }
|
||||||
|
filter { "configurations:Debug", "files:src/hello.c" }
|
||||||
|
compileas "C++"
|
||||||
|
prepare()
|
||||||
|
test.capture [[
|
||||||
|
$(OBJDIR)/hello.o: src/hello.c
|
||||||
|
@echo $(notdir $<)
|
||||||
|
ifeq ($(config),debug)
|
||||||
|
$(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
|
||||||
|
endif
|
||||||
|
ifeq ($(config),release)
|
||||||
|
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
|
||||||
|
endif
|
||||||
|
$(OBJDIR)/test.o: src/test.c
|
||||||
|
@echo $(notdir $<)
|
||||||
|
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
|
||||||
|
]]
|
||||||
|
end
|
||||||
|
|
||||||
--
|
--
|
||||||
-- If a custom build rule is supplied, it should be used.
|
-- If a custom build rule is supplied, it should be used.
|
||||||
|
@ -93,15 +93,12 @@
|
|||||||
prepareRules()
|
prepareRules()
|
||||||
test.capture [[
|
test.capture [[
|
||||||
ifneq (,$(PCH))
|
ifneq (,$(PCH))
|
||||||
$(OBJECTS): $(GCH) $(PCH)
|
$(OBJECTS): $(GCH) $(PCH) | $(OBJDIR)
|
||||||
$(GCH): $(PCH)
|
$(GCH): $(PCH) | $(OBJDIR)
|
||||||
@echo $(notdir $<)
|
@echo $(notdir $<)
|
||||||
ifeq (posix,$(SHELLTYPE))
|
|
||||||
$(SILENT) mkdir -p $(OBJDIR)
|
|
||||||
else
|
|
||||||
$(SILENT) mkdir $(subst /,\\,$(OBJDIR))
|
|
||||||
endif
|
|
||||||
$(SILENT) $(CXX) -x c++-header $(ALL_CXXFLAGS) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<"
|
$(SILENT) $(CXX) -x c++-header $(ALL_CXXFLAGS) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<"
|
||||||
|
else
|
||||||
|
$(OBJECTS): | $(OBJDIR)
|
||||||
endif
|
endif
|
||||||
]]
|
]]
|
||||||
end
|
end
|
||||||
@ -117,15 +114,12 @@ endif
|
|||||||
prepareRules()
|
prepareRules()
|
||||||
test.capture [[
|
test.capture [[
|
||||||
ifneq (,$(PCH))
|
ifneq (,$(PCH))
|
||||||
$(OBJECTS): $(GCH) $(PCH)
|
$(OBJECTS): $(GCH) $(PCH) | $(OBJDIR)
|
||||||
$(GCH): $(PCH)
|
$(GCH): $(PCH) | $(OBJDIR)
|
||||||
@echo $(notdir $<)
|
@echo $(notdir $<)
|
||||||
ifeq (posix,$(SHELLTYPE))
|
|
||||||
$(SILENT) mkdir -p $(OBJDIR)
|
|
||||||
else
|
|
||||||
$(SILENT) mkdir $(subst /,\\,$(OBJDIR))
|
|
||||||
endif
|
|
||||||
$(SILENT) $(CC) -x c-header $(ALL_CFLAGS) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<"
|
$(SILENT) $(CC) -x c-header $(ALL_CFLAGS) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<"
|
||||||
|
else
|
||||||
|
$(OBJECTS): | $(OBJDIR)
|
||||||
endif
|
endif
|
||||||
]]
|
]]
|
||||||
end
|
end
|
||||||
|
@ -273,12 +273,9 @@
|
|||||||
|
|
||||||
|
|
||||||
function gmake2.shellType()
|
function gmake2.shellType()
|
||||||
_p('SHELLTYPE := msdos')
|
_p('SHELLTYPE := posix')
|
||||||
_p('ifeq (,$(ComSpec)$(COMSPEC))')
|
_p('ifeq (.exe,$(findstring .exe,$(ComSpec)))')
|
||||||
_p(' SHELLTYPE := posix')
|
_p('\tSHELLTYPE := msdos')
|
||||||
_p('endif')
|
|
||||||
_p('ifeq (/bin,$(findstring /bin,$(SHELL)))')
|
|
||||||
_p(' SHELLTYPE := posix')
|
|
||||||
_p('endif')
|
_p('endif')
|
||||||
_p('')
|
_p('')
|
||||||
end
|
end
|
||||||
|
@ -60,13 +60,13 @@
|
|||||||
fileExtension { ".cc", ".cpp", ".cxx", ".mm" }
|
fileExtension { ".cc", ".cpp", ".cxx", ".mm" }
|
||||||
buildoutputs { "$(OBJDIR)/%{premake.modules.gmake2.cpp.makeUnique(cfg, file.objname)}.o" }
|
buildoutputs { "$(OBJDIR)/%{premake.modules.gmake2.cpp.makeUnique(cfg, file.objname)}.o" }
|
||||||
buildmessage '$(notdir $<)'
|
buildmessage '$(notdir $<)'
|
||||||
buildcommands {'$(CXX) $(%{premake.modules.gmake2.cpp.fileFlags(cfg, file)}) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"'}
|
buildcommands {'$(CXX) %{premake.modules.gmake2.cpp.fileFlags(cfg, file)} $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"'}
|
||||||
|
|
||||||
rule 'cc'
|
rule 'cc'
|
||||||
fileExtension {".c", ".s", ".m"}
|
fileExtension {".c", ".s", ".m"}
|
||||||
buildoutputs { "$(OBJDIR)/%{premake.modules.gmake2.cpp.makeUnique(cfg, file.objname)}.o" }
|
buildoutputs { "$(OBJDIR)/%{premake.modules.gmake2.cpp.makeUnique(cfg, file.objname)}.o" }
|
||||||
buildmessage '$(notdir $<)'
|
buildmessage '$(notdir $<)'
|
||||||
buildcommands {'$(CC) $(%{premake.modules.gmake2.cpp.fileFlags(cfg, file)}) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"'}
|
buildcommands {'$(CC) %{premake.modules.gmake2.cpp.fileFlags(cfg, file)} $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"'}
|
||||||
|
|
||||||
rule 'resource'
|
rule 'resource'
|
||||||
fileExtension ".rc"
|
fileExtension ".rc"
|
||||||
@ -198,6 +198,21 @@
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function cpp.determineFiletype(cfg, node)
|
||||||
|
-- determine which filetype to use
|
||||||
|
local filecfg = fileconfig.getconfig(node, cfg)
|
||||||
|
local fileext = path.getextension(node.abspath):lower()
|
||||||
|
if filecfg and filecfg.compileas then
|
||||||
|
if p.languages.isc(filecfg.compileas) then
|
||||||
|
fileext = ".c"
|
||||||
|
elseif p.languages.iscpp(filecfg.compileas) then
|
||||||
|
fileext = ".cpp"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return fileext;
|
||||||
|
end
|
||||||
|
|
||||||
function cpp.addGeneratedFile(cfg, source, filename)
|
function cpp.addGeneratedFile(cfg, source, filename)
|
||||||
-- mark that we have generated files.
|
-- mark that we have generated files.
|
||||||
cfg.project.hasGeneratedFiles = true
|
cfg.project.hasGeneratedFiles = true
|
||||||
@ -220,9 +235,11 @@
|
|||||||
fileconfig.addconfig(node, cfg)
|
fileconfig.addconfig(node, cfg)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- determine which filetype to use
|
||||||
|
local fileext = cpp.determineFiletype(cfg, node)
|
||||||
-- add file to the fileset.
|
-- add file to the fileset.
|
||||||
local filesets = cfg.project._gmake.filesets
|
local filesets = cfg.project._gmake.filesets
|
||||||
local kind = filesets[path.getextension(filename):lower()] or "CUSTOM"
|
local kind = filesets[fileext] or "CUSTOM"
|
||||||
|
|
||||||
-- don't link generated object files automatically if it's explicitly
|
-- don't link generated object files automatically if it's explicitly
|
||||||
-- disabled.
|
-- disabled.
|
||||||
@ -260,7 +277,8 @@
|
|||||||
|
|
||||||
function cpp.addRuleFile(cfg, node)
|
function cpp.addRuleFile(cfg, node)
|
||||||
local rules = cfg.project._gmake.rules
|
local rules = cfg.project._gmake.rules
|
||||||
local rule = rules[path.getextension(node.abspath):lower()]
|
local fileext = cpp.determineFiletype(cfg, node)
|
||||||
|
local rule = rules[fileext]
|
||||||
if rule then
|
if rule then
|
||||||
|
|
||||||
local filecfg = fileconfig.getconfig(node, cfg)
|
local filecfg = fileconfig.getconfig(node, cfg)
|
||||||
@ -425,9 +443,6 @@
|
|||||||
|
|
||||||
function cpp.forceInclude(cfg, toolset)
|
function cpp.forceInclude(cfg, toolset)
|
||||||
local includes = toolset.getforceincludes(cfg)
|
local includes = toolset.getforceincludes(cfg)
|
||||||
if not cfg.flags.NoPCH and cfg.pchheader then
|
|
||||||
table.insert(includes, 1, "-include $(PCH_PLACEHOLDER)")
|
|
||||||
end
|
|
||||||
p.outln('FORCE_INCLUDE +=' .. gmake2.list(includes))
|
p.outln('FORCE_INCLUDE +=' .. gmake2.list(includes))
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -530,7 +545,7 @@
|
|||||||
_p('')
|
_p('')
|
||||||
end
|
end
|
||||||
|
|
||||||
local function makeVarName(prj, value, saltValue)
|
function cpp.makeVarName(prj, value, saltValue)
|
||||||
prj._gmake = prj._gmake or {}
|
prj._gmake = prj._gmake or {}
|
||||||
prj._gmake.varlist = prj._gmake.varlist or {}
|
prj._gmake.varlist = prj._gmake.varlist or {}
|
||||||
prj._gmake.varlistlength = prj._gmake.varlistlength or 0
|
prj._gmake.varlistlength = prj._gmake.varlistlength or 0
|
||||||
@ -554,7 +569,10 @@
|
|||||||
function cpp.perFileFlags(cfg, fcfg)
|
function cpp.perFileFlags(cfg, fcfg)
|
||||||
local toolset = gmake2.getToolSet(cfg)
|
local toolset = gmake2.getToolSet(cfg)
|
||||||
|
|
||||||
local value = gmake2.list(table.join(toolset.getcflags(fcfg), fcfg.buildoptions))
|
local isCFile = path.iscfile(fcfg.name)
|
||||||
|
|
||||||
|
local getflags = iif(isCFile, toolset.getcflags, toolset.getcxxflags)
|
||||||
|
local value = gmake2.list(table.join(getflags(fcfg), fcfg.buildoptions))
|
||||||
|
|
||||||
if fcfg.defines or fcfg.undefines then
|
if fcfg.defines or fcfg.undefines then
|
||||||
local defs = table.join(toolset.getdefines(fcfg.defines, cfg), toolset.getundefines(fcfg.undefines))
|
local defs = table.join(toolset.getdefines(fcfg.defines, cfg), toolset.getundefines(fcfg.undefines))
|
||||||
@ -572,9 +590,9 @@
|
|||||||
|
|
||||||
if #value > 0 then
|
if #value > 0 then
|
||||||
local newPerFileFlag = false
|
local newPerFileFlag = false
|
||||||
fcfg.flagsVariable, newPerFileFlag = makeVarName(cfg.project, value, iif(path.iscfile(fcfg.name), '_C', '_CPP'))
|
fcfg.flagsVariable, newPerFileFlag = cpp.makeVarName(cfg.project, value, iif(isCFile, '_C', '_CPP'))
|
||||||
if newPerFileFlag then
|
if newPerFileFlag then
|
||||||
if path.iscfile(fcfg.name) then
|
if isCFile then
|
||||||
_p('%s = $(ALL_CFLAGS)%s', fcfg.flagsVariable, value)
|
_p('%s = $(ALL_CFLAGS)%s', fcfg.flagsVariable, value)
|
||||||
else
|
else
|
||||||
_p('%s = $(ALL_CXXFLAGS)%s', fcfg.flagsVariable, value)
|
_p('%s = $(ALL_CXXFLAGS)%s', fcfg.flagsVariable, value)
|
||||||
@ -585,15 +603,25 @@
|
|||||||
|
|
||||||
function cpp.fileFlags(cfg, file)
|
function cpp.fileFlags(cfg, file)
|
||||||
local fcfg = fileconfig.getconfig(file, cfg)
|
local fcfg = fileconfig.getconfig(file, cfg)
|
||||||
if fcfg and fcfg.flagsVariable then
|
local flags = {}
|
||||||
return fcfg.flagsVariable
|
|
||||||
|
if cfg.pchheader and not cfg.flags.NoPCH and (not fcfg or not fcfg.flags.NoPCH) then
|
||||||
|
table.insert(flags, "-include $(PCH_PLACEHOLDER)")
|
||||||
end
|
end
|
||||||
|
|
||||||
if path.iscfile(file.name) then
|
if fcfg and fcfg.flagsVariable then
|
||||||
return 'ALL_CFLAGS'
|
table.insert(flags, string.format("$(%s)", fcfg.flagsVariable))
|
||||||
else
|
else
|
||||||
return 'ALL_CXXFLAGS'
|
local fileExt = cpp.determineFiletype(cfg, file)
|
||||||
|
|
||||||
|
if path.iscfile(fileExt) then
|
||||||
|
table.insert(flags, "$(ALL_CFLAGS)")
|
||||||
|
elseif path.iscppfile(fileExt) then
|
||||||
|
table.insert(flags, "$(ALL_CXXFLAGS)")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
return table.concat(flags, ' ')
|
||||||
end
|
end
|
||||||
|
|
||||||
--
|
--
|
||||||
@ -809,9 +837,6 @@
|
|||||||
-- include the dependencies, built by GCC (with the -MMD flag)
|
-- include the dependencies, built by GCC (with the -MMD flag)
|
||||||
_p('-include $(OBJECTS:%%.o=%%.d)')
|
_p('-include $(OBJECTS:%%.o=%%.d)')
|
||||||
_p('ifneq (,$(PCH))')
|
_p('ifneq (,$(PCH))')
|
||||||
_p(' -include "$(PCH_PLACEHOLDER).d"')
|
_p(' -include $(PCH_PLACEHOLDER).d')
|
||||||
_p('endif')
|
_p('endif')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -231,6 +231,8 @@
|
|||||||
|
|
||||||
utility.elements.configuration = function(cfg)
|
utility.elements.configuration = function(cfg)
|
||||||
return {
|
return {
|
||||||
|
utility.bindirs,
|
||||||
|
utility.exepaths,
|
||||||
gmake2.settings,
|
gmake2.settings,
|
||||||
gmake2.preBuildCmds,
|
gmake2.preBuildCmds,
|
||||||
gmake2.preLinkCmds,
|
gmake2.preLinkCmds,
|
||||||
@ -247,6 +249,21 @@
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function utility.bindirs(cfg, toolset)
|
||||||
|
local dirs = project.getrelative(cfg.project, cfg.bindirs)
|
||||||
|
if #dirs > 0 then
|
||||||
|
p.outln('EXECUTABLE_PATHS = "' .. table.concat(dirs, ":") .. '"')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function utility.exepaths(cfg, toolset)
|
||||||
|
local dirs = project.getrelative(cfg.project, cfg.bindirs)
|
||||||
|
if #dirs > 0 then
|
||||||
|
p.outln('EXE_PATHS = PATH=$(EXECUTABLE_PATHS):$$PATH;')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Write out the file sets.
|
-- Write out the file sets.
|
||||||
@ -365,7 +382,7 @@
|
|||||||
function utility.outputFileRules(cfg, file)
|
function utility.outputFileRules(cfg, file)
|
||||||
local outputs = table.concat(file.buildoutputs, ' ')
|
local outputs = table.concat(file.buildoutputs, ' ')
|
||||||
|
|
||||||
local dependencies = file.source
|
local dependencies = p.esc(file.source)
|
||||||
if file.buildinputs and #file.buildinputs > 0 then
|
if file.buildinputs and #file.buildinputs > 0 then
|
||||||
dependencies = dependencies .. " " .. table.concat(p.esc(file.buildinputs), " ")
|
dependencies = dependencies .. " " .. table.concat(p.esc(file.buildinputs), " ")
|
||||||
end
|
end
|
||||||
@ -379,7 +396,11 @@
|
|||||||
if file.buildcommands then
|
if file.buildcommands then
|
||||||
local cmds = os.translateCommandsAndPaths(file.buildcommands, cfg.project.basedir, cfg.project.location)
|
local cmds = os.translateCommandsAndPaths(file.buildcommands, cfg.project.basedir, cfg.project.location)
|
||||||
for _, cmd in ipairs(cmds) do
|
for _, cmd in ipairs(cmds) do
|
||||||
_p('\t$(SILENT) %s', cmd)
|
if cfg.bindirs and #cfg.bindirs > 0 then
|
||||||
|
_p('\t$(SILENT) $(EXE_PATHS) %s', cmd)
|
||||||
|
else
|
||||||
|
_p('\t$(SILENT) %s', cmd)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -97,6 +97,61 @@ $(OBJDIR)/test.o: src/test.cpp
|
|||||||
]]
|
]]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--
|
||||||
|
-- C files in C++ projects can be compiled as C++ with compileas
|
||||||
|
--
|
||||||
|
|
||||||
|
function suite.cFilesGetsCompiledWithCXXWithCompileas()
|
||||||
|
files { "src/hello.c", "src/test.c" }
|
||||||
|
filter { "files:src/hello.c" }
|
||||||
|
compileas "C++"
|
||||||
|
prepare()
|
||||||
|
test.capture [[
|
||||||
|
# File Rules
|
||||||
|
# #############################################
|
||||||
|
|
||||||
|
$(OBJDIR)/hello.o: src/hello.c
|
||||||
|
@echo $(notdir $<)
|
||||||
|
$(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
|
||||||
|
$(OBJDIR)/test.o: src/test.c
|
||||||
|
@echo $(notdir $<)
|
||||||
|
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
|
||||||
|
]]
|
||||||
|
end
|
||||||
|
|
||||||
|
--
|
||||||
|
-- C files in C++ projects can be compiled as C++ with 'compileas' on a configuration basis
|
||||||
|
--
|
||||||
|
|
||||||
|
function suite.cFilesGetsCompiledWithCXXWithCompileasDebugOnly()
|
||||||
|
files { "src/hello.c", "src/test.c" }
|
||||||
|
filter { "configurations:Debug", "files:src/hello.c" }
|
||||||
|
compileas "C++"
|
||||||
|
prepare()
|
||||||
|
test.capture [[
|
||||||
|
# File Rules
|
||||||
|
# #############################################
|
||||||
|
|
||||||
|
$(OBJDIR)/test.o: src/test.c
|
||||||
|
@echo $(notdir $<)
|
||||||
|
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
|
||||||
|
|
||||||
|
ifeq ($(config),debug)
|
||||||
|
$(OBJDIR)/hello.o: src/hello.c
|
||||||
|
@echo $(notdir $<)
|
||||||
|
$(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
|
||||||
|
|
||||||
|
else ifeq ($(config),release)
|
||||||
|
$(OBJDIR)/hello.o: src/hello.c
|
||||||
|
@echo $(notdir $<)
|
||||||
|
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
|
||||||
|
|
||||||
|
else
|
||||||
|
$(error "invalid configuration $(config)")
|
||||||
|
endif
|
||||||
|
]]
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- If a custom build rule is supplied, it should be used.
|
-- If a custom build rule is supplied, it should be used.
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
local wks, prj
|
local wks, prj
|
||||||
function suite.setup()
|
function suite.setup()
|
||||||
os.chdir(_TESTS_DIR)
|
os.chdir(_TESTS_DIR)
|
||||||
|
gmake2.cpp.initialize()
|
||||||
wks, prj = test.createWorkspace()
|
wks, prj = test.createWorkspace()
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -34,6 +35,12 @@
|
|||||||
gmake2.cpp.pchRules(cfg.project)
|
gmake2.cpp.pchRules(cfg.project)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function prepareFlags()
|
||||||
|
local project = test.getproject(wks, 1)
|
||||||
|
gmake2.cpp.createRuleTable(project)
|
||||||
|
gmake2.cpp.createFileTable(project)
|
||||||
|
gmake2.cpp.outputFileRuleSection(project)
|
||||||
|
end
|
||||||
|
|
||||||
--
|
--
|
||||||
-- If no header has been set, nothing should be output.
|
-- If no header has been set, nothing should be output.
|
||||||
@ -53,8 +60,21 @@
|
|||||||
function suite.noConfig_onHeaderAndNoPCHFlag()
|
function suite.noConfig_onHeaderAndNoPCHFlag()
|
||||||
pchheader "include/myproject.h"
|
pchheader "include/myproject.h"
|
||||||
flags "NoPCH"
|
flags "NoPCH"
|
||||||
prepareVars()
|
|
||||||
test.isemptycapture()
|
files { 'a.cpp', 'b.cpp' }
|
||||||
|
|
||||||
|
prepareFlags()
|
||||||
|
test.capture [[
|
||||||
|
# File Rules
|
||||||
|
# #############################################
|
||||||
|
|
||||||
|
$(OBJDIR)/a.o: a.cpp
|
||||||
|
@echo $(notdir $<)
|
||||||
|
$(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
|
||||||
|
$(OBJDIR)/b.o: b.cpp
|
||||||
|
@echo $(notdir $<)
|
||||||
|
$(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
|
||||||
|
]]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -156,3 +176,49 @@ endif
|
|||||||
PCH = ../../../../src/host/premake.h
|
PCH = ../../../../src/host/premake.h
|
||||||
]]
|
]]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--
|
||||||
|
-- If the header is located on one of the include file
|
||||||
|
-- search directories, it should get found automatically.
|
||||||
|
--
|
||||||
|
|
||||||
|
function suite.PCHFlag()
|
||||||
|
pchheader "include/myproject.h"
|
||||||
|
|
||||||
|
files { 'a.cpp', 'b.cpp' }
|
||||||
|
|
||||||
|
prepareFlags()
|
||||||
|
test.capture [[
|
||||||
|
# File Rules
|
||||||
|
# #############################################
|
||||||
|
|
||||||
|
$(OBJDIR)/a.o: a.cpp
|
||||||
|
@echo $(notdir $<)
|
||||||
|
$(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
|
||||||
|
$(OBJDIR)/b.o: b.cpp
|
||||||
|
@echo $(notdir $<)
|
||||||
|
$(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
|
||||||
|
]]
|
||||||
|
end
|
||||||
|
|
||||||
|
function suite.PCHFlag_PerFile()
|
||||||
|
pchheader "include/myproject.h"
|
||||||
|
|
||||||
|
files { 'a.cpp', 'b.cpp' }
|
||||||
|
|
||||||
|
filter { "files:a.cpp" }
|
||||||
|
flags "NoPCH"
|
||||||
|
|
||||||
|
prepareFlags()
|
||||||
|
test.capture [[
|
||||||
|
# File Rules
|
||||||
|
# #############################################
|
||||||
|
|
||||||
|
$(OBJDIR)/a.o: a.cpp
|
||||||
|
@echo $(notdir $<)
|
||||||
|
$(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
|
||||||
|
$(OBJDIR)/b.o: b.cpp
|
||||||
|
@echo $(notdir $<)
|
||||||
|
$(SILENT) $(CXX) -include $(PCH_PLACEHOLDER) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
|
||||||
|
]]
|
||||||
|
end
|
||||||
|
@ -73,3 +73,20 @@ PERFILE_FLAGS_1 = $(ALL_CXXFLAGS) -msse -msse2 -mfpmath=sse,387
|
|||||||
PERFILE_FLAGS_2 = $(ALL_CFLAGS) -msse -msse2 -mfpmath=sse,387 -msse3 -mssse3 -msse4.1 -maes
|
PERFILE_FLAGS_2 = $(ALL_CFLAGS) -msse -msse2 -mfpmath=sse,387 -msse3 -mssse3 -msse4.1 -maes
|
||||||
]]
|
]]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function suite.perfile_cxxApi()
|
||||||
|
files { 'a.cpp', 'b.cpp', 'c.cpp' }
|
||||||
|
|
||||||
|
visibility "Hidden"
|
||||||
|
|
||||||
|
filter { 'files:b.cpp' }
|
||||||
|
visibility "Protected"
|
||||||
|
|
||||||
|
prepare()
|
||||||
|
test.capture [[
|
||||||
|
# Per File Configurations
|
||||||
|
# #############################################
|
||||||
|
|
||||||
|
PERFILE_FLAGS_0 = $(ALL_CXXFLAGS) -fvisibility=protected
|
||||||
|
]]
|
||||||
|
end
|
||||||
|
@ -69,7 +69,6 @@ return {
|
|||||||
"vc2010/test_files.lua",
|
"vc2010/test_files.lua",
|
||||||
"vc2010/test_filter_ids.lua",
|
"vc2010/test_filter_ids.lua",
|
||||||
"vc2010/test_filters.lua",
|
"vc2010/test_filters.lua",
|
||||||
"vc2010/test_imagexex_settings.lua",
|
|
||||||
"vc2010/test_item_def_group.lua",
|
"vc2010/test_item_def_group.lua",
|
||||||
"vc2010/test_link.lua",
|
"vc2010/test_link.lua",
|
||||||
"vc2010/test_manifest.lua",
|
"vc2010/test_manifest.lua",
|
||||||
|
@ -460,35 +460,6 @@ EndGlobalSection
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- If the platform identifier matches a system or architecture, omit it
|
|
||||||
-- from the configuration description.
|
|
||||||
--
|
|
||||||
|
|
||||||
function suite.onSingleCpp_withPlatformsMatchingArch_noArchs()
|
|
||||||
platforms { "x86", "Xbox360" }
|
|
||||||
project "MyProject"
|
|
||||||
prepare()
|
|
||||||
test.capture [[
|
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
|
||||||
Debug|Win32 = Debug|Win32
|
|
||||||
Debug|Xbox 360 = Debug|Xbox 360
|
|
||||||
Release|Win32 = Release|Win32
|
|
||||||
Release|Xbox 360 = Release|Xbox 360
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
|
||||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|Win32.ActiveCfg = Debug|Win32
|
|
||||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|Win32.Build.0 = Debug|Win32
|
|
||||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|Xbox 360.ActiveCfg = Debug|Xbox 360
|
|
||||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|Xbox 360.Build.0 = Debug|Xbox 360
|
|
||||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|Win32.ActiveCfg = Release|Win32
|
|
||||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|Win32.Build.0 = Release|Win32
|
|
||||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|Xbox 360.ActiveCfg = Release|Xbox 360
|
|
||||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|Xbox 360.Build.0 = Release|Xbox 360
|
|
||||||
EndGlobalSection
|
|
||||||
]]
|
|
||||||
end
|
|
||||||
|
|
||||||
function suite.onSingleCs_withPlatformsMatchingArch_noArchs()
|
function suite.onSingleCs_withPlatformsMatchingArch_noArchs()
|
||||||
platforms { "x86", "x86_64" }
|
platforms { "x86", "x86_64" }
|
||||||
project "MyProject"
|
project "MyProject"
|
||||||
|
@ -441,29 +441,6 @@
|
|||||||
]]
|
]]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Xbox 360 uses the same structure, but changes the element name.
|
|
||||||
--
|
|
||||||
|
|
||||||
function suite.looksGood_onXbox360()
|
|
||||||
system "Xbox360"
|
|
||||||
prepare()
|
|
||||||
test.capture [[
|
|
||||||
<Tool
|
|
||||||
Name="VCCLX360CompilerTool"
|
|
||||||
Optimization="0"
|
|
||||||
BasicRuntimeChecks="3"
|
|
||||||
RuntimeLibrary="2"
|
|
||||||
EnableFunctionLevelLinking="true"
|
|
||||||
UsePrecompiledHeader="0"
|
|
||||||
WarningLevel="3"
|
|
||||||
DebugInformationFormat="0"
|
|
||||||
/>
|
|
||||||
]]
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Check handling of forced includes.
|
-- Check handling of forced includes.
|
||||||
--
|
--
|
||||||
|
@ -78,20 +78,3 @@
|
|||||||
</Platforms>
|
</Platforms>
|
||||||
]]
|
]]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Verify the Xbox360 platform.
|
|
||||||
--
|
|
||||||
|
|
||||||
function suite.platformIsCorrect_onXbox360()
|
|
||||||
platforms { "Xbox360" }
|
|
||||||
prepare()
|
|
||||||
test.capture [[
|
|
||||||
<Platforms>
|
|
||||||
<Platform
|
|
||||||
Name="Xbox 360"
|
|
||||||
/>
|
|
||||||
</Platforms>
|
|
||||||
]]
|
|
||||||
end
|
|
||||||
|
@ -293,3 +293,52 @@
|
|||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
]]
|
]]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Check the WindowsSDKDesktopARMSupport element
|
||||||
|
--
|
||||||
|
|
||||||
|
function suite.WindowsSDKDesktopARMSupport_off()
|
||||||
|
system "ios"
|
||||||
|
architecture "ARM"
|
||||||
|
prepare()
|
||||||
|
test.capture [[
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<PlatformToolset>v100</PlatformToolset>
|
||||||
|
</PropertyGroup>
|
||||||
|
]]
|
||||||
|
end
|
||||||
|
|
||||||
|
function suite.WindowsSDKDesktopARMSupport_on()
|
||||||
|
system "windows"
|
||||||
|
architecture "ARM"
|
||||||
|
prepare()
|
||||||
|
test.capture [[
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<PlatformToolset>v100</PlatformToolset>
|
||||||
|
<WindowsSDKDesktopARMSupport>true</WindowsSDKDesktopARMSupport>
|
||||||
|
</PropertyGroup>
|
||||||
|
]]
|
||||||
|
end
|
||||||
|
|
||||||
|
function suite.WindowsSDKDesktopARM64Support()
|
||||||
|
system "windows"
|
||||||
|
architecture "ARM64"
|
||||||
|
prepare()
|
||||||
|
test.capture [[
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<PlatformToolset>v100</PlatformToolset>
|
||||||
|
<WindowsSDKDesktopARM64Support>true</WindowsSDKDesktopARM64Support>
|
||||||
|
</PropertyGroup>
|
||||||
|
]]
|
||||||
|
end
|
||||||
|
@ -90,6 +90,30 @@
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Check handling of buildaction.
|
||||||
|
--
|
||||||
|
function suite.customBuildTool_onBuildAction()
|
||||||
|
files { "test.x", "test2.cpp", "test3.cpp" }
|
||||||
|
filter "files:**.x"
|
||||||
|
buildaction "FxCompile"
|
||||||
|
filter "files:test2.cpp"
|
||||||
|
buildaction "None"
|
||||||
|
prepare()
|
||||||
|
test.capture [[
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="test3.cpp" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<FxCompile Include="test.x" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="test2.cpp" />
|
||||||
|
</ItemGroup>
|
||||||
|
]]
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Check handling of files with custom build rules.
|
-- Check handling of files with custom build rules.
|
||||||
--
|
--
|
||||||
@ -437,6 +461,33 @@
|
|||||||
]]
|
]]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Check handling of per-file compileas options.
|
||||||
|
--
|
||||||
|
|
||||||
|
function suite.onCompileAs()
|
||||||
|
files { "hello.c" }
|
||||||
|
filter "files:hello.c"
|
||||||
|
compileas "C++"
|
||||||
|
prepare()
|
||||||
|
test.capture [[
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="hello.c">
|
||||||
|
<CompileAs>CompileAsCpp</CompileAs>
|
||||||
|
]]
|
||||||
|
end
|
||||||
|
|
||||||
|
function suite.onCompileAsDebug()
|
||||||
|
files { "hello.c" }
|
||||||
|
filter { "configurations:Debug", "files:hello.c" }
|
||||||
|
compileas "C++"
|
||||||
|
prepare()
|
||||||
|
test.capture [[
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="hello.c">
|
||||||
|
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">CompileAsCpp</CompileAs>
|
||||||
|
]]
|
||||||
|
end
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Check handling of per-file optimization levels.
|
-- Check handling of per-file optimization levels.
|
||||||
|
@ -1,58 +0,0 @@
|
|||||||
--
|
|
||||||
-- tests/actions/vstudio/vc2010/test_compile_settings.lua
|
|
||||||
-- Validate Xbox 360 XEX image settings in Visual Studio 2010 C/C++ projects.
|
|
||||||
-- Copyright (c) 2011-2013 Jason Perkins and the Premake project
|
|
||||||
--
|
|
||||||
|
|
||||||
local p = premake
|
|
||||||
local suite = test.declare("vstudio_vs2010_imagexex_settings")
|
|
||||||
local vc2010 = p.vstudio.vc2010
|
|
||||||
local project = p.project
|
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Setup
|
|
||||||
--
|
|
||||||
|
|
||||||
local wks, prj
|
|
||||||
|
|
||||||
function suite.setup()
|
|
||||||
p.action.set("vs2010")
|
|
||||||
wks, prj = test.createWorkspace()
|
|
||||||
platforms "xbox360"
|
|
||||||
end
|
|
||||||
|
|
||||||
local function prepare(platform)
|
|
||||||
local cfg = test.getconfig(prj, "Debug", "xbox360")
|
|
||||||
vc2010.imageXex(cfg)
|
|
||||||
end
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Test default ImageXex settings
|
|
||||||
--
|
|
||||||
function suite.defaultSettings()
|
|
||||||
prepare()
|
|
||||||
test.capture [[
|
|
||||||
<ImageXex>
|
|
||||||
<ConfigurationFile>
|
|
||||||
</ConfigurationFile>
|
|
||||||
<AdditionalSections>
|
|
||||||
</AdditionalSections>
|
|
||||||
</ImageXex>
|
|
||||||
]]
|
|
||||||
end
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Ensure configuration file is output in ImageXex block
|
|
||||||
--
|
|
||||||
function suite.onConfigfile()
|
|
||||||
configfile "testconfig.xml"
|
|
||||||
prepare()
|
|
||||||
test.capture [[
|
|
||||||
<ImageXex>
|
|
||||||
<ConfigurationFile>testconfig.xml</ConfigurationFile>
|
|
||||||
<AdditionalSections>
|
|
||||||
</AdditionalSections>
|
|
||||||
</ImageXex>
|
|
||||||
]]
|
|
||||||
end
|
|
@ -621,35 +621,6 @@
|
|||||||
]]
|
]]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Xbox 360 doesn't list a subsystem or entry point.
|
|
||||||
--
|
|
||||||
|
|
||||||
function suite.onXbox360()
|
|
||||||
kind "ConsoleApp"
|
|
||||||
system "Xbox360"
|
|
||||||
prepare()
|
|
||||||
test.capture [[
|
|
||||||
]]
|
|
||||||
end
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Xbox 360 uses .lib for library extensions
|
|
||||||
--
|
|
||||||
function suite.libAdded_onXbox360SystemLibs()
|
|
||||||
kind "ConsoleApp"
|
|
||||||
system "Xbox360"
|
|
||||||
links { "user32" }
|
|
||||||
prepare()
|
|
||||||
test.capture [[
|
|
||||||
<Link>
|
|
||||||
<AdditionalDependencies>user32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
|
||||||
</Link>
|
|
||||||
]]
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Check handling of warning flags.
|
-- Check handling of warning flags.
|
||||||
--
|
--
|
||||||
|
@ -60,44 +60,6 @@
|
|||||||
test.isemptycapture()
|
test.isemptycapture()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Xbox360 adds an extra <OutputFile> element to the block.
|
|
||||||
--
|
|
||||||
|
|
||||||
function suite.structureIsCorrect_onXbox360()
|
|
||||||
system "Xbox360"
|
|
||||||
prepare()
|
|
||||||
test.capture [[
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Xbox 360'">
|
|
||||||
<LinkIncremental>true</LinkIncremental>
|
|
||||||
<OutDir>bin\Debug\</OutDir>
|
|
||||||
<OutputFile>$(OutDir)MyProject.exe</OutputFile>
|
|
||||||
<IntDir>obj\Debug\</IntDir>
|
|
||||||
<TargetName>MyProject</TargetName>
|
|
||||||
<TargetExt>.exe</TargetExt>
|
|
||||||
<ImageXexOutput>$(OutDir)$(TargetName).xex</ImageXexOutput>
|
|
||||||
</PropertyGroup>
|
|
||||||
]]
|
|
||||||
end
|
|
||||||
|
|
||||||
function suite.staticLibStructureIsCorrect_onXbox360()
|
|
||||||
system "Xbox360"
|
|
||||||
kind "StaticLib"
|
|
||||||
prepare()
|
|
||||||
test.capture [[
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Xbox 360'">
|
|
||||||
<OutDir>bin\Debug\</OutDir>
|
|
||||||
<OutputFile>$(OutDir)MyProject.lib</OutputFile>
|
|
||||||
<IntDir>obj\Debug\</IntDir>
|
|
||||||
<TargetName>MyProject</TargetName>
|
|
||||||
<TargetExt>.lib</TargetExt>
|
|
||||||
<ImageXexOutput>$(OutDir)$(TargetName).xex</ImageXexOutput>
|
|
||||||
</PropertyGroup>
|
|
||||||
]]
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Static libraries should omit the link incremental element entirely.
|
-- Static libraries should omit the link incremental element entirely.
|
||||||
--
|
--
|
||||||
|
@ -43,15 +43,6 @@
|
|||||||
test.isemptycapture()
|
test.isemptycapture()
|
||||||
end
|
end
|
||||||
|
|
||||||
function suite.skips_onXbox360()
|
|
||||||
files { "hello.rc" }
|
|
||||||
defines { "DEBUG" }
|
|
||||||
system "Xbox360"
|
|
||||||
prepare()
|
|
||||||
test.isemptycapture()
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- If defines are specified, the <PreprocessorDefinitions> element should be added.
|
-- If defines are specified, the <PreprocessorDefinitions> element should be added.
|
||||||
--
|
--
|
||||||
|
@ -176,46 +176,26 @@
|
|||||||
m.VCNMakeTool
|
m.VCNMakeTool
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
if cfg.system == p.XBOX360 then
|
|
||||||
return {
|
return {
|
||||||
m.VCPreBuildEventTool,
|
m.VCPreBuildEventTool,
|
||||||
m.VCCustomBuildTool,
|
m.VCCustomBuildTool,
|
||||||
m.VCXMLDataGeneratorTool,
|
m.VCXMLDataGeneratorTool,
|
||||||
m.VCWebServiceProxyGeneratorTool,
|
m.VCWebServiceProxyGeneratorTool,
|
||||||
m.VCMIDLTool,
|
m.VCMIDLTool,
|
||||||
m.VCCLCompilerTool,
|
m.VCCLCompilerTool,
|
||||||
m.VCManagedResourceCompilerTool,
|
m.VCManagedResourceCompilerTool,
|
||||||
m.VCResourceCompilerTool,
|
m.VCResourceCompilerTool,
|
||||||
m.VCPreLinkEventTool,
|
m.VCPreLinkEventTool,
|
||||||
m.VCLinkerTool,
|
m.VCLinkerTool,
|
||||||
m.VCALinkTool,
|
m.VCALinkTool,
|
||||||
m.VCX360ImageTool,
|
m.VCManifestTool,
|
||||||
m.VCBscMakeTool,
|
m.VCXDCMakeTool,
|
||||||
m.VCX360DeploymentTool,
|
m.VCBscMakeTool,
|
||||||
m.VCPostBuildEventTool,
|
m.VCFxCopTool,
|
||||||
m.DebuggerTool,
|
m.VCAppVerifierTool,
|
||||||
}
|
m.VCPostBuildEventTool,
|
||||||
else
|
}
|
||||||
return {
|
|
||||||
m.VCPreBuildEventTool,
|
|
||||||
m.VCCustomBuildTool,
|
|
||||||
m.VCXMLDataGeneratorTool,
|
|
||||||
m.VCWebServiceProxyGeneratorTool,
|
|
||||||
m.VCMIDLTool,
|
|
||||||
m.VCCLCompilerTool,
|
|
||||||
m.VCManagedResourceCompilerTool,
|
|
||||||
m.VCResourceCompilerTool,
|
|
||||||
m.VCPreLinkEventTool,
|
|
||||||
m.VCLinkerTool,
|
|
||||||
m.VCALinkTool,
|
|
||||||
m.VCManifestTool,
|
|
||||||
m.VCXDCMakeTool,
|
|
||||||
m.VCBscMakeTool,
|
|
||||||
m.VCFxCopTool,
|
|
||||||
m.VCAppVerifierTool,
|
|
||||||
m.VCPostBuildEventTool,
|
|
||||||
}
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function m.tools(cfg)
|
function m.tools(cfg)
|
||||||
@ -504,8 +484,6 @@
|
|||||||
local prjcfg, filecfg = config.normalize(cfg)
|
local prjcfg, filecfg = config.normalize(cfg)
|
||||||
if filecfg and fileconfig.hasCustomBuildRule(filecfg) then
|
if filecfg and fileconfig.hasCustomBuildRule(filecfg) then
|
||||||
return "VCCustomBuildTool"
|
return "VCCustomBuildTool"
|
||||||
elseif prjcfg and prjcfg.system == p.XBOX360 then
|
|
||||||
return "VCCLX360CompilerTool"
|
|
||||||
else
|
else
|
||||||
return "VCCLCompilerTool"
|
return "VCCLCompilerTool"
|
||||||
end
|
end
|
||||||
@ -572,8 +550,6 @@
|
|||||||
function m.VCLinkerToolName(cfg)
|
function m.VCLinkerToolName(cfg)
|
||||||
if cfg.kind == p.STATICLIB then
|
if cfg.kind == p.STATICLIB then
|
||||||
return "VCLibrarianTool"
|
return "VCLibrarianTool"
|
||||||
elseif cfg.system == p.XBOX360 then
|
|
||||||
return "VCX360LinkerTool"
|
|
||||||
else
|
else
|
||||||
return "VCLinkerTool"
|
return "VCLinkerTool"
|
||||||
end
|
end
|
||||||
@ -692,32 +668,6 @@
|
|||||||
|
|
||||||
------------
|
------------
|
||||||
|
|
||||||
m.elements.VCX360DeploymentTool = function(cfg)
|
|
||||||
return {
|
|
||||||
m.deploymentType,
|
|
||||||
m.additionalDeploymentOptions,
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
function m.VCX360DeploymentTool(cfg)
|
|
||||||
m.VCTool("VCX360DeploymentTool", cfg)
|
|
||||||
end
|
|
||||||
|
|
||||||
------------
|
|
||||||
|
|
||||||
m.elements.VCX360ImageTool = function(cfg)
|
|
||||||
return {
|
|
||||||
m.additionalImageOptions,
|
|
||||||
m.outputFileName,
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
function m.VCX360ImageTool(cfg)
|
|
||||||
m.VCTool("VCX360ImageTool", cfg)
|
|
||||||
end
|
|
||||||
|
|
||||||
------------
|
|
||||||
|
|
||||||
m.elements.VCXDCMakeTool = function(cfg)
|
m.elements.VCXDCMakeTool = function(cfg)
|
||||||
return {}
|
return {}
|
||||||
end
|
end
|
||||||
@ -813,14 +763,6 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
function m.additionalDeploymentOptions(cfg)
|
|
||||||
if #cfg.deploymentoptions > 0 then
|
|
||||||
p.x('AdditionalOptions="%s"', table.concat(cfg.deploymentoptions, " "))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function m.additionalExternalCompilerOptions(cfg, toolset)
|
function m.additionalExternalCompilerOptions(cfg, toolset)
|
||||||
local buildoptions = table.join(toolset.getcxxflags(cfg), cfg.buildoptions)
|
local buildoptions = table.join(toolset.getcxxflags(cfg), cfg.buildoptions)
|
||||||
if not cfg.flags.NoPCH and cfg.pchheader then
|
if not cfg.flags.NoPCH and cfg.pchheader then
|
||||||
@ -1070,12 +1012,6 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
function m.deploymentType(cfg)
|
|
||||||
p.w('DeploymentType="0"')
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function m.detect64BitPortabilityProblems(cfg)
|
function m.detect64BitPortabilityProblems(cfg)
|
||||||
local prjcfg, filecfg = config.normalize(cfg)
|
local prjcfg, filecfg = config.normalize(cfg)
|
||||||
if _ACTION < "vs2008" and cfg.clr == p.OFF and cfg.warnings ~= p.OFF and not filecfg then
|
if _ACTION < "vs2008" and cfg.clr == p.OFF and cfg.warnings ~= p.OFF and not filecfg then
|
||||||
@ -1104,7 +1040,7 @@
|
|||||||
function m.enableEnhancedInstructionSet(cfg)
|
function m.enableEnhancedInstructionSet(cfg)
|
||||||
local map = { SSE = "1", SSE2 = "2" }
|
local map = { SSE = "1", SSE2 = "2" }
|
||||||
local value = map[cfg.vectorextensions]
|
local value = map[cfg.vectorextensions]
|
||||||
if value and cfg.system ~= "Xbox360" and cfg.architecture ~= "x86_64" then
|
if value and cfg.architecture ~= "x86_64" then
|
||||||
p.w('EnableEnhancedInstructionSet="%d"', value)
|
p.w('EnableEnhancedInstructionSet="%d"', value)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -225,13 +225,11 @@
|
|||||||
m.linkIncremental,
|
m.linkIncremental,
|
||||||
m.ignoreImportLibrary,
|
m.ignoreImportLibrary,
|
||||||
m.outDir,
|
m.outDir,
|
||||||
m.outputFile,
|
|
||||||
m.intDir,
|
m.intDir,
|
||||||
m.targetName,
|
m.targetName,
|
||||||
m.targetExt,
|
m.targetExt,
|
||||||
m.includePath,
|
m.includePath,
|
||||||
m.libraryPath,
|
m.libraryPath,
|
||||||
m.imageXexOutput,
|
|
||||||
m.generateManifest,
|
m.generateManifest,
|
||||||
m.extensionsToDeleteOnClean,
|
m.extensionsToDeleteOnClean,
|
||||||
m.executablePath,
|
m.executablePath,
|
||||||
@ -307,8 +305,6 @@
|
|||||||
m.linker,
|
m.linker,
|
||||||
m.manifest,
|
m.manifest,
|
||||||
m.buildEvents,
|
m.buildEvents,
|
||||||
m.imageXex,
|
|
||||||
m.deploy,
|
|
||||||
m.ruleVars,
|
m.ruleVars,
|
||||||
m.buildLog,
|
m.buildLog,
|
||||||
}
|
}
|
||||||
@ -442,7 +438,7 @@
|
|||||||
end
|
end
|
||||||
|
|
||||||
function m.resourceCompile(cfg)
|
function m.resourceCompile(cfg)
|
||||||
if cfg.system ~= p.XBOX360 and p.config.hasFile(cfg, path.isresourcefile) then
|
if p.config.hasFile(cfg, path.isresourcefile) then
|
||||||
local contents = p.capture(function ()
|
local contents = p.capture(function ()
|
||||||
p.push()
|
p.push()
|
||||||
p.callArray(m.elements.resourceCompile, cfg)
|
p.callArray(m.elements.resourceCompile, cfg)
|
||||||
@ -744,6 +740,7 @@
|
|||||||
m.basicRuntimeChecks,
|
m.basicRuntimeChecks,
|
||||||
m.exceptionHandling,
|
m.exceptionHandling,
|
||||||
m.compileAsManaged,
|
m.compileAsManaged,
|
||||||
|
m.compileAs,
|
||||||
m.runtimeTypeInfo,
|
m.runtimeTypeInfo,
|
||||||
m.warningLevelFile,
|
m.warningLevelFile,
|
||||||
}
|
}
|
||||||
@ -1027,12 +1024,18 @@
|
|||||||
|
|
||||||
|
|
||||||
function m.categorizeFile(prj, file)
|
function m.categorizeFile(prj, file)
|
||||||
-- If any configuration for this file uses a custom build step,
|
|
||||||
-- that's the category to use
|
|
||||||
for cfg in project.eachconfig(prj) do
|
for cfg in project.eachconfig(prj) do
|
||||||
local fcfg = fileconfig.getconfig(file, cfg)
|
local fcfg = fileconfig.getconfig(file, cfg)
|
||||||
if fileconfig.hasCustomBuildRule(fcfg) then
|
if fcfg then
|
||||||
return m.categories.CustomBuild
|
-- If any configuration for this file uses a custom build step, that's the category to use
|
||||||
|
if fileconfig.hasCustomBuildRule(fcfg) then
|
||||||
|
return m.categories.CustomBuild
|
||||||
|
end
|
||||||
|
|
||||||
|
-- also check for buildaction
|
||||||
|
if fcfg.buildaction then
|
||||||
|
return m.categories[fcfg.buildaction] or m.categories.None
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1545,11 +1548,11 @@
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function m.compileAs(cfg)
|
function m.compileAs(cfg, condition)
|
||||||
if p.languages.isc(cfg.compileas) then
|
if p.languages.isc(cfg.compileas) then
|
||||||
m.element("CompileAs", nil, "CompileAsC")
|
m.element("CompileAs", condition, "CompileAsC")
|
||||||
elseif p.languages.iscpp(cfg.compileas) then
|
elseif p.languages.iscpp(cfg.compileas) then
|
||||||
m.element("CompileAs", nil, "CompileAsCpp")
|
m.element("CompileAs", condition, "CompileAsCpp")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1607,17 +1610,6 @@
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function m.deploy(cfg)
|
|
||||||
if cfg.system == p.XBOX360 then
|
|
||||||
p.push('<Deploy>')
|
|
||||||
m.element("DeploymentType", nil, "CopyToHardDrive")
|
|
||||||
m.element("DvdEmulationType", nil, "ZeroSeekTimes")
|
|
||||||
m.element("DeploymentFiles", nil, "$(RemoteRoot)=$(ImagePath);")
|
|
||||||
p.pop('</Deploy>')
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
function m.enableDpiAwareness(cfg)
|
function m.enableDpiAwareness(cfg)
|
||||||
local awareness = {
|
local awareness = {
|
||||||
None = "false",
|
None = "false",
|
||||||
@ -1842,29 +1834,6 @@
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function m.imageXex(cfg)
|
|
||||||
if cfg.system == p.XBOX360 then
|
|
||||||
p.push('<ImageXex>')
|
|
||||||
if cfg.configfile then
|
|
||||||
m.element("ConfigurationFile", nil, "%s", cfg.configfile)
|
|
||||||
else
|
|
||||||
p.w('<ConfigurationFile>')
|
|
||||||
p.w('</ConfigurationFile>')
|
|
||||||
end
|
|
||||||
p.w('<AdditionalSections>')
|
|
||||||
p.w('</AdditionalSections>')
|
|
||||||
p.pop('</ImageXex>')
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
function m.imageXexOutput(cfg)
|
|
||||||
if cfg.system == p.XBOX360 then
|
|
||||||
m.element("ImageXexOutput", nil, "%s", "$(OutDir)$(TargetName).xex")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
function m.importLanguageTargets(prj)
|
function m.importLanguageTargets(prj)
|
||||||
p.w('<Import Project="$(VCTargetsPath)\\Microsoft.Cpp.targets" />')
|
p.w('<Import Project="$(VCTargetsPath)\\Microsoft.Cpp.targets" />')
|
||||||
end
|
end
|
||||||
@ -2158,11 +2127,13 @@
|
|||||||
|
|
||||||
|
|
||||||
function m.windowsSDKDesktopARMSupport(cfg)
|
function m.windowsSDKDesktopARMSupport(cfg)
|
||||||
if cfg.architecture == p.ARM then
|
if cfg.system == p.WINDOWS then
|
||||||
p.w('<WindowsSDKDesktopARMSupport>true</WindowsSDKDesktopARMSupport>')
|
if cfg.architecture == p.ARM then
|
||||||
end
|
p.w('<WindowsSDKDesktopARMSupport>true</WindowsSDKDesktopARMSupport>')
|
||||||
if cfg.architecture == p.ARM64 then
|
end
|
||||||
p.w('<WindowsSDKDesktopARM64Support>true</WindowsSDKDesktopARM64Support>')
|
if cfg.architecture == p.ARM64 then
|
||||||
|
p.w('<WindowsSDKDesktopARM64Support>true</WindowsSDKDesktopARM64Support>')
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -2233,13 +2204,6 @@
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function m.outputFile(cfg)
|
|
||||||
if cfg.system == p.XBOX360 then
|
|
||||||
m.element("OutputFile", nil, "$(OutDir)%s", cfg.buildtarget.name)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
function m.executablePath(cfg)
|
function m.executablePath(cfg)
|
||||||
local dirs = vstudio.path(cfg, cfg.bindirs)
|
local dirs = vstudio.path(cfg, cfg.bindirs)
|
||||||
if #dirs > 0 then
|
if #dirs > 0 then
|
||||||
@ -2471,10 +2435,8 @@
|
|||||||
|
|
||||||
|
|
||||||
function m.subSystem(cfg)
|
function m.subSystem(cfg)
|
||||||
if cfg.system ~= p.XBOX360 then
|
local subsystem = iif(cfg.kind == p.CONSOLEAPP, "Console", "Windows")
|
||||||
local subsystem = iif(cfg.kind == p.CONSOLEAPP, "Console", "Windows")
|
m.element("SubSystem", nil, subsystem)
|
||||||
m.element("SubSystem", nil, subsystem)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
win32 = "x86",
|
win32 = "x86",
|
||||||
x86 = "x86",
|
x86 = "x86",
|
||||||
x86_64 = "x64",
|
x86_64 = "x64",
|
||||||
xbox360 = "Xbox 360",
|
|
||||||
ARM = "ARM",
|
ARM = "ARM",
|
||||||
ARM64 = "ARM64",
|
ARM64 = "ARM64",
|
||||||
}
|
}
|
||||||
|
@ -161,6 +161,19 @@
|
|||||||
]]
|
]]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function suite.PBXFileReference_ListsSourceFilesCompileAs()
|
||||||
|
files { "source.c" }
|
||||||
|
filter { "files:source.c" }
|
||||||
|
compileas "C++"
|
||||||
|
prepare()
|
||||||
|
xcode.PBXFileReference(tr)
|
||||||
|
test.capture [[
|
||||||
|
/* Begin PBXFileReference section */
|
||||||
|
[MyProject:product] /* MyProject */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; name = MyProject; path = MyProject; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
|
[source.c] /* source.c */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.cpp; name = source.c; path = source.c; sourceTree = "<group>"; };
|
||||||
|
]]
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
function suite.PBXFileReference_ListsXibCorrectly()
|
function suite.PBXFileReference_ListsXibCorrectly()
|
||||||
files { "English.lproj/MainMenu.xib", "French.lproj/MainMenu.xib" }
|
files { "English.lproj/MainMenu.xib", "French.lproj/MainMenu.xib" }
|
||||||
@ -2367,7 +2380,7 @@
|
|||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
ARCHS = "$(NATIVE_ARCH_ACTUAL)";
|
ARCHS = "$(NATIVE_ARCH_ACTUAL)";
|
||||||
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
|
CLANG_CXX_LANGUAGE_STANDARD = "c++11";
|
||||||
CONFIGURATION_BUILD_DIR = "$(SYMROOT)";
|
CONFIGURATION_BUILD_DIR = "$(SYMROOT)";
|
||||||
CONFIGURATION_TEMP_DIR = "$(OBJROOT)";
|
CONFIGURATION_TEMP_DIR = "$(OBJROOT)";
|
||||||
GCC_OPTIMIZATION_LEVEL = 0;
|
GCC_OPTIMIZATION_LEVEL = 0;
|
||||||
|
@ -79,6 +79,20 @@
|
|||||||
|
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Return 'explicitFileType' if the given file is being set with 'compileas'
|
||||||
|
--
|
||||||
|
|
||||||
|
function xcode.getfiletypekey(node, cfg)
|
||||||
|
if node.configs then
|
||||||
|
local filecfg = fileconfig.getconfig(node, cfg)
|
||||||
|
if filecfg and filecfg["compileas"] then
|
||||||
|
return "explicitFileType"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return "lastKnownFileType"
|
||||||
|
end
|
||||||
--
|
--
|
||||||
-- Return the Xcode type for a given file, based on the file extension.
|
-- Return the Xcode type for a given file, based on the file extension.
|
||||||
--
|
--
|
||||||
@ -93,7 +107,11 @@
|
|||||||
if node.configs then
|
if node.configs then
|
||||||
local filecfg = fileconfig.getconfig(node, cfg)
|
local filecfg = fileconfig.getconfig(node, cfg)
|
||||||
if filecfg then
|
if filecfg then
|
||||||
if filecfg.language == "ObjC" then
|
if p.languages.isc(filecfg.compileas) then
|
||||||
|
return "sourcecode.c.c"
|
||||||
|
elseif p.languages.iscpp(filecfg.compileas) then
|
||||||
|
return "sourcecode.cpp.cpp"
|
||||||
|
elseif filecfg.language == "ObjC" then
|
||||||
return "sourcecode.c.objc"
|
return "sourcecode.c.objc"
|
||||||
elseif filecfg.language == "ObjCpp" then
|
elseif filecfg.language == "ObjCpp" then
|
||||||
return "sourcecode.cpp.objcpp"
|
return "sourcecode.cpp.objcpp"
|
||||||
@ -495,8 +513,8 @@
|
|||||||
end
|
end
|
||||||
--end
|
--end
|
||||||
end
|
end
|
||||||
_p(level,'%s /* %s */ = {isa = PBXFileReference; lastKnownFileType = %s; name = %s; path = %s; sourceTree = %s; };',
|
_p(level,'%s /* %s */ = {isa = PBXFileReference; %s = %s; name = %s; path = %s; sourceTree = %s; };',
|
||||||
node.id, node.name, xcode.getfiletype(node, cfg), stringifySetting(node.name), stringifySetting(pth), stringifySetting(src))
|
node.id, node.name, xcode.getfiletypekey(node, cfg), xcode.getfiletype(node, cfg), stringifySetting(node.name), stringifySetting(pth), stringifySetting(src))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -1014,7 +1032,7 @@
|
|||||||
xcode.cppLanguageStandards = {
|
xcode.cppLanguageStandards = {
|
||||||
["Default"] = "compiler-default", -- explicit compiler default
|
["Default"] = "compiler-default", -- explicit compiler default
|
||||||
["C++98"] = "c++98",
|
["C++98"] = "c++98",
|
||||||
["C++11"] = "c++0x", -- Xcode project GUI uses c++0x, but c++11 also works
|
["C++11"] = "c++11",
|
||||||
["C++14"] = "c++14",
|
["C++14"] = "c++14",
|
||||||
["C++17"] = "c++1z",
|
["C++17"] = "c++1z",
|
||||||
["gnu++98"] = "gnu++98",
|
["gnu++98"] = "gnu++98",
|
||||||
|
@ -58,17 +58,6 @@
|
|||||||
name = "buildaction",
|
name = "buildaction",
|
||||||
scope = "config",
|
scope = "config",
|
||||||
kind = "string",
|
kind = "string",
|
||||||
allowed = {
|
|
||||||
"Application",
|
|
||||||
"Compile",
|
|
||||||
"Component",
|
|
||||||
"Copy",
|
|
||||||
"Embed",
|
|
||||||
"Form",
|
|
||||||
"None",
|
|
||||||
"Resource",
|
|
||||||
"UserControl",
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
api.register {
|
api.register {
|
||||||
@ -202,13 +191,6 @@
|
|||||||
kind = "list:keyed:array:string",
|
kind = "list:keyed:array:string",
|
||||||
}
|
}
|
||||||
|
|
||||||
api.register {
|
|
||||||
name = "configfile",
|
|
||||||
scope = "config",
|
|
||||||
kind = "string",
|
|
||||||
tokens = true,
|
|
||||||
}
|
|
||||||
|
|
||||||
api.register {
|
api.register {
|
||||||
name = "configurations",
|
name = "configurations",
|
||||||
scope = "project",
|
scope = "project",
|
||||||
@ -369,13 +351,6 @@
|
|||||||
tokens = true,
|
tokens = true,
|
||||||
}
|
}
|
||||||
|
|
||||||
api.register {
|
|
||||||
name = "deploymentoptions",
|
|
||||||
scope = "config",
|
|
||||||
kind = "list:string",
|
|
||||||
tokens = true,
|
|
||||||
}
|
|
||||||
|
|
||||||
api.register {
|
api.register {
|
||||||
name = "disablewarnings",
|
name = "disablewarnings",
|
||||||
scope = "config",
|
scope = "config",
|
||||||
@ -1144,7 +1119,6 @@
|
|||||||
"solaris",
|
"solaris",
|
||||||
"wii",
|
"wii",
|
||||||
"windows",
|
"windows",
|
||||||
"xbox360",
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1400,7 +1374,6 @@
|
|||||||
api.alias("buildmessage", "buildMessage")
|
api.alias("buildmessage", "buildMessage")
|
||||||
api.alias("buildoutputs", "buildOutputs")
|
api.alias("buildoutputs", "buildOutputs")
|
||||||
api.alias("cleanextensions", "cleanExtensions")
|
api.alias("cleanextensions", "cleanExtensions")
|
||||||
api.alias("configfile", "configFile")
|
|
||||||
api.alias("dotnetframework", "framework")
|
api.alias("dotnetframework", "framework")
|
||||||
api.alias("editandcontinue", "editAndContinue")
|
api.alias("editandcontinue", "editAndContinue")
|
||||||
api.alias("fileextension", "fileExtension")
|
api.alias("fileextension", "fileExtension")
|
||||||
@ -1793,15 +1766,12 @@
|
|||||||
filter { "system:Windows or language:C# or language:F#", "kind:ConsoleApp or WindowedApp" }
|
filter { "system:Windows or language:C# or language:F#", "kind:ConsoleApp or WindowedApp" }
|
||||||
targetextension ".exe"
|
targetextension ".exe"
|
||||||
|
|
||||||
filter { "system:Xbox360", "kind:ConsoleApp or WindowedApp" }
|
filter { "system:Windows", "kind:SharedLib" }
|
||||||
targetextension ".exe"
|
|
||||||
|
|
||||||
filter { "system:Windows or Xbox360", "kind:SharedLib" }
|
|
||||||
targetprefix ""
|
targetprefix ""
|
||||||
targetextension ".dll"
|
targetextension ".dll"
|
||||||
implibextension ".lib"
|
implibextension ".lib"
|
||||||
|
|
||||||
filter { "system:Windows or Xbox360", "kind:StaticLib" }
|
filter { "system:Windows", "kind:StaticLib" }
|
||||||
targetprefix ""
|
targetprefix ""
|
||||||
targetextension ".lib"
|
targetextension ".lib"
|
||||||
|
|
||||||
|
@ -56,7 +56,6 @@
|
|||||||
premake.X86_64 = "x86_64"
|
premake.X86_64 = "x86_64"
|
||||||
premake.ARM = "ARM"
|
premake.ARM = "ARM"
|
||||||
premake.ARM64 = "ARM64"
|
premake.ARM64 = "ARM64"
|
||||||
premake.XBOX360 = "xbox360"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -100,8 +100,8 @@
|
|||||||
|
|
||||||
local environ = {}
|
local environ = {}
|
||||||
local fsub = context.new(prj, environ)
|
local fsub = context.new(prj, environ)
|
||||||
context.copyFilters(fsub, cfg)
|
context.copyFilters(fsub, fcfg)
|
||||||
context.mergeFilters(fsub, fcfg)
|
context.mergeFilters(fsub, cfg)
|
||||||
|
|
||||||
fcfg.configs[cfg] = fsub
|
fcfg.configs[cfg] = fsub
|
||||||
|
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "premake.h"
|
#include "premake.h"
|
||||||
#include <lundump.h>
|
#include "lundump.h"
|
||||||
#include <lstate.h>
|
#include "lstate.h"
|
||||||
|
|
||||||
extern int original_luaL_loadfilex(lua_State* L, const char* filename, const char* mode);
|
extern int original_luaL_loadfilex(lua_State* L, const char* filename, const char* mode);
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
#ifdef PREMAKE_COMPRESSION
|
#ifdef PREMAKE_COMPRESSION
|
||||||
|
|
||||||
#include <zip.h>
|
#include "zip.h"
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#include <direct.h>
|
#include <direct.h>
|
||||||
|
@ -184,24 +184,6 @@
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Name should use ".exe" for Xbox360 executables.
|
|
||||||
--
|
|
||||||
|
|
||||||
function suite.nameUsesExe_onXbox360ConsoleApp()
|
|
||||||
kind "ConsoleApp"
|
|
||||||
system "Xbox360"
|
|
||||||
i = prepare()
|
|
||||||
test.isequal("MyProject.exe", i.name)
|
|
||||||
end
|
|
||||||
|
|
||||||
function suite.nameUsesLib_onXbox360StaticLib()
|
|
||||||
kind "StaticLib"
|
|
||||||
system "Xbox360"
|
|
||||||
i = prepare()
|
|
||||||
test.isequal("MyProject.lib", i.name)
|
|
||||||
end
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name should use a prefix if set.
|
-- Name should use a prefix if set.
|
||||||
--
|
--
|
||||||
|
Loading…
Reference in New Issue
Block a user