Changes between Initial Version and Version 1 of premake


Ignore:
Timestamp:
Jul 1, 2012, 5:34:22 AM (12 years ago)
Author:
historic_bruno
Comment:

Initial draft

Legend:

Unmodified
Added
Removed
Modified
  • premake

    v1 v1  
     1= Premake =
     2
     3[http://industriousone.com/premake Premake] is the tool used to build 0 A.D. from source code. It is a critical part of the "build system". Premake uses [http://www.lua.org/ Lua] scripts to create workspaces both for building Premake itself and other projects like 0 A.D. It mostly supports Visual Studio (Windows), Xcode (OS X) and GNU make (*nix and OS X).
     4
     5Currently we bundle a modified version of the Premake 4.3 release, located in [source:/ps/trunk/build/premake/premake4 build/premake/premake4]. The modifications fix a number of bugs and missing features in the 4.3 release.
     6
     7== Premake in 0 A.D. ==
     8
     90 A.D. uses two custom Lua scripts to generate its workspaces with Premake:
     10 * [source:/ps/trunk/build/premake/premake4.lua build/premake/premake4.lua] - this is the main script which controls compiler, linker, and workspace behavior on different platforms.
     11 * [source:/ps/trunk/build/premake/extern_libs4.lua build/premake/extern_libs4.lua] - this is an auxiliary script, which lists external dependencies / libraries used by 0 A.D. and how they differ on various platforms.
     12These scripts are well commented, describing the reasoning behind most of the logic.
     13
     14Generating the workspaces is quite simple and done automatically by the `update-workspaces` step(s) of our BuildInstructions. The Premake binary is run as with the following command:
     15{{{
     16#!sh
     17premake4/bin/release/premake4 --file="premake4.lua" --outpath="../workspaces/gcc/" gmake
     18}}}
     19This tells Premake to use our custom `premake4.lua` to generate a GNU make workspace located in `build/workspaces/gcc/`. Those options are self-explanatory, but there are a number of other options supported by Premake and our custom scripts, listed below.
     20
     21See [source:/ps/trunk/build/workspaces/update-workspaces.sh update-workspaces.sh] and [source:/ps/trunk/build/workspaces/update-workspaces.bat update-workspaces.bat] to see how we use Premake.
     22
     23=== Supported workspaces ===
     24
     25Our Premake build supports the following workspaces, but not on every platform (e.g. `xcode3` probably won't work on Windows or Linux).
     26 * `vs2010` - [http://www.microsoft.com/visualstudio/en-us/products/2010-editions Visual Studio 2010] (or [http://www.microsoft.com/visualstudio/en-us/products/2010-editions/express Express])
     27 * `vs2008` - Visual Studio 2008 (or Express)
     28 * `vs2005` - Visual Studio 2005 (or Express)
     29 * `gmake` - [http://www.gnu.org/software/make/ GNU Make]
     30 * `xcode3` - [https://developer.apple.com/xcode/ Apple Xcode 3]
     31 * `codeblocks` - [http://www.codeblocks.org/ Code::Blocks]
     32'''Note:''' In most cases we've had to modify the default workspaces for bug fixes, so additional platforms might be supported by Premake in theory but broken in practice. Our main goal is to have an acceptable workspace on each of our main supported platforms: Windows w/ MSVC, Linux w/ make, and OS X w/ Xcode. Supporting additional platforms is less of a priority.
     33
     34=== Premake options ===
     35
     36In addition to `--file` and `--outpath`, our scripts support the following options (also prefixed with "--"):
     37 * `android` - Use non-working Android cross-compiling mode
     38 * '''`atlas` - Include Atlas scenario editor projects'''
     39 * '''`collada` - Include COLLADA projects (requires FCollada library)'''
     40 * `coverage` - Enable code coverage data collection (GCC only)
     41 * `gles` - Use non-working OpenGL ES 2.0 mode
     42 * `icc` - Use Intel C++ Compiler (Linux only; should use either `--cc icc` or `--without-pch` too, and then set `CXX=icpc` before calling make)
     43 * `without-fam` - Disable use of FAM API on Linux
     44 * `without-audio` - Disable use of OpenAL/Ogg/Vorbis APIs
     45 * `without-nvtt` - Disable use of NVTT
     46 * `without-tests` - Disable generation of test projects
     47 * `without-pch` - Disable generation and usage of precompiled headers
     48 * `with-system-nvtt` - Search standard paths for nvidia-texture-tools library, instead of using bundled copy
     49 * `with-system-enet` - Search standard paths for libenet, instead of using bundled copy
     50 * `with-system-mozjs185` - Search standard paths for libmozjs185, instead of using bundled copy
     51 * `bindir` - Directory for executables (typically `/usr/games`); default is to be relocatable
     52 * `datadir` - Directory for data files (typically `/usr/share/games/0ad`); default is `../data/` relative to executable
     53 * `libdir` - Directory for libraries (typically `/usr/lib/games/0ad`); default is `./` relative to executable
     54
     55'''Note:''' Most of the options are special purpose and not needed for the average build. You shouldn't use an option unless you understand it and have a need for it.
     56
     57The most commonly used options are `--atlas` and `--collada` (you might want to disable them if building the game on an experimental new platform like Android). `--atlas` is not used by default in `update-workspaces.bat`, because we don't bundle the wxWidgets libraries in SVN.
     58
     59The `update-workspaces` scripts will pass arguments through to Premake:
     60{{{
     61#!sh
     62./update-workspaces.sh --without-tests --with-system-mozjs185
     63}}}
     64
     65== Building Premake ==
     66
     67For Windows developers, we bundle a pre-built, 32-bit [/ps/trunk/build/premake/premake4/bin/release/premake.exe premake.exe] in SVN. This EXE only needs to be updated when the Premake source code is modified, which happens infrequently.
     68
     69For *nix and OS X developers, the Premake binary is built by [source:/ps/trunk/build/workspaces/update-workspaces.sh update-workspaces.sh] as part of the standard BuildInstructions.
     70
     71== Modifying Premake ==
     72
     73To modify Premake's behavior, you typically modify the Lua scripts within `build/premake/premake4`. You shouldn't modify the Makefile(s) or C source code directly, as these are automatically generated from the scripts by Premake. Obviously you need a working, already built Premake binary to do this. This is slightly confusing in that Premake creates the workspace you need to build a new version of Premake.
     74
     75After you've modified Premake's source scripts, you need to run the old Premake binary with the `embed` option to update e.g. `src/host/scripts.c`, see [http://industriousone.com/building-premake Building Premake] for more information.