Skip to content

Commit da6ba18

Browse files
Merge pull request #2586 from nickclark2016/deprecate-flags
Remove remaining usages of flags in Premake
2 parents f653153 + ed9d46e commit da6ba18

File tree

13 files changed

+68
-27
lines changed

13 files changed

+68
-27
lines changed

modules/gmake/gmake_cpp.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@
563563
local fcfg = fileconfig.getconfig(file, cfg)
564564
local flags = {}
565565

566-
if cfg.pchheader and not cfg.flags.NoPCH and (not fcfg or not fcfg.flags.NoPCH) then
566+
if cfg.pchheader and cfg.enablepch ~= p.OFF and (not fcfg or fcfg.enablepch ~= p.OFF) then
567567
table.insert(flags, "-include $(PCH_PLACEHOLDER)")
568568
end
569569

modules/gmakelegacy/gmakelegacy_cpp.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ end
513513

514514
function make.forceInclude(cfg, toolset)
515515
local includes = toolset.getforceincludes(cfg)
516-
if not cfg.flags.NoPCH and cfg.pchheader then
516+
if cfg.enablepch ~= p.OFF and cfg.pchheader then
517517
table.insert(includes, 1, "-include $(OBJDIR)/$(notdir $(PCH))")
518518
end
519519
_x(' FORCE_INCLUDE +=%s', make.list(includes))

modules/ninja/ninja_cpp.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ function m.getLdFlags(cfg, toolset)
532532
end
533533

534534
function m.getPchPath(cfg)
535-
if not cfg.pchheader or cfg.flags.NoPCH then
535+
if not cfg.pchheader or cfg.enablepch == p.OFF then
536536
return nil
537537
end
538538

@@ -552,7 +552,7 @@ function m.getPchPath(cfg)
552552
end
553553

554554
function m.buildPch(cfg)
555-
if not cfg.pchheader or cfg.flags.NoPCH then
555+
if not cfg.pchheader or cfg.enablepch == p.OFF then
556556
return nil
557557
end
558558

@@ -806,7 +806,7 @@ function m.buildFile(cfg, node, filecfg, objFile, pchFile, prebuildTarget)
806806
local relPath = path.getrelative(cfg.workspace.location, node.abspath)
807807
local implicitDeps = ""
808808

809-
local usePch = cfg.pchheader and not cfg.flags.NoPCH and (not filecfg or not filecfg.flags.NoPCH)
809+
local usePch = cfg.pchheader and cfg.enablepch ~= p.OFF and (not filecfg or filecfg.enablepch ~= p.OFF)
810810
if pchFile and usePch then
811811
implicitDeps = implicitDeps .. " | " .. pchFile
812812
end

modules/vstudio/vs2010_vcxproj.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4416,8 +4416,8 @@
44164416
end
44174417

44184418
function m.androidShortEnums(cfg)
4419-
if cfg.flags.UseShortEnums ~= nil then
4420-
m.element(UseShortEnums, nil, "true")
4419+
if cfg.useshortenums then
4420+
m.element("UseShortEnums", nil, iif(cfg.useshortenums == "On", "true", "false"))
44214421
end
44224422
end
44234423

@@ -4450,7 +4450,7 @@
44504450
end
44514451

44524452
function m.androidGenerateMapFile(cfg)
4453-
if cfg.flags.Maps then
4453+
if cfg.mapfile == p.ON then
44544454
-- Android specifies a name. Other platforms use the project name
44554455
-- so we do the same thing here
44564456
m.element("GenerateMapFile", nil, cfg.project.name..".map")

modules/xcode/xcode_common.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1502,7 +1502,7 @@
15021502
local optimizeMap = { On = 3, Size = 's', Speed = 3, Full = 'fast', Debug = 'g' }
15031503
settings['GCC_OPTIMIZATION_LEVEL'] = optimizeMap[cfg.optimize] or 0
15041504

1505-
if cfg.pchheader and not cfg.flags.NoPCH then
1505+
if cfg.pchheader and cfg.enablepch ~= p.OFF then
15061506
settings['GCC_PRECOMPILE_PREFIX_HEADER'] = 'YES'
15071507
settings['GCC_PREFIX_HEADER'] = cfg.pchheader
15081508
end

