Skip to content

buildcommands

starkos edited this page Apr 10, 2021 · 11 revisions

⚠️ We have a new website! Visit now for the most update to date documentation.
       This wiki is no longer being maintained.


Specifies one or more shell commands to be executed to build a project or file.

buildcommands { "commands" }

Parameters

commands specifies a list of one or more shell commands to be executed. The commands may use tokens.

Applies To

Makefile projects and per-file custom build commands.

Availability

Premake 5.0 or later.

Examples

Use per-file custom build commands to compile all Lua files in a project to C:

filter 'files:**.lua'
   -- A message to display while this build step is running (optional)
   buildmessage 'Compiling %{file.relpath}'

   -- One or more commands to run (required)
   buildcommands {
      'luac -o "%{cfg.objdir}/%{file.basename}.out" "%{file.relpath}"'
   }

   -- One or more outputs resulting from the build (required)
   buildoutputs { '%{cfg.objdir}/%{file.basename}.c' }

Use a Makefile project to execute an external makefile.

workspace "Workspace"
   configurations { "Debug", "Release" }

project "MyProject"
   kind "Makefile"

   buildcommands {
      "make %{cfg.buildcfg}"
   }

   cleancommands {
      "make clean %{cfg.buildcfg}"
   }

See Also

Clone this wiki locally