Improve Xbox 360 support

This commit is contained in:
Jason Perkins 2013-03-07 12:14:03 -05:00
parent 99a80052da
commit b10f1b5b60
7 changed files with 100 additions and 25 deletions

View File

@ -33,6 +33,7 @@
* Added ExcludeFromBuild flag to mark source files as non-buildable
* Added MultiProcessorCompile flag to run multiple compiler processes
* Fixed assembly references for Visual Studio Managed C++ projects
* Improved Xbox 360 support
-------

View File

@ -40,9 +40,12 @@
-- Windows and friends.
--
configuration { "Windows or Xbox360 or C#", "ConsoleApp or WindowedApp" }
configuration { "Windows or C#", "ConsoleApp or WindowedApp" }
targetextension ".exe"
configuration { "Xbox360", "ConsoleApp or WindowedApp" }
targetextension ".xex"
configuration { "Windows or Xbox360 or C#", "SharedLib" }
targetprefix ""
targetextension ".dll"

View File

@ -51,6 +51,8 @@
vc2010.resourceCompile(cfg)
vc2010.link(cfg)
vc2010.buildEvents(cfg)
vc2010.imageXex(cfg)
vc2010.deploy(cfg)
_p(1,'</ItemDefinitionGroup>')
end
@ -189,6 +191,7 @@
vc2010.intDir(cfg)
vc2010.targetName(cfg)
vc2010.targetExt(cfg)
vc2010.imageXexOutput(cfg)
vc2010.generateManifest(cfg)
_p(1,'</PropertyGroup>')
end
@ -233,10 +236,12 @@
--
function vc2010.resourceCompile(cfg)
_p(2,'<ResourceCompile>')
vc2010.preprocessorDefinitions(table.join(cfg.defines, cfg.resdefines))
vc2010.additionalIncludeDirectories(cfg, table.join(cfg.includedirs, cfg.resincludedirs))
_p(2,'</ResourceCompile>')
if cfg.system ~= premake.XBOX360 then
_p(2,'<ResourceCompile>')
vc2010.preprocessorDefinitions(table.join(cfg.defines, cfg.resdefines))
vc2010.additionalIncludeDirectories(cfg, table.join(cfg.includedirs, cfg.resincludedirs))
_p(2,'</ResourceCompile>')
end
end
@ -499,9 +504,11 @@
end
---------------------------------------------------------------------------
--
-- Handlers for individual project elements.
-- Handlers for individual project elements
--
---------------------------------------------------------------------------
function vc2010.additionalDependencies(cfg, explicit)
local links
@ -609,6 +616,17 @@
end
function vc2010.deploy(cfg)
if cfg.system == premake.XBOX360 then
_p(2,'<Deploy>')
_p(3,'<DeploymentType>CopyToHardDrive</DeploymentType>')
_p(3,'<DvdEmulationType>ZeroSeekTimes</DvdEmulationType>')
_p(3,'<DeploymentFiles>$(RemoteRoot)=$(ImagePath);</DeploymentFiles>')
_p(2,'</Deploy>')
end
end
function vc2010.enableEnhancedInstructionSet(cfg)
if cfg.flags.EnableSSE2 then
_p(3,'<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>')
@ -619,7 +637,11 @@
function vc2010.entryPointSymbol(cfg)
if vc2010.configType(cfg) == "Application" and not cfg.flags.WinMain and not cfg.flags.Managed then
if vc2010.configType(cfg) == "Application" and
not cfg.flags.WinMain and
not cfg.flags.Managed and
cfg.system ~= premake.XBOX360
then
_p(3,'<EntryPointSymbol>mainCRTStartup</EntryPointSymbol>')
end
end
@ -681,6 +703,25 @@
end
function vc2010.imageXex(cfg)
if cfg.system == premake.XBOX360 then
_p(2,'<ImageXex>')
_p(3,'<ConfigurationFile>')
_p(3,'</ConfigurationFile>')
_p(3,'<AdditionalSections>')
_p(3,'</AdditionalSections>')
_p(2,'</ImageXex>')
end
end
function vc2010.imageXexOutput(cfg)
if cfg.system == premake.XBOX360 then
_x(2,'<ImageXexOutput>$(OutDir)$(TargetName).xex</ImageXexOutput>')
end
end
function vc2010.import(prj)
_p(1,'<Import Project="$(VCTargetsPath)\\Microsoft.Cpp.targets" />')
_p(1,'<ImportGroup Label="ExtensionTargets">')
@ -870,8 +911,10 @@
function vc2010.subSystem(cfg)
local subsystem = iif(cfg.kind == premake.CONSOLEAPP, "Console", "Windows")
_p(3,'<SubSystem>%s</SubSystem>', subsystem)
if cfg.system ~= premake.XBOX360 then
local subsystem = iif(cfg.kind == premake.CONSOLEAPP, "Console", "Windows")
_p(3,'<SubSystem>%s</SubSystem>', subsystem)
end
end