premake5.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -275,16 +275,16 @@
275275
symbols "On"
276276

277277
filter "configurations:Release"
278-
defines "NDEBUG"
279-
optimize "Full"
280-
flags { "NoRuntimeChecks" }
278+
defines "NDEBUG"
279+
optimize "Full"
280+
runtimechecks "Off"
281281
buffersecuritycheck "Off"
282282

283283
filter "action:vs*"
284284
defines { "_CRT_SECURE_NO_DEPRECATE", "_CRT_SECURE_NO_WARNINGS", "_CRT_NONSTDC_NO_WARNINGS" }
285285

286286
filter { "system:windows", "configurations:Release" }
287-
flags { "NoIncrementalLink" }
287+
incrementallink "Off"
288288

289289
-- MinGW AR does not handle LTO out of the box and need a plugin to be setup
290290
filter { "system:windows", "configurations:Release", "toolset:not gcc" }

src/_premake_init.lua

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1465,6 +1465,21 @@
14651465
excludefrombuild("Off")
14661466
end)
14671467

1468+
api.register {
1469+
name = "useshortenums",
1470+
scope = "config",
1471+
kind = "string",
1472+
allowed = {
1473+
"Default",
1474+
"On",
1475+
"Off"
1476+
}
1477+
}
1478+
1479+
api.deprecateField("flags", "Use dedicated APIs instead.",
1480+
function(value)
1481+
end)
1482+
14681483
-----------------------------------------------------------------------------
14691484
--
14701485
-- Field name aliases for backward compatibility

src/base/api.lua

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -445,8 +445,8 @@
445445
end
446446
else
447447
local field = p.fields[name]
448-
field.deprecated = field.deprecated or {}
449-
field.deprecated[value] = {
448+
field.deprecatedvalues = field.deprecatedvalues or {}
449+
field.deprecatedvalues[value] = {
450450
add = addHandler,
451451
remove = removeHandler,
452452
message = message
@@ -548,7 +548,7 @@
548548
error(err, 3)
549549
end
550550

551-
local hasDeprecatedValues = (type(field.deprecated) == "table")
551+
local hasDeprecatedValues = (type(field.deprecatedvalues) == "table")
552552

553553
-- Build a list of values to be removed. If this field has deprecated
554554
-- values, check to see if any of those are going to be removed by this
@@ -558,8 +558,8 @@
558558
local removes = {}
559559

560560
local function check(value)
561-
if field.deprecated[value] then
562-
local handler = field.deprecated[value]
561+
if field.deprecatedvalues[value] then
562+
local handler = field.deprecatedvalues[value]
563563
if handler.remove then handler.remove(value) end
564564
if handler.message and api._deprecations ~= "off" then
565565
local caller = filelineinfo(8)
@@ -597,7 +597,7 @@
597597
error { msg=err }
598598
end
599599

600-
if field.deprecated then
600+
if field.deprecatedvalues then
601601
check(value)
602602
end
603603

@@ -681,8 +681,8 @@
681681
return nil, "invalid value '" .. value .. "' for " .. field.name
682682
end
683683

684-
if field.deprecated and field.deprecated[canonical] then
685-
local handler = field.deprecated[canonical]
684+
if field.deprecatedvalues and field.deprecatedvalues[canonical] then
685+
local handler = field.deprecatedvalues[canonical]
686686
handler.add(canonical)
687687
if handler.message and api._deprecations ~= "off" then
688688
local caller = filelineinfo(9)

src/tools/clang.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
Fast = "-flto=thin",
7474
},
7575
profile = gcc.shared.profile,
76+
useshortenums = gcc.shared.useshortenums,
7677
}
7778

7879
clang.cflags = table.merge(gcc.cflags, {

src/tools/dotnet.lua

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,11 +149,6 @@
149149
info.SubType = fcfg.buildaction
150150
end
151151

152-
-- This flag is deprecated, will remove eventually
153-
if fcfg.flags and fcfg.flags.Component then
154-
info.SubType = "Component"
155-
end
156-
157152
end
158153

159154
if info.action == "Content" then

0 commit comments

Comments
 (0)