Skip to content

Commit 83e57cf

Browse files
committed
Deprecate the rest of the flags
1 parent 92c984e commit 83e57cf

39 files changed

+1537
-57
lines changed

modules/ninja/ninja_cpp.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1177,7 +1177,7 @@ function m.linkTarget(cfg)
11771177

11781178
local implicitoutputs = {}
11791179

1180-
-- If this target is a shared library on Windows with NoImportLib not set, add an implicit output
1180+
-- If this target is a shared library on Windows with useimportlib not set to Off, add an implicit output
11811181
-- for the .lib file
11821182
-- If this is on windows and building a shared library, emit a exp file as an implicit output
11831183
if cfg.system == p.WINDOWS and cfg.kind == p.SHAREDLIB then
@@ -1187,7 +1187,7 @@ function m.linkTarget(cfg)
11871187
table.insert(implicitoutputs, expFilePath)
11881188
end
11891189

1190-
if not cfg.flags.NoImportLib then
1190+
if cfg.useimportlib ~= p.OFF then
11911191
local importLibName = cfg.buildtarget.name:gsub("%..-$", "") .. ".lib"
11921192
if importLibName then
11931193
local importLibPath = path.getrelative(cfg.workspace.location, cfg.buildtarget.directory) .. "/" .. importLibName

modules/ninja/tests/test_ninja_project.lua

Lines changed: 58 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ build bin/Debug/MyProject2.dll | bin/Debug/MyProject2.exp bin/Debug/MyProject2.l
250250
-- Test that shared library on Windows with NoImportLib flag works correctly with GCC
251251
--
252252

253-
function suite.sharedLibWindowsGCCNoImportLib()
253+
function suite.sharedLibWindowsGCCNoImportLib_ViaFlag()
254254
local wks = test.createWorkspace()
255255
configurations { "Debug" }
256256
toolset "gcc"
@@ -279,11 +279,39 @@ build bin/Debug/MyProject2.dll | bin/Debug/MyProject2.exp: link_gcc obj/Debug/ma
279279
end
280280

281281

282+
function suite.sharedLibWindowsGCCUseImportLibOff_ViaAPI()
283+
local wks = test.createWorkspace()
284+
configurations { "Debug" }
285+
toolset "gcc"
286+
_OS = "windows"
287+
288+
local prj = test.createProject(wks)
289+
kind "SharedLib"
290+
language "C++"
291+
files { "main.cpp" }
292+
useimportlib "Off"
293+
toolset "gcc"
294+
295+
local cfg = test.getconfig(prj, "Debug")
296+
297+
-- Set up object files list (normally done by buildFiles)
298+
cfg._objectFiles = { "obj/Debug/main.o" }
299+
300+
-- Call linkTarget and check output
301+
ninja.cpp.linkTarget(cfg)
302+
303+
test.capture [[
304+
build bin/Debug/MyProject2.dll | bin/Debug/MyProject2.exp: link_gcc obj/Debug/main.o
305+
ldflags = $ldflags_MyProject2_Debug
306+
]]
307+
end
308+
309+
282310
--
283311
-- Test that shared library on Windows with NoImportLib flag works correctly with MSVC
284312
--
285313

286-
function suite.sharedLibWindowsMSVCNoImportLib()
314+
function suite.sharedLibWindowsMSVCNoImportLib_ViaFlag()
287315
local wks = test.createWorkspace()
288316
configurations { "Debug" }
289317
toolset "msc"
@@ -312,6 +340,34 @@ build bin/Debug/MyProject2.dll | bin/Debug/MyProject2.exp: link_msc obj/Debug/ma
312340
end
313341

314342

343+
function suite.sharedLibWindowsMSVCUseImportLibOff_ViaAPI()
344+
local wks = test.createWorkspace()
345+
configurations { "Debug" }
346+
toolset "msc"
347+
_OS = "windows"
348+
349+
local prj = test.createProject(wks)
350+
kind "SharedLib"
351+
language "C++"
352+
files { "main.cpp" }
353+
useimportlib "Off"
354+
toolset "msc"
355+
356+
local cfg = test.getconfig(prj, "Debug")
357+
358+
-- Set up object files list (normally done by buildFiles)
359+
cfg._objectFiles = { "obj/Debug/main.obj" }
360+
361+
-- Call linkTarget and check output
362+
ninja.cpp.linkTarget(cfg)
363+
364+
test.capture [[
365+
build bin/Debug/MyProject2.dll | bin/Debug/MyProject2.exp: link_msc obj/Debug/main.obj
366+
ldflags = $ldflags_MyProject2_Debug
367+
]]
368+
end
369+
370+
315371
--
316372
-- Test the shared library not on Windows does not create exp or lib files
317373
--

