2008-10-31 18:38:05 +00:00
|
|
|
PREMAKE BUILD INSTRUCTIONS
|
|
|
|
|
2013-09-10 20:24:39 +00:00
|
|
|
Premake is written in a mix of C and Lua. This mix enables many new
|
2010-12-23 19:06:11 +00:00
|
|
|
features, but also makes building Premake a bit more complicated than
|
|
|
|
your typical application.
|
2013-09-10 20:24:39 +00:00
|
|
|
|
2010-12-23 19:06:11 +00:00
|
|
|
If you downloaded a source code package from SourceForge (as opposed
|
2013-09-10 20:24:39 +00:00
|
|
|
to pulling the sources from the repository), you will find project
|
|
|
|
files for all of the currently supported toolsets in the build/ folder.
|
|
|
|
Build the release configuration (the default for the makefiles) and you
|
2010-12-23 19:06:11 +00:00
|
|
|
will find the executable in bin/release ready to go.
|
2013-09-10 20:24:39 +00:00
|
|
|
|
2013-10-21 15:59:48 +00:00
|
|
|
$ cd build/gmake.unix
|
|
|
|
$ make
|
|
|
|
|
|
|
|
The binaries will be left in the bin/release directory.
|
|
|
|
|
2010-12-23 19:06:11 +00:00
|
|
|
If you want to use a debug build instead, or if you pulled the sources
|
2013-09-10 20:24:39 +00:00
|
|
|
from BitBucket instead of a SourceForge release, or if you plan on
|
|
|
|
making changes to Premake, read the next section to learn how to
|
2010-12-23 19:06:11 +00:00
|
|
|
prepare the project files.
|
2013-09-10 20:24:39 +00:00
|
|
|
|
|
|
|
If you find all of this very confusing and need some help, see the end
|
|
|
|
of this document for contact information. I'll be glad to help. And if
|
2013-10-21 15:59:48 +00:00
|
|
|
you have any suggestions for improving this process, I'd be glad to
|
2010-12-23 19:06:11 +00:00
|
|
|
hear them too.
|
2013-09-10 20:24:39 +00:00
|
|
|
|
2008-10-31 18:38:05 +00:00
|
|
|
|
|
|
|
GENERATING THE PROJECT FILES
|
|
|
|
|
|
|
|
If you downloaded a source code package from SourceForge, the project
|
2013-09-10 20:24:39 +00:00
|
|
|
files are already included (in build/) and you can skip ahead to the
|
|
|
|
next section.
|
|
|
|
|
|
|
|
If you pulled the sources from BitBucket, you'll need to generate your
|
|
|
|
own project files before you can build.
|
2010-12-23 19:06:11 +00:00
|
|
|
|
|
|
|
We use Premake to generate the project files for Premake (bootstrapping,
|
2013-09-10 20:24:39 +00:00
|
|
|
or eating our own dog food). So in order to generate the project files,
|
|
|
|
you need to have a working version of Premake 5.x installed on your
|
|
|
|
system. You can get it as source code (with pre-generated project files
|
2010-12-23 19:06:11 +00:00
|
|
|
ready to build) or a prebuilt binary from the SourceForge download page.
|
2013-09-10 20:24:39 +00:00
|
|
|
|
|
|
|
Once you have a working Premake 5.x installed, the first thing you need
|
|
|
|
to do is to embed the Lua scripts into the application by running this
|
2010-12-23 19:06:11 +00:00
|
|
|
command in the top-level Premake directory:
|
|
|
|
|
2013-09-10 20:24:39 +00:00
|
|
|
premake5 embed
|
|
|
|
|
|
|
|
This creates a C file (at src/host/scripts.c) which contains all of the
|
2010-12-23 19:06:11 +00:00
|
|
|
Lua scripts as static string buffers. These then get compiled into the
|
|
|
|
executable, which is how we get away with shipping a single file instead
|
|
|
|
of one executable and whole bunch of scripts. See EMBEDDING THE SCRIPTS,
|
|
|
|
below, for more information.
|
2013-09-10 20:24:39 +00:00
|
|
|
|
|
|
|
Now you can generate project files for your toolset of choice by running
|
|
|
|
a command like:
|
|
|
|
|
|
|
|
premake5 gmake -- for GNU makefiles using GCC
|
|
|
|
premake5 vs2008 -- for a Visual Studio 2008 solution
|
|
|
|
|
2008-12-29 23:20:44 +00:00
|
|
|
Use the "--help" option to see all of the available targets.
|
2013-09-10 20:24:39 +00:00
|
|
|
|
2010-12-23 19:06:11 +00:00
|
|
|
This will create a solution/makefile/workspace in the top-level folder,
|
|
|
|
which you can now go ahead and build.
|
|
|
|
|
2008-10-31 18:38:05 +00:00
|
|
|
|
2010-12-23 19:06:11 +00:00
|
|
|
RELEASE vs. DEBUG BUILDS
|
2008-10-31 18:38:05 +00:00
|
|
|
|
2010-12-23 19:06:11 +00:00
|
|
|
Premake can be built in either "release" or "debug" modes. Makefile users
|
|
|
|
can choose which configuration to build with the "config" argument:
|
2013-09-10 20:24:39 +00:00
|
|
|
|
2008-12-29 23:20:44 +00:00
|
|
|
make config=debug -- build in debug mode
|
|
|
|
make config=release -- build in release mode
|
2013-09-10 20:24:39 +00:00
|
|
|
|
2010-12-23 19:06:11 +00:00
|
|
|
IDEs like Visual Studio provide their own mechanism for switching build
|
|
|
|
configurations.
|
2013-09-10 20:24:39 +00:00
|
|
|
|
2010-12-23 19:06:11 +00:00
|
|
|
In release mode you can build and run Premake like any other C application
|
|
|
|
(once you've embedded the scripts, see the next section).
|
2013-09-10 20:24:39 +00:00
|
|
|
|
|
|
|
In debug mode, Premake ignores the embedded Lua scripts and instead reads the
|
2010-12-23 19:06:11 +00:00
|
|
|
latest versions from the disk at runtime. This allows you to change a script,
|
|
|
|
and then immediately test it without having to embed or compile first. Speedy!
|
2013-09-10 20:24:39 +00:00
|
|
|
But Premake needs some help to find the scripts.
|
|
|
|
|
2008-12-29 23:20:44 +00:00
|
|
|
You can specify the location of the scripts in one of two ways: using
|
|
|
|
the /scripts command line argument, like so:
|
2013-09-10 20:24:39 +00:00
|
|
|
|
|
|
|
premake5 /scripts=~/Code/premake5/src gmake
|
|
|
|
|
2008-10-31 18:38:05 +00:00
|
|
|
Or by setting a PREMAKE_PATH environment variable.
|
2013-09-10 20:24:39 +00:00
|
|
|
|
|
|
|
PREMAKE_PATH=~/Code/premake5/src
|
|
|
|
|
2008-10-31 18:38:05 +00:00
|
|
|
As you can see, you need to specify the location of the Premake "src"
|
|
|
|
directory, the one containing "_premake_main.lua".
|
2013-09-10 20:24:39 +00:00
|
|
|
|
|
|
|
|
2010-12-23 19:06:11 +00:00
|
|
|
EMBEDDING THE SCRIPTS
|
2008-10-31 18:38:05 +00:00
|
|
|
|
2010-12-23 19:06:11 +00:00
|
|
|
One of the nice things about Premake is that it comes as a single file,
|
|
|
|
easy to install or move around. To manage this, we need to embed all of
|
|
|
|
the Lua scripts into the executable, so we can deliver just the one file,
|
|
|
|
rather than an executable and a whole bunch of scripts.
|
|
|
|
|
|
|
|
Scripts are embedded by running the command
|
2013-09-10 20:24:39 +00:00
|
|
|
|
|
|
|
premake5 embed
|
|
|
|
|
2010-12-23 19:06:11 +00:00
|
|
|
This copies all of the scripts listed in _manifest.lua into the file
|
|
|
|
src/host/scripts.c, where they are represented as a set of static C
|
|
|
|
string buffers. This file is then compiled as part of Premake's release
|
|
|
|
builds.
|
2013-09-10 20:24:39 +00:00
|
|
|
|
2010-12-23 19:06:11 +00:00
|
|
|
So: very important to embed the scripts before each release build!
|
2013-09-10 20:24:39 +00:00
|
|
|
|
|
|
|
|
2008-10-31 18:38:05 +00:00
|
|
|
CONFUSED?
|
|
|
|
|
|
|
|
I'll be glad to help you out. Stop by the main project website where
|
2013-09-10 20:24:39 +00:00
|
|
|
you can leave a note in the forums (the preferred approach), join the
|
2008-10-31 18:38:05 +00:00
|
|
|
mailing list, or contact me directly.
|
2013-09-10 20:24:39 +00:00
|
|
|
|
2008-10-31 18:38:05 +00:00
|
|
|
http://industriousone.com/premake
|
2008-12-29 23:20:44 +00:00
|
|
|
|
|
|
|
Enjoy!
|