View File

@ -359,3 +359,20 @@
<AdditionalDependencies>kernel32.lib;%(AdditionalDependencies)</AdditionalDependencies>
]]
end
--
-- Xbox 360 doesn't list a subsystem or entry point.
--
function suite.onXbox360()
kind "ConsoleApp"
system "Xbox360"
prepare()
test.capture [[
<Link>
<GenerateDebugInformation>false</GenerateDebugInformation>
</Link>
]]
end

View File

@ -11,16 +11,16 @@
--
-- Setup
-- Setup
--
local sln
function suite.setup()
_ACTION = "vs2010"
sln = test.createsolution()
end
local function prepare()
local prj = premake.solution.getproject_ng(sln, 1)
local cfg = project.getconfig(prj, "Debug")
@ -57,10 +57,11 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Xbox 360'">
<LinkIncremental>true</LinkIncremental>
<OutDir>.\</OutDir>
<OutputFile>$(OutDir)MyProject.exe</OutputFile>
<OutputFile>$(OutDir)MyProject.xex</OutputFile>
<IntDir>obj\Debug\</IntDir>
<TargetName>MyProject</TargetName>
<TargetExt>.exe</TargetExt>
<TargetExt>.xex</TargetExt>
<ImageXexOutput>$(OutDir)$(TargetName).xex</ImageXexOutput>
</PropertyGroup>
]]
end
@ -151,7 +152,7 @@
<IgnoreImportLibrary>true</IgnoreImportLibrary>
]]
end
function suite.omitIgnoreImportLib_onNonSharedLib()
kind "ConsoleApp"
flags "NoImportLib"

View File

@ -1,11 +1,10 @@
--
-- tests/actions/vstudio/vc2010/test_resource_compile.lua
-- Validate resource compiler settings in Visual Studio 2010 C/C++ projects.
-- Copyright (c) 2011-2012 Jason Perkins and the Premake project
-- Copyright (c) 2011-2013 Jason Perkins and the Premake project
--
T.vstudio_vs2010_resource_compiler = { }
local suite = T.vstudio_vs2010_resource_compiler
local suite = test.declare("vs2010_resource_compiler")
local vc2010 = premake.vstudio.vc2010
local project = premake5.project
@ -20,8 +19,8 @@
sln, prj = test.createsolution()
end
local function prepare(platform)
cfg = project.getconfig(prj, "Debug", platform)
local function prepare()
cfg = project.getconfig(prj, "Debug")
vc2010.resourceCompile(cfg)
end
@ -66,3 +65,14 @@
<AdditionalIncludeDirectories>include\lua;include\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
]]
end
--
-- Xbox 360 doesn't use the resource compiler.
--
function suite.skips_onXbox360()
system "Xbox360"
prepare()
test.isemptycapture()
end

View File

@ -1,6 +1,6 @@
--
-- tests/config/test_targetinfo.lua
-- Test the config object's build target accessor.
-- Test the config object's build target accessor.
-- Copyright (c) 2011 Jason Perkins and the Premake project
--
@ -29,7 +29,7 @@
--
-- Directory should be current (".") by default.
-- Directory should be current (".") by default.
--
function suite.directoryIsDot_onNoTargetDir()
@ -103,7 +103,7 @@
test.isequal("MyProject", i.name)
end
--
-- Name should use ".exe" for Windows executables.
--
@ -220,14 +220,14 @@
--
-- Name should use ".exe" for Xbox360 executables.
-- Name should use ".xex" for Xbox360 executables.
--
function suite.nameUsesExe_onWindowsConsoleApp()
kind "ConsoleApp"
system "Xbox360"
i = prepare()
test.isequal("MyProject.exe", i.name)
test.isequal("MyProject.xex", i.name)
end