premake/website/docs/Using-Premake.md

75 lines
3.0 KiB
Markdown
Raw Normal View History

---
title: Using Premake
---
2021-03-16 15:47:10 +00:00
*New to Premake? You might want to start with [What is Premake?](what-is-premake)*
2021-03-30 14:02:26 +00:00
If you haven't already, you can [download Premake here](/download), or [build it from source](building-premake). Premake is a small command line executable, delivered as a single file. Just unpack the download and place the executable on your system search path, or anywhere else convenient.
2021-03-16 15:47:10 +00:00
## Using Premake to Generate Project Files
The simplest Premake command is:
2021-03-16 15:47:10 +00:00
```
premake5 [action]
```
Premake defines the following list of actions out of the box; projects may also add their own custom actions.
| Action | Description |
|-------------|---------------------------------------------------|
| vs2019 | Generate Visual Studio 2019 project files |
| vs2017 | Generate Visual Studio 2017 project files |
| vs2015 | Generate Visual Studio 2015 project files |
| vs2013 | Generate Visual Studio 2013 project files |
| vs2012 | Generate Visual Studio 2012 project files |
| vs2010 | Generate Visual Studio 2010 project files |
| vs2008 | Generate Visual Studio 2008 project files |
| vs2005 | Generate Visual Studio 2005 project files |
| gmake | Generate GNU Makefiles (This generator is deprecated by gmake2) |
| gmake2 | Generate GNU Makefiles (including [Cygwin][1] and [MinGW][2]) |
2021-03-16 15:47:10 +00:00
| xcode4 | XCode projects |
| codelite | CodeLite projects |
2021-03-16 15:47:10 +00:00
(Premake4 supported some additional actions that haven't yet been ported to this new version; see the [Available Feature Matrix](feature-matrix) for the whole list.)
To generate Visual Studio 2013 project files, use the command:
2021-03-16 15:47:10 +00:00
```
premake5 vs2013
```
You can see a complete list of the actions and other options supported by a project with the command:
2021-03-16 15:47:10 +00:00
```
premake5 --help
```
2021-03-16 15:47:10 +00:00
## Using the Generated Projects
For toolsets like Visual Studio and Xcode, you can simply load the generated workspace or workspace into your IDE and build as you normally would.
2021-03-16 15:47:10 +00:00
If you have generated makefiles, running `make` with no options will build all targets using the default configuration, as set by the project author. To see the list of available configurations, type:
2021-03-16 15:47:10 +00:00
```
make help
```
To build a different configuration, add the **config** argument:
2021-03-16 15:47:10 +00:00
```
make config=release
```
To remove all generated binaries and intermediate files:
2021-03-16 15:47:10 +00:00
```
make clean # to clean the default target
make config=release clean # to clean a different target
```
2021-03-16 15:47:10 +00:00
Premake generated makefiles do not (currently) support a `make install` step. Instead, project owners are encouraged to [add an install action](command-line-arguments) to their Premake scripts, which has the advantage of working with any toolset on any platform. You can check for the existence of an install action by viewing the help (run `premake5 --help` in the project directory).
[1]: http://www.cygwin.com/
[2]: http://www.mingw.org/