<h2>Working with Premake</h2>

<table border="0" width="100%">
<tr>

  <td valign="top" width="300px">
  <dl>

  <small>
  <dt><b>1. Development
    <dd>1.1 Introduction</dd>
    <dd><a Programming with Lua and or
    <dd><a Working with
    <dd>1.4 Bmake</dd>
    <dd>1.5 Debugging</dd>
    <dd>1.6 Using Fossil (DVCS)</dd>
    <dd>1.7 Further Reading</dd>
  </small>

  </dl>
  </td>


<td valign="top">
<h3>Premake Introduction</h3>
<p>The Hydra Architecture uses a special forked version of premake that use Luajit with the Luajit FFI module enabled. This gives premake the capability to call C
Library functions from our build scripts.</p>

<!-- Using Premake -->
<h3>Using Premake</h3>

<p>The simplest Premake command is:</p>

<pre><code>
premake4 action


<p>Usually you would like Premake to generate project files for a particular toolset, in which case action is one of these toolset identifiers:</p>

<pre><code>
vs2010	        Visual Studio 2010 (or Express)
vs2008	        Visual Studio 2008 (or Express)
vs2005	        Visual Studio 2005 (or Express), SharpDevelop, or MonoDevelop
vs2003	        Visual Studio 2003
vs2002	        Visual Studio 2002
gmake	        GNU Make (including Cygwin and MinGW)
xcode3	        Apple Xcode 3
codeblocks	Code::Blocks
codelite	CodeLite


<p>You can see a complete list of actions and other options by typing:</p>

<pre><code>
premake4 --help


<p>Once the files have been generated you can load the solution or workspace into your IDE and build as you normally would.</p>

</br>


<h3>Creating a Simple Premake Script</h3>

<p>Premake is built on Lua, a powerful, fast, light-weight scripting language. Premake scripts are really Lua programs, so anything you can do in Lua can also be done in a Premake script. To this, Premake adds functions for defining solutions, projects, and configurations as well as support for common build configuration tasks. Premake also provides conventions for defining and handling command line options and actions, allowing you to build sophisticated configuration scripts.

Because of the descriptive nature of the Lua language, your build scripts will often look more like static configuration files than mini-programs. Here is an example of a fairly typical Premake script for a C++ executable. See the Premake Cookbook for more examples of common configuration tasks.</p>

<pre><code>
-- A solution contains projects, and defines the available configurations
solution "MyApplication"
   configurations { "Debug", "Release" }

   -- A project defines one build target
   project "MyApplication"
      kind "ConsoleApp"
      language "C++"
      files { "**.h", "**.cpp" }

      configuration "Debug"
         defines { "DEBUG" }
         flags { "Symbols" }

      configuration "Release"
         defines { "NDEBUG" }
         flags { "Optimize" }


<p>The indentation in this sample is arbitrary, this is the way I happen to like it.

The following sections of this guide will walk you through all of the features of Premake in a somewhat logical fashion. It isn't rocket science, and you probably already have the gist of it from the example above, so feel free to skip around. You can also refer to the Reference section or the Lua Reference Manual for information on a particular function or variable.</p>
</br>


</td>
</tr>
</table>