Skip to content
mba105 edited this page Sep 24, 2014 · 10 revisions

Home > FAQs


FAQs

Here are answers to some of the most frequently asked questions about Premake, taken from the forums and the mailing list.

Q. How do I control the build order of my projects

There are two ways: re-order the projects in the script, and create link dependencies.

The project files generated by Premake will maintain the order of the projects as they appear in your script. So you can change the build order by rearranging the order of the projects in your script.

However, when people ask this question they are really asking how to link against a library project. In this case you want to put the library project name, not the library file name, in the list of links for the dependent project.

So if I have a library project called "MyLibrary"...

#!lua
project "MyLibrary"
   kind "SharedLib"

...I can link against it like this.

#!lua
project "MyExecutable"
   kind "ConsoleApp"
   links { "MyLibrary" }

Premake will automatically figure out the library file name and directory and create a dependency between the two projects to ensure a proper build order.

You can also use this method to create a build dependency between non-libraries. For instance, you may want to build an executable to use in the prebuild step for another project. As shown above, just put the project name in the list of links for the dependent project. Premake will recognize it as an executable and create the build dependency, but skip the link dependency.

For more information, see the description of the links function.

Q. How do I build a Universal/64-bit/Xbox binary?

Supply the --platform option to Premake, and then build using the corresponding configuration.

premake4 --platform=universal gmake
make config=releaseuniv clean
make config=releaseuniv

Best practice is to clean before building a new platform. See [Platforms](Using Platforms) for more information. This feature requires Premake 4.1 or later.

Q. Is it possible to invoke external tools?

Yes, using Lua's os.execute() function. See the Lua Reference Manual for details.

Q. Why is my Windows program trying to call main() instead of WinMain()?

Premake tries hard to make all build tools on all platforms perform as similarly as possible. So, by default, it will configure your Windows applications to call the standard main() entry point instead of the Windows-specific WinMain(). You can change this behavior by adding the WinMain build flag to your package, like so:

#!lua
flags { "WinMain" }

Q. How do I get my cool new feature/bug fix included in Premake?

I love code contributions! The best way is to create a patch (see Subversion's diff command) against the Subversion repository, or if that's not possible, the most recent source code release. Post it to the Patch Tracker on SourceForge — I get notified via email, and it provides a good place to discuss and track it.

If you can't figure out how to make a patch, get it to me however you can. I will do my best to make sense of it.

Clone this wiki locally