modules/vstudio/tests/_tests.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ return {
4646
"vc200x/test_debug_settings.lua",
4747
"vc200x/test_excluded_configs.lua",
4848
"vc200x/test_files.lua",
49+
"vc200x/test_incrementallink.lua",
4950
"vc200x/test_linker_block.lua",
5051
"vc200x/test_manifest_block.lua",
5152
"vc200x/test_nmake_settings.lua",
@@ -76,6 +77,7 @@ return {
7677
"vc2010/test_files.lua",
7778
"vc2010/test_filter_ids.lua",
7879
"vc2010/test_filters.lua",
80+
"vc2010/test_incrementallink.lua",
7981
"vc2010/test_item_def_group.lua",
8082
"vc2010/test_link.lua",
8183
"vc2010/test_manifest.lua",

modules/vstudio/tests/vc200x/test_debug_settings.lua

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,3 +135,17 @@ Environment="key=value"
135135
EnvironmentMerge="false"
136136
]]
137137
end
138+
139+
--
140+
-- Make sure that debugenvsmerge API works correctly.
141+
--
142+
143+
function suite.environmentVarsSet_onDebugEnvsAndDebugEnvsMergeOff()
144+
debugenvs { "key=value" }
145+
debugenvsmerge "Off"
146+
prepare()
147+
test.capture [[
148+
Environment="key=value"
149+
EnvironmentMerge="false"
150+
]]
151+
end
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
--
2+
-- tests/vstudio/vc200x/test_incrementallink.lua
3+
-- Test incrementallink API with Visual Studio 2005-2008 exporters
4+
-- Author: Nick Clark
5+
-- Copyright (c) 2025 Jess Perkins and the Premake project
6+
--
7+
8+
local p = premake
9+
local suite = test.declare("vstudio_vs200x_incrementallink")
10+
local vc200x = p.vstudio.vc200x
11+
12+
13+
--
14+
-- Setup
15+
--
16+
17+
local wks, prj
18+
19+
function suite.setup()
20+
p.action.set("vs2008")
21+
wks = test.createWorkspace()
22+
end
23+
24+
local function prepare()
25+
prj = test.getproject(wks, 1)
26+
vc200x.VCLinkerTool(test.getconfig(prj, "Debug"))
27+
end
28+
29+
30+
--
31+
-- Test incrementallink API values
32+
--
33+
34+
function suite.incrementallinkOff()
35+
incrementallink "Off"
36+
prepare()
37+
test.capture [[
38+
<Tool
39+
Name="VCLinkerTool"
40+
OutputFile="$(OutDir)\MyProject.exe"
41+
LinkIncremental="1"
42+
]]
43+
end
44+
45+
function suite.incrementallinkOn()
46+
incrementallink "On"
47+
prepare()
48+
test.capture [[
49+
<Tool
50+
Name="VCLinkerTool"
51+
OutputFile="$(OutDir)\MyProject.exe"
52+
LinkIncremental="2"
53+
]]
54+
end
55+
56+
function suite.incrementallinkDefault()
57+
incrementallink "Default"
58+
prepare()
59+
test.capture [[
60+
<Tool
61+
Name="VCLinkerTool"
62+
OutputFile="$(OutDir)\MyProject.exe"
63+
LinkIncremental="2"
64+
]]
65+
end
66+
67+
function suite.incrementallinkDefault_optimized()
68+
incrementallink "Default"
69+
optimize "On"
70+
prepare()
71+
test.capture [[
72+
<Tool
73+
Name="VCLinkerTool"
74+
OutputFile="$(OutDir)\MyProject.exe"
75+
LinkIncremental="1"
76+
]]
77+
end

