Merge pull request #1594 from KyrietS/api-reference-pages

Added reference pages to docs
This commit is contained in:
starkos 2021-03-16 10:39:23 -04:00 committed by GitHub
commit c97edfa2a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
278 changed files with 8661 additions and 7 deletions

16
website/docs/_ACTION.md Normal file
View File

@ -0,0 +1,16 @@
The `_ACTION` global variable stores the name of the action to be performed on this execution run. As an example, if this command line was used to launch Premake:
```
$ premake5 vs2013
```
...then `_ACTION` will be set to "vs2013". If there is no action (for instance, if the command was `premake5 --help`) this variable will be nil.
### Availability ###
Premake 4.0 or later.
## See Also ##
* [_ARGS](_ARGS.md)
* [_OPTIONS](_OPTIONS.md)

17
website/docs/_ARGS.md Normal file
View File

@ -0,0 +1,17 @@
The `_ARGS` global variable stores any arguments to the current action. As an example, if this command line was used to launch Premake:
```
$ premake5 vs2012 alpha beta
```
...then `_ARGS[1]` will be set to "alpha" and `_ARGS[2]` to "beta". If there are no arguments this array will be empty.
### Availability ###
Premake 4.0 or later.
## See Also ##
* [_ACTION](_ACTION.md)
* [_OPTIONS](_OPTIONS.md)

View File

@ -0,0 +1,11 @@
The `_MAIN_SCRIPT` global variable stores the full path to the main project script. This will be the value passed to the `--file` command line argument, or the location of the initial **premake5.lua** script if no `--file` argument was specified.
### Availability ###
Premake 5.0 or later.
## See Also ##
* [_MAIN_SCRIPT_DIR](_MAIN_SCRIPT_DIR.md)
* [_PREMAKE_DIR](_PREMAKE_DIR.md)
* [_WORKING_DIR](_WORKING_DIR.md)

View File

@ -0,0 +1,11 @@
The `_MAIN_SCRIPT_DIR` global variable stores the full path to the directory which contains the main project script. This will be the value passed to the `--file` command line argument, or the location of the initial premake5.lua script if no `--file` argument was specified.
### Availability ###
Premake 5.0 or later.
## See Also ##
* [_MAIN_SCRIPT](_MAIN_SCRIPT.md)
* [_PREMAKE_DIR](_PREMAKE_DIR.md)
* [_WORKING_DIR](_WORKING_DIR.md)

10
website/docs/_OPTIONS.md Normal file
View File

@ -0,0 +1,10 @@
The `_OPTIONS` global variable lists the current set of command line options and their values, if any. For more information, see [Command Line Arguments](Command-Line-Arguments.md).
### Availability ###
Premake 4.0 or later.
## See Also ##
* [_ACTION](_ACTION.md)
* [_ARGS](_ARGS.md)

16
website/docs/_OS.md Normal file
View File

@ -0,0 +1,16 @@
Stores the name of the operating system currently being targeted; see [system()](system.md) for a complete list of OS identifiers.
The current OS may be overridden on the command line with the `--os` option.
```
$ premake5 --os=linux gmake
```
### Availability ###
Premake 4.0 or later.
## See Also ##
* [Using Premake](Using-Premake.md)

View File

@ -0,0 +1,11 @@
The `_PREMAKE_COMMAND` global variable stores the full path to the Premake executable.
### Availability ###
Premake 4.4 or later.
## See Also ##
* [_PREMAKE_DIR](_PREMAKE_DIR.md)
* [_PREMAKE_VERSION](_PREMAKE_VERSION.md)
* [_WORKING_DIR](_WORKING_DIR.md)

View File

@ -0,0 +1,10 @@
The `_PREMAKE_DIR` global variable stores the full path to the directory which contains the Premake executable.
### Availability ###
Premake 5.0 or later.
## See Also ##
* [_MAIN_SCRIPT_DIR](_MAIN_SCRIPT_DIR.md)
* [_WORKING_DIR](_WORKING_DIR.md)

View File

@ -0,0 +1,7 @@
Stores the version of the currently executing instance of Premake, in the form "major.minor.patch.dev".
The current development version (i.e. what's in the git repository) uses the development version "dev", as in "5.0.0.dev". When a development release is made, this will become "5.0.0.alpha1", then "5.0.0.alpha2", "5.0.0.beta1" and so on, until the final release "5.0.0".
### Availability ###
Premake 4.4 or later.

View File

@ -0,0 +1,11 @@
The `_WORKING_DIR` global variable stores the full path to the directory which current when Premake was launched.
### Availability ###
Premake 5.0 or later.
## See Also ##
* [_MAIN_SCRIPT_DIR](_MAIN_SCRIPT_DIR.md)
* [_PREMAKE_DIR](_PREMAKE_DIR.md)
* [_WORKING_DIR](_WORKING_DIR.md)

View File

@ -0,0 +1,42 @@
Specifies the system architecture to be targeted by the configuration.
```lua
architecture ("value")
```
### Parameters ###
`value` is one of:
* `x86`
* `x86_64`
* `ARM`
More values may be added by [add-on modules](Modules.md).
### Applies To ###
Project configurations.
### Availability ###
Premake 5.0 or later.
### Examples ###
Set up 32- and 64-bit Windows builds.
```lua
workspace "MyWorkspace"
configurations { "Debug32", "Release32", "Debug64", "Release64" }
filter "configurations:*32"
architecture "x86"
filter "configurations:*64"
architecture "x86_64"
```
### See Also ###
* [system](system.md)

23
website/docs/atl.md Normal file
View File

@ -0,0 +1,23 @@
Enables Microsoft's Active Template Library in a project.
```lua
atl ("value")
```
### Parameters ###
`value` is one of:
| Action | Description |
|-------------|---------------------------------------|
| Off | Do not use ATL (default). |
| Dynamic | Link the ATL libraries dynamically. |
| Static | Link the ATL libraries statically. |
### Applies To ###
Project configurations.
### Availability ###
Premake 5.0 or later.

View File

@ -1,7 +1,3 @@
---
title: basedir
---
Sets the base directory for a configuration, from with other paths contained by the configuration will be made relative at export time.
```lua

24
website/docs/bindirs.md Normal file
View File

@ -0,0 +1,24 @@
bindirs
```lua
bindirs { "directory" }
```
### Parameters ###
`directory` - needs documentation.
### Applies To ###
The `config` scope.
### Availability ###
Premake 5.0.0 alpha 12 or later.
### Examples ###
```lua
bindirs { "directory" }
```

View File

@ -0,0 +1,48 @@
Specifies how a file or set of files should be treated during the compilation process. It is usually paired with a filter to select a file set. If no build action is specified for a file a default action will be used, based on the file's extension.
```lua
buildaction ("action")
```
### Parameters ###
For C/C++, `action` is the name of the MSBuild action as defined by the vcxproj format; eg: `ClCompile`, `FxCompile`, `None`, etc, and may refer to any such action available to MSBuild.
For C# projects, `buildaction` behaviour is special to support legacy implementation.
In C#, `action` is one of
| Action | Description |
|-------------|-----------------------------------------------------------------------|
| Application | Mark the file as the application definition XAML for WPF. |
| Compile | Treat the file as source code; compile and link it. |
| Component | Treat the source file as [a component][1], usually a visual control. |
| Copy | Copy the file to the target directory. |
| Embed | Embed the file into the target binary as a resource. |
| Form | Treat the source file as visual (Windows) form. |
| None | Do nothing with this file. |
| Resource | Copy/embed the file with the project resources. |
| UserControl | Treat the source file as [visual user control][2]. |
The descriptive actions such as **Component**, **Form*, and **UserControl** are only recognized by Visual Studio, and may be considered optional as Visual Studio will automatically deduce the types when it first examines the project. You only need to specify these actions to avoid unnecessary modifications to the project files on save.
### Applies To ###
File configurations.
### Availability ###
Build actions are currently supported for C/C++ and C# projects.
`Compile`, `Copy`, `Embed`, and `None` are available in Premake 4.4 or later. All actions are available in Premake 5.0 or later.
## Examples ##
Embed all PNG images files into the target binary.
```lua
filter "files:**.png"
buildaction "Embed"
```
[1]: http://msdn.microsoft.com/en-us/library/ms228287(v=vs.90).aspx
[2]: http://msdn.microsoft.com/en-us/library/a6h7e207(v=vs.71).aspx

View File

@ -0,0 +1,65 @@
Specifies one or more shell commands to be executed to build a project or file.
```lua
buildcommands { "commands" }
```
### Parameters ###
`commands` specifies a list of one or more shell commands to be executed. The commands may use [tokens](Tokens.md).
### Applies To ###
Makefile projects and per-file custom build commands.
### Availability ###
Premake 5.0 or later.
### Examples ###
Use [per-file custom build commands](Custom-Build-Commands.md) to compile all Lua files in a project to C:
```lua
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](Makefile-Projects.md) to execute an external makefile.
```lua
workspace "Workspace"
configurations { "Debug", "Release" }
project "MyProject"
kind "Makefile"
buildcommands {
"make %{cfg.buildcfg}"
}
cleancommands {
"make clean %{cfg.buildcfg}"
}
```
## See Also ##
* [Custom Build Commands](Custom-Build-Commands.md)
* [Makefile Projects](Makefile-Projects.md)
* [buildinputs](buildinputs.md)
* [buildmessage](buildmessage.md)
* [buildoutputs](buildoutputs.md)
* [cleancommands](cleancommands.md)
* [rebuildcommands](rebuildcommands.md)

