Skip to content
Manu Evans edited this page Mar 30, 2015 · 4 revisions

Home > [Scripting Reference](Scripting Reference) > platforms


platforms

Platform support is a new, experimental feature which will be introduced in Premake 4.1. The syntax and behavior described here might change as we sort out the details.

The platforms function specifies a set of target hardware platforms for a solution. This is an optional setting; if it is not provided the toolset's default behavior will be used.

#!lua
platforms { "identifiers" }

Please see the [Platforms section of the user guide](Using Platforms) for a lot more information on platforms and how they are used by Premake.

Updated information is available on the new Premake wiki.

Applies To

Solutions only.

Parameters

identifiers is a list of hardware platform identifiers, and may include any of the following.

Native A general build not targeting any particular platform; uses the default build behavior of the compiler. If your project can be built in a generic fashion, you should include this as the first platform option.
x32 Target a 32-bit environment.
x64 Target a 64-bit environment
Universal Create a Mac OS X universal binary, targeting both 32- and 64-bit versions of x86 and PPC. Note that in order to target multiple architectures, automated dependency generation must be turned off. You should always do a clean build when creating a universal target. Universal builds are not supported by Visual Studio.
Universal32 Like Universal above, but targeting only 32-bit platforms.
Universal64 Like Universal above, but targeting only 64-bit platforms.
PS3 Target the Playstation 3.
Xbox360 Target the Xbox 360 compiler and linker under Visual Studio; ignored elsewhere.

Not all platforms are supported on all systems, unsupported platforms will be silently ignored. Some targets require extra configuration of the build tools on the client machine in order to support cross-compilation.

Return Value

The function returns the current list of target platforms for the active solution.

Examples

Provide a generic build that will work anywhere, as well as a Mac OS X Universal build.

#!lua
solution "MySolution"
  configurations { "Debug", "Release" }
  platforms { "native", "universal" }

Provide 32- and 64-bit specific build targets. No generic build is provided, so one of these two platforms must always be used. Do this only if your software requires knowledge of the underlying architecture at build time, otherwise include "native" to provide a generic build.

#!lua
solution "MySolution"
  configurations { "Debug", "Release" }
  platforms { "x32", "x64" }

You can retrieve the current list of platforms by calling the function with no parameters.

#!lua
local p = platforms()

Once you have defined a list of platforms, you may use those identifiers to set up configuration filters and apply platform-specific settings.

#!lua
configuration "x64"
  defines "IS_64BIT"
 
-- You can also mix platforms with other configuration selectors
configuration { "Debug", "x64" }
  defines "IS_64BIT_DEBUG"

Clone this wiki locally