modules/vstudio/tests/vc2010/test_debug_settings.lua

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,3 +146,63 @@ foo=bar</LocalDebuggerEnvironment>
146146
<DebuggerFlavor>WindowsRemoteDebugger</DebuggerFlavor>
147147
]]
148148
end
149+
150+
--
151+
-- Check the handling of debugenvsinherit.
152+
--
153+
154+
function suite.localDebuggerEnv_onDebugEnvsInherit()
155+
debugenvs { "key=value" }
156+
debugenvsinherit "On"
157+
prepare()
158+
test.capture [[
159+
<LocalDebuggerEnvironment>key=value
160+
$(LocalDebuggerEnvironment)</LocalDebuggerEnvironment>
161+
]]
162+
end
163+
164+
function suite.localDebuggerEnv_onDeprecatedDebugEnvsInherit()
165+
debugenvs { "key=value" }
166+
flags { "DebugEnvsInherit" }
167+
prepare()
168+
test.capture [[
169+
<LocalDebuggerEnvironment>key=value
170+
$(LocalDebuggerEnvironment)</LocalDebuggerEnvironment>
171+
]]
172+
end
173+
174+
--
175+
-- Check the handling of debugenvsmerge.
176+
--
177+
178+
function suite.localDebuggerEnv_onDebugEnvsMergeFalse()
179+
debugenvs { "key=value" }
180+
debugenvsmerge "Off"
181+
prepare()
182+
test.capture [[
183+
<LocalDebuggerEnvironment>key=value</LocalDebuggerEnvironment>
184+
<LocalDebuggerMergeEnvironment>false</LocalDebuggerMergeEnvironment>
185+
]]
186+
end
187+
188+
function suite.localDebuggerEnv_onDeprecatedDebugEnvsDontMerge()
189+
debugenvs { "key=value" }
190+
flags { "DebugEnvsDontMerge" }
191+
prepare()
192+
test.capture [[
193+
<LocalDebuggerEnvironment>key=value</LocalDebuggerEnvironment>
194+
<LocalDebuggerMergeEnvironment>false</LocalDebuggerMergeEnvironment>
195+
]]
196+
end
197+
198+
function suite.localDebuggerEnv_onDebugEnvsBothFlags()
199+
debugenvs { "key=value" }
200+
debugenvsinherit "On"
201+
debugenvsmerge "Off"
202+
prepare()
203+
test.capture [[
204+
<LocalDebuggerEnvironment>key=value
205+
$(LocalDebuggerEnvironment)</LocalDebuggerEnvironment>
206+
<LocalDebuggerMergeEnvironment>false</LocalDebuggerMergeEnvironment>
207+
]]
208+
end
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
--
2+
-- tests/vstudio/vc2010/test_incrementallink.lua
3+
-- Test incrementallink API with Visual Studio 2010+ exporters
4+
-- Author: Nick Clark
5+
-- Copyright (c) 2025 Jess Perkins and the Premake project
6+
--
7+
8+
local p = premake
9+
local suite = test.declare("vstudio_vs2010_incrementallink")
10+
local vc2010 = p.vstudio.vc2010
11+
local project = p.project
12+
13+
14+
--
15+
-- Setup
16+
--
17+
18+
local wks, prj
19+
20+
function suite.setup()
21+
p.action.set("vs2010")
22+
wks = test.createWorkspace()
23+
end
24+
25+
local function prepare(platform)
26+
prj = test.getproject(wks, 1)
27+
vc2010.linkIncremental(test.getconfig(prj, "Debug", platform))
28+
end
29+
30+
31+
--
32+
-- Test incrementallink API values
33+
--
34+
35+
function suite.incrementallinkOff()
36+
incrementallink "Off"
37+
prepare()
38+
test.capture [[
39+
<LinkIncremental>false</LinkIncremental>
40+
]]
41+
end
42+
43+
function suite.incrementallinkOn()
44+
incrementallink "On"
45+
prepare()
46+
test.capture [[
47+
<LinkIncremental>true</LinkIncremental>
48+
]]
49+
end
50+
51+
function suite.incrementallinkDefault()
52+
incrementallink "Default"
53+
prepare()
54+
test.capture [[
55+
<LinkIncremental>true</LinkIncremental>
56+
]]
57+
end
58+
59+
function suite.incrementallinkDefault_optimized()
60+
incrementallink "Default"
61+
optimize "On"
62+
prepare()
63+
test.capture [[
64+
<LinkIncremental>false</LinkIncremental>
65+
]]
66+
end
67+
68+
function suite.incrementallinkOn_optimized()
69+
incrementallink "On"
70+
optimize "On"
71+
prepare()
72+
test.capture [[
73+
<LinkIncremental>true</LinkIncremental>
74+
]]
75+
end

modules/vstudio/tests/vc2010/test_manifest.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,4 @@
8686
</Manifest>
8787
]]
8888
end
89+

modules/vstudio/tests/vc2010/test_output_props.lua

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,17 @@ end
213213
]]
214214
end
215215

216+
function suite.ignoreImportLib_onUseImportLibOff()
217+
kind "SharedLib"
218+
useimportlib "Off"
219+
prepare()
220+
test.capture [[
221+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
222+
<LinkIncremental>true</LinkIncremental>
223+
<IgnoreImportLibrary>true</IgnoreImportLibrary>
224+
]]
225+
end
226+
216227
function suite.ignoreImportLib_onUWP()
217228
system "uwp"
218229
kind "SharedLib"

0 commit comments

Comments
 (0)