View File

@ -0,0 +1,24 @@
buildcustomizations
```lua
buildcustomizations { "string" }
```
### Parameters ###
`value` - needs documentation.
### Applies To ###
The `project` scope.
### Availability ###
Premake 5.0.0 alpha 12 or later.
### Examples ###
```lua
buildcustomizations { "string" }
```

View File

@ -0,0 +1,25 @@
Specifies any additional dependencies for the target of a custom build rule.
```lua
builddependencies { "files" }
```
### Parameters ###
`files` specifies a list of file path for additional dependencies.
### Applies To ###
Rules.
### Availability ###
Premake 5.0 or later.
### See Also ###
* [Custom Rules](Custom-Rules.md)
* [rules](rules.md)

View File

@ -0,0 +1,28 @@
Specifies the source file file inputs of a custom build command or rule.
```lua
buildinputs { "inputs" }
```
### Parameters ###
`inputs` is the list of input source files.
### Applies To ###
Project configurations.
### Availability ###
Premake 5.0 or later.
### See Also ###
* [Custom Build Commands](Custom-Build-Commands.md)
* [Custom Rules](Custom-Rules.md)
* [buildcommands](buildcommands.md)
* [builddependencies](builddependencies.md)
* [buildoutputs](buildoutputs.md)

19
website/docs/buildlog.md Normal file
View File

@ -0,0 +1,19 @@
Specifies the output location of a toolset's build logs.
```lua
buildlog ("path")
```
If a build log path has not been specified, the toolset's default path will be used.
### Parameters ###
`path` is the output file system location for the build log file.
### Applies To ###
Project configurations.
### Availability ###
Premake 5.0 or later. Currently only implemented for Visual Studio 2010+.

View File

@ -0,0 +1,26 @@
Specifies the text to output to the when a custom build command or rule is executed.
```lua
buildmessage ("message")
```
### Parameters ###
`message` is the text to write to standard output.
### Applies To ###
Project configurations and rules.
### Availability ###
Premake 5.0 or later.
### See Also ###
* [Custom Build Commands](Custom-Build-Commands.md)
* [Custom Rules](Custom-Rules.md)
* [buildcommands](buildcommands.md)

View File

@ -0,0 +1,28 @@
Passes arguments directly to the compiler command line without translation.
```lua
buildoptions { "options" }
```
If a project includes multiple calls to `buildoptions` the lists are concatenated, in the order in which they appear in the script.
### Parameters ###
`options` is a list of compiler flags and options, specific to a particular compiler.
### Applies To ###
Project configurations.
### Availability ###
Premake 4.0 or later.
### Examples ###
Use `pkg-config` style configuration when building on Linux with GCC. Build options are always compiler specific and should be targeted to a particular toolset.
```lua
configuration { "linux", "gmake" }
buildoptions { "`wx-config --cxxflags`", "-ansi", "-pedantic" }
```

View File

@ -0,0 +1,28 @@
Specifies the file outputs of a custom build command or rule.
```lua
buildoutputs { "output" }
```
### Parameters ###
`output` is the file that is created or updated by the custom build command or rule.
### Applies To ###
Project configurations and rules.
### Availability ###
Premake 5.0 or later.
### See Also ###
* [Custom Build Commands](Custom-Build-Commands.md)
* [Custom Rules](Custom-Rules.md)
* [buildcommands](buildcommands.md)
* [builddependencies](builddependencies.md)
* [buildinputs](buildinputs.md)

23
website/docs/buildrule.md Normal file
View File

@ -0,0 +1,23 @@
buildrule
```lua
buildrule { "value" }
```
### Parameters ###
`value` - needs documentation.
### Applies To ###
The `config` scope.
### Availability ###
Premake 5.0.0 alpha 12 or later.
### Examples ###
```lua
buildrule { "value" }
```

View File

