| [20366] | 1 | PREMAKE BUILD INSTRUCTIONS
|
|---|
| 2 |
|
|---|
| 3 | Premake is written in a mix of C and Lua. A small host executable,
|
|---|
| 4 | written in C, launches the app and prepares the environment, at which
|
|---|
| 5 | point control is handed off to a Lua script. Almost all of Premake is
|
|---|
| 6 | written in Lua scripts, which allow it to be easily extended and
|
|---|
| 7 | customized. The catch is that it is slightly more complicated to build
|
|---|
| 8 | it than your typical C/C++ application.
|
|---|
| 9 |
|
|---|
| 10 | If you find all of this very confusing and need some help, visit the
|
|---|
| 11 | Premake website for help and community links. We will be glad to help!
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 | BUILDING FROM A SOURCE PACKAGE
|
|---|
| 15 |
|
|---|
| 16 | If you downloaded a source code package (as opposed to pulling the sources
|
|---|
| 17 | directory from the repository) you will find project files for all of the
|
|---|
| 18 | officially supported toolsets in the build/ folder. Build the release
|
|---|
| 19 | configuration and you will be ready to go. For makefiles:
|
|---|
| 20 |
|
|---|
| [24387] | 21 | $ cd build/gmake2.unix
|
|---|
| [20366] | 22 | $ make config=release
|
|---|
| 23 |
|
|---|
| 24 | The binaries will be placed in the ./bin/release directory.
|
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 | BUILDING FROM THE REPOSITORY
|
|---|
| 28 |
|
|---|
| 29 | If you have pulled sources from the Premake source repository, you can
|
|---|
| 30 | use `Bootstrap.mak` to generate your first premake executable:
|
|---|
| 31 |
|
|---|
| 32 | $ make -f Bootstrap.mak PLATFORM
|
|---|
| 33 |
|
|---|
| 34 | Where PLATFORM can be osx or linux.
|
|---|
| 35 | On Windows with Visual Studio use nmake:
|
|---|
| 36 |
|
|---|
| 37 | $ nmake -f Bootstrap.mak windows
|
|---|
| 38 |
|
|---|
| 39 | Or on Windows with MinGW use mingw32-make:
|
|---|
| 40 |
|
|---|
| 41 | $ CC=mingw32-gcc mingw32-make -f Bootstrap.mak mingw
|
|---|
| 42 |
|
|---|
| 43 | If your toolset is not supported by the bootstrap Makefile, you will need
|
|---|
| 44 | to embed the scripts into a C source file so they may be built into the
|
|---|
| 45 | executable, and also generate the project files for your chosen toolset. In
|
|---|
| 46 | order do either of these things, you will need a working Premake executable.
|
|---|
| 47 |
|
|---|
| 48 | The easiest way to get an executable is to download one of the prebuilt
|
|---|
| 49 | binaries from the project website. If that isn't possible, or if not binary
|
|---|
| 50 | is provided for your platform, you can build from a source package as
|
|---|
| 51 | described above, as they also include pre-generated project files.
|
|---|
| 52 |
|
|---|
| 53 | Once you have a working Premake available, you can generate the project
|
|---|
| 54 | files for your toolset by running a command like the following in the
|
|---|
| 55 | top-level Premake directory:
|
|---|
| 56 |
|
|---|
| [24387] | 57 | $ premake5 gmake2 # for makefiles
|
|---|
| [20366] | 58 | $ premake5 vs2012 # for a Visual Studio 2012 solution
|
|---|
| 59 | $ premake --help # to see a list of supported toolsets
|
|---|
| 60 |
|
|---|
| 61 | If this is the first time you have built Premake, or if you have made
|
|---|
| 62 | changes to the Lua scripts, you should prepare them to be embedded into the
|
|---|
| 63 | Premake executable.
|
|---|
| 64 |
|
|---|
| 65 | $ premake5 embed
|
|---|
| 66 |
|
|---|
| 67 | This creates a C file (at src/host/scripts.c) which contains all of the
|
|---|
| 68 | Lua scripts as static string buffers. These then get compiled into the
|
|---|
| 69 | executable, which is how we get away with shipping a single file instead
|
|---|
| 70 | of a whole bunch of scripts.
|
|---|
| 71 |
|
|---|
| 72 | You should now have a solution/makefile/workspace in the top-level folder,
|
|---|
| 73 | which you can go ahead and build.
|
|---|
| 74 |
|
|---|
| 75 |
|
|---|
| 76 | RUNNING THE TESTS
|
|---|
| 77 |
|
|---|
| 78 | Once you have built an executable, you can verify it by running Premake's
|
|---|
| 79 | unit test suites. From the top-level Premake folder, run:
|
|---|
| 80 |
|
|---|
| 81 | $ bin/release/premake5 test
|
|---|
| 82 |
|
|---|
| 83 |
|
|---|
| 84 | RUNTIME SCRIPT LOADING
|
|---|
| 85 |
|
|---|
| 86 | If you are modifying or extending Premake, you can skip the embedding
|
|---|
| 87 | and compilation steps and run the scripts directly from the disk. This
|
|---|
| 88 | removes the build from the change-build-test cycle and really speeds up
|
|---|
| 89 | development.
|
|---|
| 90 |
|
|---|
| 91 | If you are running Premake from the top of its own source tree (where its
|
|---|
| 92 | premake5.lua is located) you will get this behavior automatically. If you
|
|---|
| 93 | are running Premake from some other location, use the --scripts option to
|
|---|
| 94 | provide the path to that top-level folder:
|
|---|
| 95 |
|
|---|
| 96 | $ bin/release/premake5 --scripts=../path/to/premake test
|
|---|
| 97 |
|
|---|
| 98 | If you find yourself doing this repeatedly, or if you want Premake to be
|
|---|
| 99 | able to find other, custom scripts, you can also set a search path with the
|
|---|
| 100 | PREMAKE_PATH environment variable. Set it just like you would set your
|
|---|
| 101 | system PATH variable.
|
|---|