From e9525eec34418af4227fc9c78c37fc1a85c291fc Mon Sep 17 00:00:00 2001 From: starkos Date: Thu, 16 Sep 2021 10:20:58 -0400 Subject: [PATCH] Deprecate configuration() `configuration()` will not be supported in Premake6. Marking it deprecated now so everyone has a chance to phase it out. Closes #1708. --- src/base/api.lua | 2 ++ website/docs/Command-Line-Arguments.md | 27 +++++++------------------- website/docs/buildoptions.md | 2 +- website/docs/configuration.md | 2 +- website/docs/debugargs.md | 2 +- website/docs/debugdir.md | 4 ++-- website/docs/implibsuffix.md | 2 +- website/docs/linkoptions.md | 2 +- website/docs/links.md | 6 +++--- website/docs/postbuildcommands.md | 4 ++-- website/docs/prebuildcommands.md | 4 ++-- website/docs/prelinkcommands.md | 4 ++-- website/docs/resoptions.md | 2 +- website/docs/targetdir.md | 4 ++-- website/docs/targetsuffix.md | 2 +- 15 files changed, 29 insertions(+), 40 deletions(-) diff --git a/src/base/api.lua b/src/base/api.lua index 1623ff056a..4d7c42e504 100755 --- a/src/base/api.lua +++ b/src/base/api.lua @@ -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 diff --git a/website/docs/Command-Line-Arguments.md b/website/docs/Command-Line-Arguments.md index 1897ce6bf3..7a8a047d07 100644 --- a/website/docs/Command-Line-Arguments.md +++ b/website/docs/Command-Line-Arguments.md @@ -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" } ``` @@ -58,7 +58,8 @@ newoption { { "opengl", "OpenGL" }, { "direct3d", "Direct3D (Windows only)" }, { "software", "Software Renderer" } - } + }, + default = "opengl" } ``` @@ -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 diff --git a/website/docs/buildoptions.md b/website/docs/buildoptions.md index 8a60423c39..d35de0ac9d 100644 --- a/website/docs/buildoptions.md +++ b/website/docs/buildoptions.md @@ -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" } ``` diff --git a/website/docs/configuration.md b/website/docs/configuration.md index 22ee771222..001438db24 100644 --- a/website/docs/configuration.md +++ b/website/docs/configuration.md @@ -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 ### diff --git a/website/docs/debugargs.md b/website/docs/debugargs.md index 65bb6d2793..74306bc977 100644 --- a/website/docs/debugargs.md +++ b/website/docs/debugargs.md @@ -23,6 +23,6 @@ Premake 4.4 or later. ### Examples ### ```lua -configuration "Debug" +filter { "configurations:Debug" } debugargs { "--append", "somefile.txt" } ``` diff --git a/website/docs/debugdir.md b/website/docs/debugdir.md index aafbcddc07..2f1de3ada7 100644 --- a/website/docs/debugdir.md +++ b/website/docs/debugdir.md @@ -24,6 +24,6 @@ Premake 4.4 or later. ### Examples ### ```lua -configuration "Debug" +filter { "configurations:Debug" } debugdir "bin/debug" -``` \ No newline at end of file +``` diff --git a/website/docs/implibsuffix.md b/website/docs/implibsuffix.md index c986fd6b57..d3c70d4ad3 100644 --- a/website/docs/implibsuffix.md +++ b/website/docs/implibsuffix.md @@ -20,7 +20,7 @@ Premake 4.0 or later. ```lua -- Add "-d" to debug versions of files -configuration "Debug" +filter { "configurations:Debug" } implibsuffix "-d" ``` diff --git a/website/docs/linkoptions.md b/website/docs/linkoptions.md index 8d5b993b1b..b55293d7fa 100644 --- a/website/docs/linkoptions.md +++ b/website/docs/linkoptions.md @@ -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`" } ``` diff --git a/website/docs/links.md b/website/docs/links.md index 46317ea11a..04497b21e4 100644 --- a/website/docs/links.md +++ b/website/docs/links.md @@ -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" } ``` diff --git a/website/docs/postbuildcommands.md b/website/docs/postbuildcommands.md index 9a062a33b3..c7f756842d 100644 --- a/website/docs/postbuildcommands.md +++ b/website/docs/postbuildcommands.md @@ -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" } ``` diff --git a/website/docs/prebuildcommands.md b/website/docs/prebuildcommands.md index 62a04678f2..8b2fa80d2f 100644 --- a/website/docs/prebuildcommands.md +++ b/website/docs/prebuildcommands.md @@ -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" } ``` diff --git a/website/docs/prelinkcommands.md b/website/docs/prelinkcommands.md index ae544fb14a..c3d70db922 100644 --- a/website/docs/prelinkcommands.md +++ b/website/docs/prelinkcommands.md @@ -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" } ``` diff --git a/website/docs/resoptions.md b/website/docs/resoptions.md index a2bb34b85f..03b3c04812 100644 --- a/website/docs/resoptions.md +++ b/website/docs/resoptions.md @@ -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" } ``` diff --git a/website/docs/targetdir.md b/website/docs/targetdir.md index 764455ff05..7a33fa718d 100644 --- a/website/docs/targetdir.md +++ b/website/docs/targetdir.md @@ -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" ``` diff --git a/website/docs/targetsuffix.md b/website/docs/targetsuffix.md index d2e9e0301e..b0736089db 100644 --- a/website/docs/targetsuffix.md +++ b/website/docs/targetsuffix.md @@ -20,7 +20,7 @@ Premake 4.0 or later. ```lua -- Add "-d" to debug versions of files -configuration "Debug" +filter { "configurations:Debug" } targetsuffix "-d" ```