@ -0,0 +1,24 @@
Sets the [function calling convention](https://en.wikipedia.org/wiki/X86_calling_conventions).
```lua
callingconvention ("value")
```
### Parameters ###
`value` is one of:
| |
|-------------|
| Cdecl |
| FastCall |
| StdCall |
| VectorCall |
### Applies To ###
Project configurations.
### Availability ###
Premake 5.0 or later.

33
website/docs/cdialect.md Normal file
View File

@ -0,0 +1,33 @@
cdialect
```lua
cdialect "value"
```
### Parameters ###
`value` one of:
* `Default` - needs documentation.
* `C89` - needs documentation.
* `C90` - needs documentation.
* `C99` - needs documentation.
* `C11` - needs documentation.
* `gnu89` - needs documentation.
* `gnu90` - needs documentation.
* `gnu99` - needs documentation.
* `gnu11` - needs documentation.
### Applies To ###
The `config` scope.
### Availability ###
Premake 5.0.0 alpha 12 or later.
### Examples ###
```lua
cdialect "value"
```

View File

@ -0,0 +1,23 @@
Set the character encoding.
```lua
characterset ("value")
```
### Parameters ###
`value` is one of:
* `Default`: the default encoding for the toolset; usually `Unicode`
* `MBCS`: Multi-byte Character Set; currently Visual Studio only
* `Unicode`: Unicode character encoding
* `ASCII`: No actual character set
### Applies To ###
Project configurations.
### Availability ###
Premake 5.0 or later.

View File

@ -0,0 +1,51 @@
Specifies one or more shell commands to be executed to clean a [Makefile project](Makefile-Projects.md).
```lua
cleancommands { "commands" }
```
### Parameters ###
`commands` specifies a list of one or more shell commands to be executed. The commands may use tokens.
### Applies To ###
[Makefile projects](Makefile-Projects.md)
### Availability ###
Premake 5.0 or later.
## Examples ##
Use a [Makefile project](Makefile-Projects.md) to execute an external makefile.
```lua
workspace "MyWorkspace"
configurations { "Debug", "Release" }
project "MyProject"
kind "Makefile"
buildcommands {
"make %{cfg.buildcfg}"
}
rebuildcommands {
"make %{cfg.buildcfg} rebuild"
}
cleancommands {
"make clean %{cfg.buildcfg}"
}
```
## See Also ##
* [Custom Build Commands](Custom-Build-Commands.md)
* [Makefile Projects](Makefile-Projects.md)
* [buildcommands](buildcommands.md)
* [buildmessage](buildmessage.md)
* [buildoutputs](buildoutputs.md)
* [rebuildcommands](rebuildcommands.md)

View File

@ -0,0 +1,25 @@
Specifies one or more file extensions to find and remove when cleaning the project.
```lua
cleanextensions { ".ext1", ".ext2" }
```
### Parameters ###
A list of dot-prefixed file extensions to be cleaned.
### Applies To ###
Projects.
### Availability ###
Premake 5.0 or later. This function is currently implemented only for Visual Studio 201x.
### Examples ###
Remove .zip files from the output directory when cleaning.
```lua
cleanextensions { ".zip" }
```

49
website/docs/clr.md Normal file
View File

@ -0,0 +1,49 @@
Enables Microsoft's Common Language Runtime for a project or configuration.
```lua
clr "value"
```
See [/clr (Common Language Runtime Compilation)](http://msdn.microsoft.com/en-us/library/k8d11d4s.aspx) in the Visual Studio documentation for more information.
### Parameters ###
`value` is one of the following:
| Value | Description |
|-------------|------------------------------------------------------------------------|
| Off | No CLR support |
| On | Enable CLR support |
| Pure | Enable pure mode MSIL. Equivalent to "On" for .NET projects. |
| Safe | Enable verifiable MSIL. Equivalent to "On" for .NET projects. |
| Unsafe | Enable unsafe operations. Equivalent to "On" for Managed C++ projects. |
CLR settings that do not make sense for the current configuration, such setting CLR support for a C# project to "Off", will be ignored.
### Applies To ###
Project configurations.
### Availability ###
Premake 5.0.
### Examples ###
Set up a managed C++ project.
```lua
project "MyProject"
kind "ConsoleApp"
language "C++"
clr "On"
```
Enable unsafe code in a C# project.
```lua
project "MyProject"
kind "ConsoleApp"
language "C#"
clr "Unsafe"
```

28
website/docs/compileas.md Normal file
View File

@ -0,0 +1,28 @@
compileas
```lua
compileas "value"
```
### Parameters ###
`value` one of:
* `Default` - Compile based on file extensions that have been built into premake.
* `C` - Compile as a C source file.
* `C++` - Compile as a C++ source file.
### Applies To ###
The `workspace`, `project` or `file` scope.
### Availability ###
Premake 5.0.0 alpha 13 or later.
### Examples ###
```lua
filter { "files:**.c" }
compileas "C++"
```

View File

@ -0,0 +1,26 @@
compilebuildoutputs
```lua
compilebuildoutputs "value"
```
### Parameters ###
`value` one of:
* `on` - needs documentation.
* `off` - needs documentation.
### Applies To ###
The `config` scope.
### Availability ###
Premake 5.0.0 alpha 12 or later.
### Examples ###
```lua
compilebuildoutputs "value"
```

View File

@ -0,0 +1,19 @@
Specifies an Xbox 360 configuration file.
```lua
configfile "file"
```
### Parameters ###
`file` is the script-relative path to the configuration file.
### Applies To ###
Project configurations.
### Availability ###
Premake 5.0 or later.

64
website/docs/configmap.md Normal file
View File

@ -0,0 +1,64 @@
Map workspace level configuration and platforms to a different project configuration or platform.
```lua
configmap {
[{ wks_cfg }] = { prj_cfg },
```
You may map multiple configurations in a single configuration map.
### Parameters ###
`wks_cfg` is the workspace configuration being mapped. It can be a string representing a build configuration or a platform, or a table holding a build configuration/platform pair.
`prj_cfg` is the project configuration to which the workspace configuration should be mapped. It may also be a string or a build configuration/platform pair.
### Applies To ###
Projects.
### Availability ###
5.0 or later.
### Examples ###
The workspace contains four build configurations, while the project contains only the standard Debug and Release. Map the extra workspace configurations to Debug and Release.
```lua
workspace "MyWorkspace"
configurations { "Debug", "Development", "Profile", "Release" }
project "MyProject"
configmap {
["Development"] = "Debug",
["Profile"] = "Release",
}
```
It can be useful to specify a map globally for a workspace, but only apply it if the target configuration is actually present in the project. In this example, host executables can be built for either Windows or Mac, while some projects build for an embedded controller. Any project that uses the special "Embedded" platform will receive the configuration map.
```lua
workspace "MyWorkspace"
configurations { "Debug", "Release" }
platforms { "Windows", "Mac" }
filter { "platforms:Embedded" }
configmap {
["Windows"] = "Embedded",
["Mac"] = "Embedded"
}
-- this project gets the configuration map, because it defines an "Embedded" platform
project "MyEmbeddedProject"
platforms { "Embedded" }
-- this one does not
project "MyHostProject"
```
### See Also ###
* [Configurations and Platforms](Configurations-and-Platforms.md)

View File

@ -0,0 +1,131 @@
Limits the subsequent build settings to a particular environment.
```lua
configuration { "keywords" }
```
**This function will soon be deprecated and its use is discouraged.** Use the new [filter()](filter.md) function instead; you will get more granular matching and much better performance.
### Parameters ###
`keywords` is a list of identifiers (see below). When all of the keywords in this list match Premake's current context, the settings that follow the `configuration` statement will be applied. If any of the identifiers are not in the current context the settings will be ignored.
The available sources for keywords. Keywords are not case-sensitive.
* **Configuration names.** Any of the configuration names supplied to the **[configurations](configurations.md)** or **[platforms](Platforms.md)** functions.
* **Action names** such as **vs2010** or **gmake**. See the [Using Premake](Using-Premake.md) for a complete list.
* **Command line options**.
* **System names** such as **windows**, **macosx**, or **xbox360**.
* **Architectures** such as **x32** or **x64**.
* **Toolsets** such as **gcc**.
* **Target kinds** like **ConsoleApp** or **SharedLib**.
* **Languages** like **C++** or **C#**.
* **File names** can be used to apply settings to a specific set of source code files; this feature is currently very limited.
In addition to the terms listed above, you may use the **\*** and **\*\*** wildcards to match more than one term or file. You may also use the modifiers **not** and **or** to build more complex conditions. See the examples below for more information.
### Examples ###
Define a new symbol which applies only to debug builds; assumes a configuration named "Debug" was defined as part of the workspace.
```lua
configuration "Debug"
defines { "_DEBUG" }
```
Define a symbol only when targeting Visual Studio 2010.
```lua
configuration "vs2010"
defines { "VISUAL_STUDIO_2005" }
```
Wildcards can be used to match multiple terms. Define a symbol for all versions of Visual Studio.
```lua
configuration "vs*"
defines { "VISUAL_STUDIO" }
```
Add a suffix to the debug versions of libraries.
```lua
configuration { "Debug", "SharedLib or StaticLib" }
targetsuffix "_d"
-- ...or...
configuration { "Debug", "*Lib" }
targetsuffix "_d"
```
Apply settings based on the presence of a [custom command line option](Command-Line-Arguments.md).
```lua
-- Using an option like --localized
configuration { "localized" }
files { "src/localizations/**" }
-- Using an option like --renderer=opengl
configuration { "renderer=opengl" }
files { "src/opengl/**.cpp" }
```
Although support is currently quite limited, you may also apply settings to a particular file or set of files. This example sets the build action for all PNG image files.
```lua
configuration "*.png"
buildaction "Embed"
```
In the case of files you may also use the **\*\*** wildcard, which will recurse into subdirectories.
```lua
configuration "**.png"
buildaction "Embed"
```
If multiple keywords are specified, they will be treated as a logical AND. All terms must be present for the block to be applied. This example will apply the symbol only for debug builds on Mac OS X.
```lua
configuration { "debug", "macosx" }
defines { "DEBUG_MACOSX" }
```
Multiple terms must use Lua's curly bracket list syntax.
You can use the **or** modifier to match against multiple, specific terms.
```lua
configuration "linux or macosx"
defines { "LINUX_OR_MACOSX" }
```
You can also use **not** to apply the settings to all environments where the identifier is not set.
```lua
configuration "not windows"
defines { "NOT_WINDOWS" }
```
Finally, you can reset the configuration filter and remove all active keywords by passing the function an empty table.
```lua
configuration {}
```
### Availability ###
Premake 4.0 or later. Will be deprecated at some point in 5.x development in favor of [filter()](filter.md).
### See Also ###
* [Filters](Filters.md)
* [filter](filter.md)

View File

@ -0,0 +1,42 @@
Specifies the set of build configurations, such as "Debug" and "Release", for a workspace or project.
```lua
configurations { "names" }
```
A configuration encapsulates a collection of build settings, allowing the developer to easily switch between them. "Debug" and "Release" are the most common configuration names.
For more information, see [Configurations and Platforms](Configurations-and-Platforms.md).
### Parameters ###
`names` is a list of configuration names. Spaces are allowed, but may make using certain Premake features, such as a command-line configuration selection, more difficult.
### Applies To ###
Workspaces and projects.
### Availability ###
Premake 4.0 or later. Per-project configuration lists were introduced in Premake 5.0.
### Examples ###
Specify debug and release configurations for a workspace.
```lua
workspace "MyWorkspace"
configurations { "Debug", "Release" }
```
Add additional configurations for a dynamic link library version.
```lua
configurations { "Debug", "Release", "DebugDLL", "ReleaseDLL" }
```
## See Also ##
* [Configurations and Platforms](Configurations-and-Platforms.md)
* [platforms](platforms.md)

43
website/docs/copylocal.md Normal file
View File

@ -0,0 +1,43 @@
Specifies a list of libraries or assembly references which should be copied to the target directory as part of the build. Refer to the Visual Studio C# project feature of the same name.
```lua
copylocal { "libraries" }
```
If a project includes multiple calls to `copylocal` the lists are concatenated, in the order in which they appear in the script.
Note that, by default, all referenced non-system assemblies in a C# project are copied. This function only needs to called when a subset of the referenced assemblies should be copied. To disable copying of *all* references, use the `NoLocalCopy` build flag instead (see Examples, below).
### Parameters ###
`libraries` is a list of the libraries or assemblies to be copied as part of the build. The names specified here should match the names used in the call to `links()`.
### Applies To ###
Project configurations.
### Availability ###
Premake 5.0 and later. This feature is currently only supported for Visual Studio C# projects.
### Examples ###
Copy only the **Renderer** and **Physics** assemblies to the target directory; do not copy **nunit.framework**. Note that the links may refer to project or assembly references.
```lua
links { "Renderer", "Physics", "nunit.framework" }
copylocal { "Renderer", "Physics" }
```
The link should be specified in exactly the same way in both `links()` and `copylocal()`.
```lua
links { "Renderer", "../ThirdParty/nunit.framework" }
copylocal { "../ThirdParty/nunit.framework" }
```
If you want to prevent any assemblies from being copied, use the **NoLocalCopy** flag instead.
```lua
flags { "NoCopyLocal" }
```

View File

@ -0,0 +1,33 @@
cppdialect
```lua
cppdialect "value"
```
### Parameters ###
`value` one of:
* `Default` - needs documentation.
* `C++98` - needs documentation.
* `C++11` - needs documentation.
* `C++14` - needs documentation.
* `C++17` - needs documentation.
* `gnu++98` - needs documentation.
* `gnu++11` - needs documentation.
* `gnu++14` - needs documentation.
* `gnu++17` - needs documentation.
### Applies To ###
The `config` scope.
### Availability ###
Premake 5.0.0 alpha 12 or later.
### Examples ###
```lua
cppdialect "value"
```

23
website/docs/csversion.md Normal file
View File

@ -0,0 +1,23 @@
Specifies the C# language level.
```lua
csversion ("value")
```
### Parameters ###
`value` is a string specifying the C# language level.
### Applies To ###
Project.
### Availability ###
Premake 5.0 or later.
### See Also ###
* [clr](clr.md)
* [dotnetframework](dotnetframework.md)

View File

@ -0,0 +1,28 @@
customtoolnamespace
```lua
customtoolnamespace "value"
```
Only used by Visual Studio .NET targets.
Maps to `<CustomToolNamespace>` MSBuild element.
### Parameters ###
`value` - needs documentation.
### Applies To ###
The `config` scope.
### Availability ###
Premake 5.0.0 alpha 12 or later.
### Examples ###
```lua
customtoolnamespace "value"
```

View File

@ -0,0 +1,11 @@
Opens a REPL (replace-eval-print loop) prompt where you can enter and evaluate Lua commands against the current script environment.
```lua
debug.prompt()
```
This call is also tied to the `--interactive` flag: specifying this flag will open a prompt after the project scripts have been executed and "baked" for the current environment.
### Availability ###
Premake 5.0 or later.

28
website/docs/debugargs.md Normal file
View File

@ -0,0 +1,28 @@
Specifies a list of arguments to pass to the application when run under the debugger.
```lua
debugargs { "args" }
```
Note that this setting is not implemented for Xcode 3, which requires a per-user configuration file in order to make it work.
In Visual Studio, this file can be overridden by a per-user configuration file (such as `ProjectName.vcproj.MYDOMAIN-MYUSERNAME.user`). Removing this file (which is done by Premake's clean action) will restore the default settings.
### Parameters ###
`args` is a Lua list of arguments to provide to the executable while debugging.
### Applies To ###
Project configurations.
### Availability ###
Premake 4.4 or later.
### Examples ###
```lua
configuration "Debug"
debugargs { "--append", "somefile.txt" }
```

View File

@ -0,0 +1,24 @@
Specifies the command to launch a project's target when debugging.
```lua
debugcommand ("command")
```
In Visual Studio, this file can be overridden by a per-user configuration file (such as `ProjectName.vcproj.MYDOMAIN-MYUSERNAME.user`). Removing this file (which is done by Premake's clean action) will restore the default settings.
### Parameters ###
`command` is the command to run to start the target.
### Applies To ###
Project configurations.
### Availability ###
Premake 5.0 or later.
### See Also ###
* [debugargs](debugargs.md)
* [debugdir](debugdir.md)

View File

@ -0,0 +1,21 @@
Specifies commands to be executed upon connection of the debugger to a remote process.
```lua
debugconnectcommands { "commands" }
```
### Parameters ###
`commands` is a list of commands to execute.
### Applies To ###
Project configurations.
### Availability ###
Premake 5.0 or later.
### See Also ###
* [debugstartupcommands](debugstartupcommands.md)

View File

@ -0,0 +1,24 @@
debugconstants
```lua
debugconstants { "string" }
```
### Parameters ###
`value` - needs documentation.
### Applies To ###
The `config` scope.
### Availability ###
Premake 5.0.0 alpha 12 or later.
### Examples ###
```lua
debugconstants { "string" }
```

29
website/docs/debugdir.md Normal file
View File

@ -0,0 +1,29 @@
Sets the working directory for the integrated debugger.
```lua
debugdir "path"
```
Note that this settings is not implemented for Xcode 3, which requires a per-user configuration file in order to make it work.
In Visual Studio, this file can be overridden by a per-user configuration file (such as `ProjectName.vcproj.MYDOMAIN-MYUSERNAME.user`). Removing this file (which is done by Premake's clean action) will restore the default settings.
### Parameters ###
`path` is the path to the working directory, relative to the currently executing script file.
### Applies To ###
Project configurations.
### Availability ###
Premake 4.4 or later.
### Examples ###
```lua
configuration "Debug"
debugdir "bin/debug"
```

17
website/docs/debugenvs.md Normal file
View File

@ -0,0 +1,17 @@
Specifies environment variables for the debug session.
```lua
debugenvs { "envs" }
```
### Parameters ###
`envs` is a list of environment variable definitions for the debug session.
### Applies To ###
Project configurations.
### Availability ###
Premake 5.0 or later.

View File

@ -0,0 +1,17 @@
Specifies to use the 'extended-remote' protocol, which instructs GDB to maintain a persistent connection to gdbserver.
```lua
debugextendedprotocol (enabled)
```
### Parameters ###
`enabled` is a boolean value that specifies whether to use the 'extended remote' protocol.
### Applies To ###
Project configurations.
### Availability ###
Premake 5.0 or later.

View File

@ -0,0 +1,30 @@
Specifies the desired format of the debug information written to the output binaries.
```lua
debugformat "format"
```
### Parameters ###
`format` specifies the desired debug format:
| Value | Description |
|-------------|---------------------------------------------------------------------------------------------|
| c7 | Specifies that MSVC should store debuginfo in the objects rather than a separate .pdb file. |
More values may be added by [add-on modules](Modules.md).
**Note for Visual Studio Users:** Use [editAndContinue](editAndContinue.md) to control the `/Zi` and `/ZI` switches; see [this discussion](https://github.com/premake/premake-core/issues/1425) for more information.
### Applies To ###
Project configurations.
### Availability ###
Premake 5.0 or later.
### See Also ###
- [editAndContinue](editAndContinue.md)

27
website/docs/debugger.md Normal file
View File

@ -0,0 +1,27 @@
debugger
```lua
debugger "value"
```
### Parameters ###
`value` one of:
* `Default` - needs documentation.
* `GDB` - needs documentation.
* `LLDB` - needs documentation.
### Applies To ###
The `config` scope.
### Availability ###
Premake 5.0.0 alpha 12 or later.
### Examples ###
```lua
debugger "value"
```

View File

@ -0,0 +1,27 @@
debuggertype
```lua
debuggertype "value"
```
### Parameters ###
`value` one of:
* `Mixed` - needs documentation.
* `NativeOnly` - needs documentation.
* `ManagedOnly` - needs documentation.
### Applies To ###
The `config` scope.
### Availability ###
Premake 5.0.0 alpha 12 or later.
### Examples ###
```lua
debuggertype "value"
```

View File

@ -0,0 +1,24 @@
debuglevel
```lua
debuglevel (int)
```
### Parameters ###
`int` - needs documentation.
### Applies To ###
The `config` scope.
### Availability ###
Premake 5.0.0 alpha 12 or later.
### Examples ###
```lua
debuglevel (int)
```

View File

@ -0,0 +1,24 @@
debugpathmap
```lua
debugpathmap { ["key"] = "path" }
```
### Parameters ###
`key, path` - needs documentation.
### Applies To ###
The `config` scope.
### Availability ###
Premake 5.0.0 alpha 12 or later.
### Examples ###
```lua
debugpathmap { ["key"] = "path" }
```

21
website/docs/debugport.md Normal file
View File

@ -0,0 +1,21 @@
Specifies the remote debug port.
```lua
debugport (portnumber)
```
### Parameters ###
`portnumber` is an integer port number for the debugger to connect on.
### Applies To ###
Project configurations.
### Availability ###
Premake 5.0 or later.
### See Also ###
* [debugremotehost](debugremotehost.md)

View File

@ -0,0 +1,21 @@
Specifies the remote debugging target.
```lua
debugremotehost "host"
```
### Parameters ###
`host` specifies a host to connect to when starting a remote debug session.
### Applies To ###
Project configurations.
### Availability ###
Premake 5.0 or later.
### See Also ###
* [debugport](debugport.md)

View File

@ -0,0 +1,17 @@
Specifies a list of paths to search for source code while debugging.
```lua
debugsearchpaths { "paths" }
```
### Parameters ###
`paths` is a list of paths the debugger will use to search for source files.
### Applies To ###
Project configurations.
### Availability ###
Premake 5.0 or later.

View File

@ -0,0 +1,21 @@
Specifies commands to be executed immediately as the debugger starts, before connecting to the target process.
```lua
debugstartupcommands { "commands" }
```
### Parameters ###
`commands` is a list of commands to execute.
### Applies To ###
Project configurations.
### Availability ###
Premake 5.0 or later.
### See Also ###
* [debugconnectcommands](debugconnectcommands.md)

View File

@ -0,0 +1,24 @@
debugtoolargs
```lua
debugtoolargs { "string" }
```
### Parameters ###
`value` - needs documentation.
### Applies To ###
The `config` scope.
### Availability ###
Premake 5.0.0 alpha 12 or later.
### Examples ###
```lua
debugtoolargs { "string" }
```

View File

@ -0,0 +1,24 @@
debugtoolcommand
```lua
debugtoolcommand "path"
```
### Parameters ###
`path` - needs documentation.
### Applies To ###
The `config` scope.
### Availability ###
Premake 5.0.0 alpha 12 or later.
### Examples ###
```lua
debugtoolcommand "path"
```

View File

@ -0,0 +1,24 @@
defaultplatform
```lua
defaultplatform "value"
```
### Parameters ###
`value` - needs documentation.
### Applies To ###
The `project` scope.
### Availability ###
Premake 5.0.0 alpha 12 or later.
### Examples ###
```lua
defaultplatform "value"
```

31
website/docs/defines.md Normal file
View File

@ -0,0 +1,31 @@
Adds preprocessor or compiler symbols to a project.
```lua
defines { "symbols" }
```
### Parameters ###
`symbols` specifies a list of symbols to be defined.
### Applies To ###
Project configurations.
### Availability ###
Premake 4.0 or later.
### Examples ###
Define two new symbols in the current project.
```lua
defines { "DEBUG", "TRACE" }
```
Symbols may also assign values.
```lua
defines { "CALLSPEC=__dllexport" }
```

18
website/docs/dependson.md Normal file
View File

@ -0,0 +1,18 @@
Specify one or more non-linking project build order dependencies.
```lua
dependson { "project1", "project2", ... }
```
### Parameters ###
One or more sibling project names.
### Applies To ###
Projects.
### Availability ###
5.0 or later.

View File

@ -0,0 +1,22 @@
Passes arguments directly to the deployment tool command line without translation.
```lua
deploymentoptions { "options" }
```
If a project includes multiple calls to `deploymentoptions` the lists are concatenated, in the order in which they appear in the script.
Deployment options are currently only supported for Xbox 360 targets.
### Parameters ###
`options` is a list of deployment tools flags and options.
### Applies To ###
Project configurations.
### Availability ###
Premake 4.4 or later.

View File

@ -0,0 +1,47 @@
Disables specific compiler warnings.
```lua
disablewarnings { "warnings" }
```
### Parameters ###
`warnings` is a list of warnings to disable.
For Visual Studio, the MSC warning number should be used to specify the warning. On other compilers, the warning should be identified by name.
### Applies To ###
Project configurations.
### Availability ###
Premake 5.0 or later.
Xcode project generation does not yet support `disablewarnings`. As a workaround, you can use [[xcodebuildsettings]] like this:
```lua
xcodebuildsettings {
WARNING_CFLAGS = "-Wall -Wextra " ..
"-Wno-missing-field-initializers " ..
"-Wno-unknown-pragmas " ..
"-Wno-unused-parameter " ..
"-Wno-unused-local-typedef " ..
"-Wno-missing-braces " ..
"-Wno-microsoft-anon-tag "
}
```
### Examples ###
Disable the GCC warning about using old-style C casts (`-Wno-old-style-cast` command line argument):
```lua
filter "options:cc=gcc"
disablewarnings "old-style-cast"
```
### See Also ###
* [enablewarnings](enablewarnings.md)
* [fatalwarnings](fatalwarnings.md)

24
website/docs/display.md Normal file
View File

@ -0,0 +1,24 @@
display
```lua
display "value"
```
### Parameters ###
`value` - needs documentation.
### Applies To ###
The `rule` scope.
### Availability ###
Premake 5.0.0 alpha 12 or later.
### Examples ###
```lua
display "value"
```

24
website/docs/docdir.md Normal file
View File

@ -0,0 +1,24 @@
docdir
```lua
docdir "path"
```
### Parameters ###
`path` - needs documentation.
### Applies To ###
The `config` scope.
### Availability ###
Premake 5.0.0 alpha 12 or later.
### Examples ###
```lua
docdir "path"
```

24
website/docs/docname.md Normal file
View File

@ -0,0 +1,24 @@
docname
```lua
docname "value"
```
### Parameters ###
`value` - needs documentation.
### Applies To ###
The `config` scope.
### Availability ###
Premake 5.0.0 alpha 12 or later.
### Examples ###
```lua
docname "value"
```

22
website/docs/dofileopt.md Normal file
View File

@ -0,0 +1,22 @@
Find and execute a Lua source file, but continue without error if the file is not present.
```lua
dofileopt("filename")
```
### Parameters ###
`fname` is the name of the file to load. This may be specified as a single file path or an array of file paths, in which case the first file found is run.
### Return Value ###
True if a file was found and executed, nil otherwise.
### Availability ###
Premake 5.0 or later.
### See Also ###
* [include](include.md)

View File

@ -0,0 +1,41 @@
Selects a .NET framework version.
```lua
dotnetframework ("version")
```
This value currently is only applied to Visual Studio 2005 or later, and GNU makefiles using Mono. If no .NET framework version is specified the toolset default is used.
### Parameters ###
`version` is one of:
* 1.0
* 1.1
* 2.0
* 3.0
* 3.5
* 4.0
* 4.5
* 4.6
### Applies To ###
Project configurations.
### Availability ###
Premake 5.0 or later.
### Examples ###
Use the .NET framework 3.0.
```lua
dotnetframework "3.0"
```
### See Also ###
* [clr](clr.md)
* [framework](framework.md)

View File

@ -0,0 +1,31 @@
Sets the DPI awareness settings.
```lua
dpiawareness "value"
```
### Parameters ###
`value` is one of:
| Value | Description |
|----------------|------------------------------------------------------|
| Default | Use the toolset's default setting for DPI awareness. |
| None | Turn off DPI awareness. |
| High | Turn on DPI awareness. |
| HighPerMonitor | Turn on DPI awareness per monitor. |
### Applies To ###
Project configurations.
### Availability ###
Premake 5.0 or later.
### Examples ###
```lua
-- Turn on DPI awareness
dpiawareness "High"
```

View File

@ -0,0 +1,30 @@
Turns the edit-and-continue features of a toolset or platform on and off.
```lua
editAndContinue "value"
```
If no value is set for a configuration, the toolset's default setting (usually "On") will be used.
### Parameters ###
`value` is a boolean value, i.e. "On" or "Off".
### Applies To ###
Project configurations.
### Availability ###
Premake 5.0 or later.
### Examples ###
```lua
-- Turn off edit and continue
editAndContinue "Off"
```
### See Also ###
- [debugformat](debugformat.md)

View File

@ -0,0 +1,29 @@
Turns the Editor Integration feature on. This is simply a hint to the action to add extra information into the generated workspace that allows an IDE to know which/where and how premake was executed. This is currently really only implemented for the Visual Studio action, but other actions may use this too in the future.
There is a plugin that allows re-execution of the premake step from within Visual Studio, which can be found here:
https://github.com/tvandijck/PremakeExtension
```lua
editorintegration "value"
```
If no value is set for a configuration, the toolset's default setting (usually "Off") will be used.
### Parameters ###
`value` is a boolean value, i.e. "On" or "Off".
### Applies To ###
Workspace configurations.
### Availability ###
Premake 5.0 or later.
### Examples ###
```lua
-- Turn on IDE integration
editorintegration "On"
```

View File

@ -0,0 +1,24 @@
Enables specific compiler warnings.
```lua
enablewarnings { "warnings" }
```
### Parameters ###
`warnings` is a list of warnings to enable.
For Visual Studio, the MSC warning number should be used to specify the warning. On other compilers, the warning should be identified by name.
### Applies To ###
Project configurations.
### Availability ###
Premake 5.0 or later.
### See Also ###
* [disablewarnings](disablewarnings.md)
* [fatalwarnings](fatalwarnings.md)

27
website/docs/endian.md Normal file
View File

@ -0,0 +1,27 @@
Specifies the target endian for endian-agnostic architectures.
```lua
endian "value"
```
### Parameters ###
`value` specifies the desired endian:
| Value | Description |
|-------------|-------------------------------------------------------------------|
| Default | Use the toolset's default endian. |
| Little | Specify little-endian. |
| Big | Specify big-endian. |
### Applies To ###
Project configurations.
### Availability ###
Premake 5.0 or later.
### See Also ###
* [architecture](architecture.md)

View File

@ -0,0 +1,31 @@
Specify the program entry point, e.g. `main()`.
```lua
entrypoint ("value")
```
### Parameters ###
`value` is the name of the program's entry point function.
### Applies To ###
Project configurations.
### Availability ###
Premake 5.0 or later.
### Examples ###
Use the Microsoft Windows console application entry point instead of the usual `WinMain()`.
```lua
entrypoint "mainCRTStartup"
```
### See Also ###
* [`WinMain` flag](flags.md)

View File

@ -0,0 +1,33 @@
Enable or disable exception handling.
```lua
exceptionhandling ("value")
```
### Parameters ###
`value` is one of:
| | |
|---------|---------------------------------------------------|
| Default | Use the toolset's default setting for exceptions. |
| On | Turn on exceptions. |
| Off | Turn off exceptions. |
| SEH | Turn on exceptions and use [structured exception handling](https://msdn.microsoft.com/en-us/library/windows/desktop/ms680657(v=vs.85).aspx) when available. |
More values may be added by [add-on modules](Modules.md).
### Applies To ###
Project configurations.
### Availability ###
Premake 5.0 or later.
### See Also ###
* [rtti](rtti.md)

1
website/docs/external.md Normal file
View File

@ -0,0 +1 @@
See [externalproject](externalproject.md).

View File

@ -0,0 +1,29 @@
Provides a way to reference projects that were created manually, or outside of Premake.
```lua
externalproject ("project")
```
The `externalproject()` function behaves the same as [project()](project.md), taking a name argument that is used as the project's file name.
### Parameters ###
`project` is name of the project. If no explicit filename is provided (using [filename](filename.md)) the appropriate file extension will be added for the current action: ".vcproj" for Visual Studio 2008, ".vcxproj" for Visual Studio 2010, etc.
### Availability ###
Premake 5.0 or later; currently Visual Studio only.
### Examples ###
```lua
externalproject "MyExternalProject"
location "build/MyExternalProject"
uuid "57940020-8E99-AEB6-271F-61E0F7F6B73B"
kind "StaticLib"
language "C++"
```
The calls to uuid(), kind(), and language() are mandatory; this information is needed to properly assemble the Premake-generated workspace. The call to location() is optional and used to locate the directory containing the external project file.
The external project file does not need to exist at the time the workspace is generated.

View File

@ -0,0 +1,38 @@
Provides a way to reference rules that were created manually, outside of Premake.
```lua
externalrule ("name")
```
The `externalrule()` function behaves just like [rule()](rule.md), except that it does not output any rule file(s) at project generation time. You may use it to reference a hand-written or pre-existing rule file.
### Parameters ###
`name` is name of the rule. As with [rule()](rule.md), it is used as the default file name, and may be overridden with [filename](filename.md) and [location](location.md).
### Availability ###
Premake 5.0 or later; currently Visual Studio only.
## Examples ##
```lua
externalrule "luac"
location "../rules" -- optional; if the file lives somewhere other than the script folder
filename "lua-to-c" -- optional; if the file has a name different than the rule
fileextension ".lua" -- required; which files should be associated with the rule?
propertydefinition {
name = "StripDebugInfo",
kind = "boolean",
}
```
`fileextension()` is required; this tells Premake which files in the project should be associated with the rule. `location()` is optional, and only needs to be specified if the rule files lives somewhere other than the folder containing the script. Likewise, `filename()` only needs to be specified if the rule file has a different name than the rule itself.
You do not need to specify all of the properties in the rule, only those you intend to set from your project scripts.
The external rule file does not need to exist at the time the workspace is generated.

View File

@ -0,0 +1,24 @@
Specifies specific warnings that should be interpreted as compile errors.
```lua
fatalwarnings { "warnings" }
```
### Parameters ###
`warnings` is a list of warnings to interpret as errors.
For Visual Studio, the MSC warning number should be used to specify the warning. On other compilers, the warning should be identified by name.
### Applies To ###
Project configurations.
### Availability ###
Premake 5.0 or later.
### See Also ###
* [enablewarnings](enablewarnings.md)
* [disablewarnings](disablewarnings.md)

View File

@ -0,0 +1,34 @@
Specifies the target file extensions for a [custom build rule](Custom-Rules.md).
```lua
fileextension "ext"
```
### Parameters ###
`ext` is the target file extension for the rule, including the leading dot.
### Applies To ###
Rules.
### Availability ###
Premake 5.0 or later.
### Examples ###
```lua
rule "Cg"
display "Cg Compiler"
fileextension ".cg"
```
### See Also ###
* [Custom Rules](Custom-Rules.md)
* [rule](rule.md)

38
website/docs/filename.md Normal file
View File

@ -0,0 +1,38 @@
Sets the name of a generated workspace, project, or rules file. Use it in conjunction with [location](location.md) to completely control the generated file destination.
```lua
filename ("name")
```
By default, generated workspace, project, and rule files use their name as the name of the generated file. The `filename` function allows you to change this.
### Parameters ###
`name` is the desired file name for the generated workspace or project file. Do not specify the file extension, Premake would automatically add the correct extension for the file onto the end.
### Applies To ###
Workspaces, projects, and rule files.
### Examples ###
Change the workspace name to "Master".
```lua
workspace "MyWorkspace"
filename "Master"
```
If you plan to build with multiple tools from the same source tree you might want to split up the project files by toolset. The _ACTION global variable contains the current toolset identifier, as specified on the command line.
```lua
workspace "MyWorkspace"
filename "MyWorkspace_%{_ACTION or ''}"
```
### See Also ###
* [location](location.md)

52
website/docs/files.md Normal file
View File

@ -0,0 +1,52 @@
Adds files to a project.
```lua
files { "file_list" }
```
### Parameters ###
`file_list` specifies one or more file patterns. File paths should be specified relative to the currently executing script file. File patterns may contain the `*` wildcard to match against files in the current directory, or the `**` wildcard to perform a recursive match.
If a wildcard matches more files than you would like, you may filter the results using the [removefiles()](Removing-Values.md) function.
### Applies To ###
Project configurations. [Not all exporters currently support](Feature-Matrix.md) per-configuration file lists however.
### Examples ###
Add two files from to the current project, from the same directory that contains the script.
```lua
files { "hello.cpp", "goodbye.cpp" }
```
Add all C++ files from the **src/** directory to the project.
```lua
files { "src/*.cpp" }
```
Add all C++ files from the **src/** directory and any subdirectories.
```lua
files { "src/**.cpp" }
```
Add files for specific systems; might not work with all exporters.
```lua
filter "system:Windows"
files { "src/windows/*.h", "src/windows/*.cpp" }
filter "system:MacOSX"
files { "src/mac/*.h", "src/mac/*.cpp" }
```
### See Also ###
* [Adding Source Files](Adding-Source-Files.md)
* [Removing Values](Removing-Values.md)
* [vpaths](vpaths.md)

148
website/docs/filter.md Normal file
View File

@ -0,0 +1,148 @@
Limits the subsequent build settings to a particular environment.
```lua
filter { "prefix:keywords" }
```
Any settings that appear after this function in the script will be applied only to those contexts that match all of the listed keywords. See below for some usage examples.
### Parameters ###
`keywords` is a list of identifiers, prefixed by the field against which they should be tested. When all of the keywords in this list match the current context, the settings that follow the `filter` statement will be applied. If any of the keywords fail this test, the settings are ignored. Keywords may contain wildcards, and are not case-sensitive. See below for examples.
Each keyword must include a prefix to specify which field should be tested. The following field prefixes are currently supported:
* [action](_ACTION.md)
* [architecture](architecture.md)
* [configurations](configurations.md)
* [files](files.md)
* [kind](kind.md)
* [language](language.md)
* [options](_OPTIONS.md)
* [platforms](platforms.md)
* [system](system.md)
* [toolset](toolset.md)
Keywords may use the `\*` and `\*\*` wildcards to match more than one term or file. You may also use the modifiers `not` and `or` to build more complex conditions. Again, see the examples below for more information.
### Availability ###
Premake 5.0 or later.
### Examples ###
Define a new symbol which applies only to debug builds.
```lua
workspace "MyWorkspace"
configurations { "Debug", "Release" }
filter "configurations:Debug"
defines { "_DEBUG" }
```
If no field prefix is specified in the keyword, "configurations" is used as a default.
```lua
filter "Debug"
defines { "_DEBUG" }
```
Define a symbol only when targeting Visual Studio 2010.
```lua
filter "action:vs2010"
defines { "VISUAL_STUDIO_2005" }
```
Wildcards can be used to match multiple terms. Define a symbol for all versions of Visual Studio.
```lua
filter "action:vs*"
defines { "VISUAL_STUDIO" }
```
The **or** modifier may be used when several values are possible. Define a value just for library targets.
```lua
filter "kind:SharedLib or StaticLib"
defines { "LIBRARY_TARGET" }
```
When multiple keywords are listed, an implicit **and** is assumed between them. Define compiler options only when using GNU Make and GCC.
```lua
filter { "action:gmake*", "toolset:gcc" }
buildoptions {
"-Wall", "-Wextra", "-Werror"
}
```
If any keyword pattern fails to match the current context, the entire filter is skipped over. Lua's curly bracket list syntax must be used when multiple keywords are present.
Add a suffix to the debug versions of libraries.
```lua
-- (configurations == "Debug") and (kind == SharedLib or kind == "StaticLib")
filter { "Debug", "kind:SharedLib or StaticLib" }
targetsuffix "_d"
-- Could also be written as
filter { "Debug", "kind:*Lib" }
targetsuffix "_d"
```
Apply settings based on the presence of a [custom command line option](Command-Line-Arguments.md).
```lua
-- Using an option like --localized
filter "options:localized"
files { "src/localizations/**" }
-- Using an option like --renderer=opengl
filter "options:renderer=opengl"
files { "src/opengl/**.cpp" }
```
Although support is currently limited, you may also apply settings to a particular file or set of files. This example sets the build action for all PNG image files.
```lua
filter "files:*.png"
buildaction "Embed"
```
In the case of files you may also use the **\*\*** wildcard, which will recurse into subdirectories.
```lua
filter "files:**.png"
buildaction "Embed"
```
You can also use **not** to apply the settings to all environments where the identifier is not set.
```lua
filter "system:not windows"
defines { "NOT_WINDOWS" }
```
You can combine different prefixes within a single keyword.
```lua
filter "system:windows or language:C#"
```
Finally, you can reset the filter and remove all active keywords by passing the function an empty table.
```lua
filter {}
```
### Clarifying Notes ###
* When a filter is set, any previous filter operations will become inactive. In other words, initiating a filter acts as though a reset occurred first, followed by setting a new filter condition.
* Filters can be viewed as a scoping concept. A currently set filter goes 'out of scope' when either a filter reset operation is invoked or a project definition is started.
### See Also ###
* [Filters](Filters.md)

64
website/docs/flags.md Normal file
View File

@ -0,0 +1,64 @@
Specifies build flags to modify the compiling or linking process.
```lua
flags { "flag_list" }
```
### Parameters ###
`flag_list` is a list of string flag names; see below for a list of valid flags. The flag values are not case-sensitive. Flags that are not supported by a particular platform or toolset are ignored.
| Flag | Description | Notes |
|-----------------------|---------------------------------------------------------------------|----------------|
| ExcludeFromBuild | Exclude a source code file from the build, for the current configuration. |
| FatalCompileWarnings | Treat compiler warnings as errors. |
| FatalLinkWarnings | Treat linker warnings as errors. |
| FatalWarnings | Treat all warnings as errors; equivalent to FatalCompileWarnings, FatalLinkWarnings |
| LinkTimeOptimization | Enable link-time (i.e. whole program) optimizations. |
| Maps | Enable Generate Map File for Visual Studio |
| MFC | Enable support for Microsoft Foundation Classes. |
| MultiProcessorCompile | Enable Visual Studio to use multiple compiler processes when building. |
| No64BitChecks | Disable 64-bit portability warnings. |
| NoBufferSecurityCheck | Turn off stack protection checks. |
| NoCopyLocal | Prevent referenced assemblies from being copied to the target directory (C#) |
| NoFramePointer | Disable the generation of stack frame pointers. |
| NoImplicitLink | Disable Visual Studio's default behavior of automatically linking dependent projects. |
| NoImportLib | Prevent the generation of an import library for a Windows DLL. |
| NoIncrementalLink | Disable support for Visual Studio's incremental linking feature. |
| NoManifest | Prevent the generation of a manifest for Windows executables and shared libraries. |
| NoMinimalRebuild | Disable Visual Studio's [minimal rebuild feature][1].| Visual Studio has deprecated this feature as of vs2015.|
| NoPCH | Disable precompiled header support. If not specified, the toolset default behavior will be used. |
| NoRuntimeChecks | Disable Visual Studio's [default stack frame and uninitialized variable checks][2] on debug builds. |
| OmitDefaultLibrary | Omit the specification of a runtime library in object files. |
| RelativeLinks | Forces the linker to use relative paths to libraries instead of absolute paths. |
| ShadowedVariables | Warn when a variable, type declaration, or function is shadowed. |
| StaticRuntime | Perform a static link against the standard runtime libraries. | Deprecated - use staticruntime "On" instead. |
| UndefinedIdentifiers | Warn if an undefined identifier is evaluated in an #if directive. |
| WinMain | Use `WinMain()` as entry point for Windows applications, rather than the default `main()`. |
| WPF | Mark the project as using Windows Presentation Framework, rather than WinForms. |
| C++11 | Pass the c++11 flag to the gcc/clang compilers (msvc ignores this currently) |
| C++14 | Pass the c++14 flag to the gcc/clang compilers (msvc ignores this currently) |
| C90 | Pass the c90 flag to the gcc/clang compilers (msvc ignores this currently) |
| C99 | Pass the c99 flag to the gcc/clang compilers (msvc ignores this currently) |
Flags are often extended by external modules:
* [D language flags](flags.md)
### Applies To ###
Project and file configurations, though not all flags are yet supported for files across all exporters.
### Availability ###
Unless otherwise noted, Premake 5.0 or later.
### Examples ###
```lua
-- Enable link-time (i.e. whole program) optimizations.
flags { "LinkTimeOptimization" }
```
[1]: https://docs.microsoft.com/en-us/cpp/build/reference/gm-enable-minimal-rebuild?view=vs-2017
[2]: http://msdn.microsoft.com/en-us/library/8wtf2dfz.aspx

View File

@ -0,0 +1,35 @@
Specifies the style of floating point math which should be used.
```lua
floatingpoint "value"
```
If no value is set for a configuration, the toolset's default floating point settings will be used.
### Parameters ###
`value` specifies the desired style of floating point math:
| Value | Description |
|-------------|-------------------------------------------------------------------|
| Default | Use the toolset's floating point settings. |
| Fast | Enable floating point optimizations at the expense of accuracy. |
| Strict | Improve floating point consistency at the expense of performance. |
### Applies To ###
Project configurations.
### Availability ###
Premake 5.0 or later.
### Examples ###
```lua
floatingpoint "Fast"
```
### See Also ###
* [vectorextensions](vectorextensions.md)

View File

@ -0,0 +1,26 @@
floatingpointexceptions
```lua
floatingpointexceptions "value"
```
### Parameters ###
`value` one of:
* `on` - needs documentation.
* `off` - needs documentation.
### Applies To ###
The `config` scope.
### Availability ###
Premake 5.0.0 alpha 12 or later.
### Examples ###
```lua
floatingpointexceptions "value"
```

View File

@ -0,0 +1,23 @@
Applies one or more "forced include" files to the project; these includes behave as it they had been injected into the first line of each source file in the project.
```lua
forceincludes { "files" }
```
### Parameters ###
`files` specifies a list of files to be force included. Paths should be specified relative to the currently running script file.
### Applies To ###
Project configurations.
### Availability ###
Premake 5.0 or later.
### Examples ###
```lua
forceincludes { "stdafx.h" }
```

View File

@ -0,0 +1,23 @@
Applies one or more "forced using" files to the project; these includes behave as it they had been injected into the first line of each source file in the project.
```lua
forceusings { "files" }
```
### Parameters ###
`files` specifies a list of files to be force included. Paths should be specified relative to the currently running script file.
### Applies To ###
Project configurations.
### Availability ###
Premake 5.0 or later.
### Examples ###
```lua
forceusings { "stdafx.h" }
```

26
website/docs/fpu.md Normal file
View File

@ -0,0 +1,26 @@
Specifies whether to generate code for a hardware FPU.
```lua
fpu "value"
```
### Parameters ###
`value` specifies the desired FPU mode:
| Value | Description |
|-------------|-------------------------------------------------------------------|
| Software | Generate software floating-point emulation code. |
| Hardware | Generate code for a hardware FPU. |
### Applies To ###
Project configurations.
### Availability ###
Premake 5.0 or later.
### See Also ###
* [floatingpoint](floatingpoint.md)

43
website/docs/framework.md Normal file
View File

@ -0,0 +1,43 @@
Selects a .NET framework version.
```lua
framework ("version")
```
This value currently is only applied to Visual Studio 2005 or later, and GNU makefiles using Mono. If no framework is specified the toolset default is used.
### Parameters ###
`version` is one of:
* 1.0
* 1.1
* 2.0
* 3.0
* 3.5
* 4.0
### Applies To ###
Project configurations.
### Availability ###
Premake 4.4 or later.
### Examples ###
Use the .NET 3.0 Framework.
```lua
framework "3.0"
```
### Remarks ###
This API is deprecated since 5.0, please use [dotnetframework](dotnetframework.md) instead.
### See Also ###
* [clr](clr.md)
* [dotnetframework](dotnetframework.md)

View File

@ -0,0 +1,26 @@
functionlevellinking
```lua
functionlevellinking "value"
```
### Parameters ###
`value` one of:
* `on` - needs documentation.
* `off` - needs documentation.
### Applies To ###
The `config` scope.
### Availability ###
Premake 5.0.0 alpha 12 or later.
### Examples ###
```lua
functionlevellinking "value"
```

30
website/docs/gccprefix.md Normal file
View File

@ -0,0 +1,30 @@
Sets a prefix to be prepended to commands used by the GCC toolchain.
```lua
gccprefix ("prefix")
```
GCC toolsets, and cross-compilers in particular, typically have some common prefix prepended to all tools in the GCC suite. This prefix will be prepended to all such tools.
Prefixes are usually composed of multiple segments separated by '-', and the prefix should contain the final dash.
For instance, a toolchain of the style `powerpc-eabi-gcc` should have gccprefix `powerpc-eabi-`.
### Parameters ###
A *gccprefix* string which is to be prepended to the GCC tools.
### Applies To ###
Project configurations.
### Availability ###
Premake 5.0 or later.
### Examples ###
Set a GCC prefix to be prepended to the compiler tools.
```lua
gccprefix "powerpc-eabi-"
```

65
website/docs/group.md Normal file
View File

@ -0,0 +1,65 @@
Starts a "workspace group", a virtual folder to contain one or more projects.
```lua
group("name")
```
### Parameters ###
`name` is the name of the virtual folder, as it should appear in the IDE. Nested groups may be created by separating the names with forward slashes.
### Applies To ###
Workspaces.
### Availability ###
5.0 or later.
### Examples ###
```lua
workspace "MyWorkspace"
-- put the projects "Tests1" and "Tests2" in a virtual folder named "Tests"
group "Tests"
project "Tests1"
-- Tests1 stuff goes here
project "Tests2"
-- Tests2 stuff goes here
-- Any project defined after the call to group() will go into that group. The
-- project can be defined in a different script though.
group "Tests"
include "tests/tests1"
include "tests/tests2"
-- Groups can be nested with forward slashes, like a file path.
group "Tests/Unit"
-- To "close" a group and put projects back at the root level use
-- an empty string for the name.
group ""
project "TestHarness"
```
The group value is latched the first time a project is declared but it can be overriden later:
```lua
local prj = project "Tests1"
prj.group = "NotActuallyATest"
```
or
```lua
project("Tests1").group = "NotActuallyATest"
```

24
website/docs/headerdir.md Normal file
View File

@ -0,0 +1,24 @@
headerdir
```lua
headerdir "path"
```
### Parameters ###
`path` - needs documentation.
### Applies To ###
The `config` scope.
### Availability ###
Premake 5.0.0 alpha 12 or later.
### Examples ###
```lua
headerdir "path"
```

View File

@ -0,0 +1,24 @@
headername
```lua
headername "value"
```
### Parameters ###
`value` - needs documentation.
### Applies To ###
The `config` scope.
### Availability ###
Premake 5.0.0 alpha 12 or later.
### Examples ###
```lua
headername "value"
```

View File

@ -0,0 +1,33 @@
* `progress` is a Lua callback function that receives two numeric arguments representing total and current download progress in bytes.
* `headers` is a Lua table with HTTP headers to be used on the request.
* `userpwd` is a username and optional password in the format of username:password which will be used to authenticate the request
* `username` is the username which will be used to authenticate the request
* `password` is the password which will be used to authenticate the request
* `timeout` is the timeout in seconds.
* `timeoutms` is the timeout in milliseconds.
* `sslverifyhost` Verify the host name in the SSL certificate. See [CURLOPT_SSL_VERIFYHOST](https://curl.haxx.se/libcurl/c/CURLOPT_SSL_VERIFYHOST.html)
* `sslverifypeer` Verify the SSL certificate. See [CURLOPT_SSL_VERIFYPEER](https://curl.haxx.se/libcurl/c/CURLOPT_SSL_VERIFYPEER.html)
* `proxyurl` is the URL which will be used as the proxy for the request. See [CURLOPT_PROXY](https://curl.haxx.se/libcurl/c/CURLOPT_PROXY.html)
### Examples ###
```lua
local options = {
timeoutms = 2500,
sslverifypeer = 0,
username = "premake",
password = "hunter2",
}
http.post("http://null.com", "data", options)
```
### Availability ###
Premake 5.0 or later.
### See Also ###
* [http.get](http.get.md)
* [http.post](http.post.md)
* [http.download](http.download.md)

View File

@ -0,0 +1,68 @@
Downloads an HTTP resource from the specified URL to a file.
```lua
http.download(url, file, { options })
```
### Parameters ###
`url` is the URL to be downloaded.
`file` is the destination file that will be written to.
`options` is a [table of options](http-options-table.md) used for this HTTP request.
### Return Values ###
There are two return values.
```lua
result_str, response_code = http.download(url, file, { options })
```
* `result_str` is set to "OK" if successful or contains a description of the failure.
* `result_code` is the HTTP [result code](http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html) of the download.
### Examples ###
```lua
local result_str, response_code = http.download("http://example.com/file.zip", "file.zip")
```
```lua
function progress(total, current)
local ratio = current / total;
ratio = math.min(math.max(ratio, 0), 1);
local percent = math.floor(ratio * 100);
print("Download progress (" .. percent .. "%/100%)")
end
local result_str, response_code = http.download("http://example.com/file.zip", "file.zip", {
progress = progress,
headers = { "From: Premake", "Referer: Premake" },
userpwd = "username:password"
})
```
### Backward compatible function signature ###
The previous signature of this function was
```lua
http.download(url, file, progress, headers)
```
and continues to be supported. This is equivalent to
```lua
http.download(url, file, { progress = progress, headers = headers })
```
### Availability ###
Premake 5.0 or later.
### See Also ###
* [http.get](http.get.md)

67
website/docs/http.get.md Normal file
View File

@ -0,0 +1,67 @@
Perform a HTTP GET request using the specified URL.
```lua
http.get(url, { options })
```
### Parameters ###
`url` is the URL to be downloaded.
`options` is a [table of options](http-options-table.md) used for this HTTP request.
### Return Values ###
There are three return values.
```lua
resource, result_str, response_code = http.get(url, { options })
```
* `resource` is the content that was retrieved or nil if it could not be retrieved.
* `result_str` is set to "OK" if successful or contains a description of the failure.
* `result_code` is the HTTP [result code](http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html) of the get.
### Examples ###
```lua
local resource, result_str, response_code = http.get("http://example.com/api.json")
```
```lua
function progress(total, current)
local ratio = current / total;
ratio = math.min(math.max(ratio, 0), 1);
local percent = math.floor(ratio * 100);
print("Download progress (" .. percent .. "%/100%)")
end
local resource, result_str, response_code = http.get("http://example.com/api.json", {
progress = progress,
headers = { "From: Premake", "Referer: Premake" },
userpwd = "username:password"
})
```
### Backward compatible function signature ###
The previous signature of this function was
```lua
http.get(url, progress, headers)
```
and continues to be supported. This is equivalent to
```lua
http.get(url, { progress = progress, headers = headers })
```
### Availability ###
Premake 5.0 or later.
### See Also ###
* [http.download](http.download.md)
* [http.post](http.post.md)

41
website/docs/http.post.md Normal file
View File

@ -0,0 +1,41 @@
Perform a HTTP POST request to the specified URL.
```lua
http.post(url, data, { options })
```
### Parameters ###
`url` is the URL to POST to.
`data` is a string containing the data to post.
`options` is a [table of options](http-options-table.md) used for this HTTP request.
### Return Values ###
There are three return values.
```lua
resource, result_str, response_code = http.post(url, data, { options })
```
* `resource` is the content that was retrieved or nil if it could not be retrieved.
* `result_str` is set to "OK" if successful or contains a description of the failure.
* `result_code` is the HTTP [result code](http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html) of the get.
### Examples ###
```lua
local resource, result_str, response_code = http.post("http://example.com/api.json", "somedata")
```
### Availability ###
Premake 5.0 or later.
### See Also ###
* [http.download](http.download.md)
* [http.get](http.get.md)

Some files were not shown because too many files have changed in this diff Show More