-
-
Notifications
You must be signed in to change notification settings - Fork 616
Using Modules
This wiki is no longer being maintained.
(Modules are a new feature in Premake 5.0, and also very much a work-in-progress. Please be patient with the module authors while we work through the growing pains. Questions and suggestions are welcomed over on the Premake Developer Forums)
Premake can be extended through the use of third-party modules. Modules can add support for new toolsets, languages, and frameworks as well as entirely new features. We keep a community-maintained list of modules here on the wiki.
To use a module, download or clone the module's repository to one of Premake's search paths, making sure that the destination folder has the same name as the module's main script, e.g. qt/qt.lua.
$ git clone https://github.com/dcourtois/premake-qt qt
Then simply call require()
from your project or system script to include it.
require "qt"
For convenience, you may wish to keep a copy of the modules you require in your project's source tree. In that case you may place them anywhere you wish, and provide the relative path when requiring it. For instance, if your main premake5.lua is located at the root of your project tree, and your modules are in a folder named build, you may load it like:
require "build/qt"
You may also put your modules anywhere on Premake's search paths, for example in ~/.premake. In this case no path information is needed, and you can simply call:
require "qt"
If you wish to make a module always available to all of your projects, you may place the call to require() in your system script. In that case, the module will be automatically loaded each time Premake runs, and all of its features will be available.
To ensure compatibility with your project script, it can sometimes be helpful to require a minimum version or range of versions for your module dependencies. Premake includes a modified version Lua's require()
function which accepts a version test as its second argument.
require("qt", ">=1.1")
See the require()
documentation for more information and examples.