What Is Premake

Premake is a command line utility which reads a scripted definition of a software project and, most commonly, uses it to generate project files for toolsets like Visual Studio, Xcode, or GNU Make.

A sample Premake script.

workspace "MyWorkspace"
   configurations { "Debug", "Release" }

project "MyProject"
   kind "ConsoleApp"
   language "C++"
   files { "**.h", "**.cpp" }

   filter { "configurations:Debug" }
      defines { "DEBUG" }
      flags { "Symbols" }

   filter { "configurations:Release" }
      defines { "NDEBUG" }
      optimize "On"

Running Premake

Create a premake5.lua file in your project directory. Open the PTSource Shell a run premake.

$ premake5 vs2015
Building configurations...
Running action 'vs2015'...
Generating MyWorkspace.sln...
Generating MyProject.vcxproj...
Generating MyProject.vcxproj.user...
Done.
The above will generate a project for VS2015. Since PTSource comes already with MinGW-w64 so if we want to generate a Makefile for MinGW-w64.
$ premake5 gmake
Building configurations...
Running action 'gmake'...
Generating MyWorkspace.sln...
Generating MyProject.vcxproj...
Generating MyProject.vcxproj.user...
Done.
The above will generate a MinGW-w64 Makefile wich you can compile with make.

Use Premake To
  • Maximize your potential audience by allowing developers to use the platforms and toolsets they prefer.
  • Allow developers to customize the build, and output project files specific to that configuration.
  • Keep builds in sync across toolsets by generating project from the Premake scripts on demand.
  • Quickly update large codebases with many workspaces and projects: make the change once in your Premake script and then regenerate.
  • Create project files for toolsets you don't own.
  • Quickly upgrade to newer versions of your chosen toolset.
  • Script common configuration and build maintenance tasks.
 Key Features

Premake can generate C, C++, or C# projects targeting:

  • Microsoft Visual Studio 2008-2015
  • GNU Make, including Cygwin and MinGW
  • Xcode
  • Codelite

Premake generated projects can support:

  • 32- and 64-bit builds
  • Xbox 360 (Visual Studio only)

We use cookies to personalize and enhance your experience on our site. By using our site, you agree to our use of cookies. This website is automatically translated from the english language.
  More information about cookies