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,11 +236,13 @@
--
function vc2010.resourceCompile(cfg)
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,9 +911,11 @@
function vc2010.subSystem(cfg)
if cfg.system ~= premake.XBOX360 then
local subsystem = iif(cfg.kind == premake.CONSOLEAPP, "Console", "Windows")
_p(3,'<SubSystem>%s</SubSystem>', subsystem)
end
end
function vc2010.targetExt(cfg)

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

@ -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

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

@ -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