Skip to content

Commit

Permalink
Merge pull request #1718 from starkos/deprecate-configuration'
Browse files Browse the repository at this point in the history
  • Loading branch information
starkos committed Sep 17, 2021
2 parents f815c01 + e9525ee commit 1c13046
Show file tree
Hide file tree
Showing 15 changed files with 29 additions and 40 deletions.
2 changes: 2 additions & 0 deletions src/base/api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1149,6 +1149,8 @@
---

function configuration(terms)
-- Sep 16 2021
premake.warnOnce("configuration", "`configuration` has been deprecated; use `filter` instead (https://premake.github.io/docs/Filters/)")
if terms then
if (type(terms) == "table" and #terms == 1 and terms[1] == "*") or (terms == "*") then
terms = nil
Expand Down
27 changes: 7 additions & 20 deletions website/docs/Command-Line-Arguments.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ newoption {
Note the commas after each key-value pair; this is required Lua syntax for a table. Once added to your script, the option will appear in the help text, and you may use the trigger as a keyword in your configuration blocks.

```lua
configuration "with-opengl"
filter { "options:with-opengl" }
links { "opengldrv" }

configuration "not with-opengl"
filter { "not options:with-opengl" }
links { "direct3ddrv" }
```

Expand All @@ -58,7 +58,8 @@ newoption {
{ "opengl", "OpenGL" },
{ "direct3d", "Direct3D (Windows only)" },
{ "software", "Software Renderer" }
}
},
default = "opengl"
}
```

Expand All @@ -74,30 +75,16 @@ As before, this new option will be integrated into the help text, along with a d
Unlike the example above, you now use the _value_ as a keyword in your configuration blocks.

```lua
configuration "opengl"
filter { "options:gfxapi=opengl" }
links { "opengldrv" }

configuration "direct3d"
filter { "options:gfxapi=direct3d" }
links { "direct3ddrv" }

configuration "software"
filter { "options:gfxapi=software" }
links { "softwaredrv" }
```

Or you could be more clever.

```lua
links { _OPTIONS["gfxapi"] .. "drv" }
```

In this example, you would also want to provide a default behavior for the case where no option is specified. You could place a bit of code like this anywhere in your script.

```lua
if not _OPTIONS["gfxapi"] then
_OPTIONS["gfxapi"] = "opengl"
end
```

As a last example of options, you may want to specify an option that accepts an unconstrained value, such as an output path. Just leave off the list of allowed values.

```lua
Expand Down
2 changes: 1 addition & 1 deletion website/docs/buildoptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ Premake 4.0 or later.
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" }
filter { "system:linux", "action:gmake" }
buildoptions { "`wx-config --cxxflags`", "-ansi", "-pedantic" }
```
2 changes: 1 addition & 1 deletion website/docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Limits the subsequent build settings to a particular environment.
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.
**This function has been deprecated in Premake 5.0 beta1.** Use the new [filter()](filter.md) function instead; you will get more granular matching and much better performance. `configuration()` will be not supported in Premake 6.

### Parameters ###

Expand Down
2 changes: 1 addition & 1 deletion website/docs/debugargs.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ Premake 4.4 or later.
### Examples ###

```lua
configuration "Debug"
filter { "configurations:Debug" }
debugargs { "--append", "somefile.txt" }
```
4 changes: 2 additions & 2 deletions website/docs/debugdir.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ Premake 4.4 or later.
### Examples ###

```lua
configuration "Debug"
filter { "configurations:Debug" }
debugdir "bin/debug"
```
```
2 changes: 1 addition & 1 deletion website/docs/implibsuffix.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Premake 4.0 or later.

```lua
-- Add "-d" to debug versions of files
configuration "Debug"
filter { "configurations:Debug" }
implibsuffix "-d"
```

Expand Down
2 changes: 1 addition & 1 deletion website/docs/linkoptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ Premake 4.0 or later.
Use `pkg-config` style configuration when building on Linux with GCC. Build options are always linker specific and should be targeted to a particular toolset.

```lua
configuration { "linux", "gmake" }
filter { "system:linux", "action:gmake" }
linkoptions { "`wx-config --libs`" }
```
6 changes: 3 additions & 3 deletions website/docs/links.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ Premake 4.0 or later.
Link against some system libraries.

```lua
configuration "windows"
filter { "system:windows" }
links { "user32", "gdi32" }

configuration "linux"
filter { "system:linux" }
links { "m", "png" }

configuration "macosx"
filter { "system:macosx" }
-- OS X frameworks need the extension to be handled properly
links { "Cocoa.framework", "png" }
```
Expand Down
4 changes: 2 additions & 2 deletions website/docs/postbuildcommands.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ Premake 4.4 or later.
### Examples ###

```lua
configuration "windows"
filter { "system:windows" }
postbuildcommands { "copy default.config bin\\project.config" }

configuration "not windows"
filter { "not system:windows" }
postbuildcommands { "cp default.config bin/project.config" }
```

Expand Down
4 changes: 2 additions & 2 deletions website/docs/prebuildcommands.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ Premake 4.4 or later.
### Examples ###

```lua
configuration "windows"
filter { "system:windows" }
prebuildcommands { "copy default.config bin\\project.config" }

configuration "not windows"
filter { "not system:windows" }
prebuildcommands { "cp default.config bin/project.config" }
```

Expand Down
4 changes: 2 additions & 2 deletions website/docs/prelinkcommands.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ Premake 4.4 or later.
### Examples ###

```lua
configuration "windows"
filter { "system:windows" }
prelinkcommands { "copy default.config bin\\project.config" }

configuration "not windows"
filter { "not system:windows" }
prelinkcommands { "cp default.config bin/project.config" }
```

Expand Down
2 changes: 1 addition & 1 deletion website/docs/resoptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ Premake 4.0 or later.
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" }
filter { "system:linux", "action:gmake" }
resoptions { "`wx-config --cxxflags`", "-ansi", "-pedantic" }
```
4 changes: 2 additions & 2 deletions website/docs/targetdir.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ This project separates its compiled output by configuration type.
```lua
project "MyProject"

configuration "Debug"
filter { "configurations:Debug" }
targetdir "bin/debug"

configuration "Release"
filter { "configurations:Release" }
targetdir "bin/release"
```

Expand Down
2 changes: 1 addition & 1 deletion website/docs/targetsuffix.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Premake 4.0 or later.

```lua
-- Add "-d" to debug versions of files
configuration "Debug"
filter { "configurations:Debug" }
targetsuffix "-d"
```

Expand Down

0 comments on commit 1c13046

Please sign in to comment.