From aaba74715faf6e6c2f2825fdd8ed08ad6dd6b528 Mon Sep 17 00:00:00 2001 From: nickclark2016 Date: Mon, 12 Oct 2020 11:06:58 -0400 Subject: [PATCH] Added disable for Just My Code debugging --- modules/vstudio/tests/_tests.lua | 4 +- .../tests/vc2019/test_compile_settings.lua | 41 +++++++++++++++++++ modules/vstudio/tests/vc2019/test_link.lua | 2 +- .../tests/vc2019/test_toolset_settings.lua | 2 +- modules/vstudio/vs2010_vcxproj.lua | 8 ++++ src/_premake_init.lua | 9 ++++ src/tools/msc.lua | 3 ++ 7 files changed, 66 insertions(+), 3 deletions(-) create mode 100644 modules/vstudio/tests/vc2019/test_compile_settings.lua diff --git a/modules/vstudio/tests/_tests.lua b/modules/vstudio/tests/_tests.lua index 3114e28e..664cea23 100644 --- a/modules/vstudio/tests/_tests.lua +++ b/modules/vstudio/tests/_tests.lua @@ -97,6 +97,8 @@ return { -- Visual Studio 2013+ C/C++ Shared Items projects "vc2013/test_vcxitems.lua", - -- Visual Studio 2019+ C/C++ Clang Projects + -- Visual Studio 2019+ C/C++ Projects + "vc2019/test_compile_settings.lua", + "vc2019/test_link.lua", "vc2019/test_toolset_settings.lua" } diff --git a/modules/vstudio/tests/vc2019/test_compile_settings.lua b/modules/vstudio/tests/vc2019/test_compile_settings.lua new file mode 100644 index 00000000..f7447c4f --- /dev/null +++ b/modules/vstudio/tests/vc2019/test_compile_settings.lua @@ -0,0 +1,41 @@ +-- +-- tests/actions/vstudio/vc2010/test_compile_settings.lua +-- Validate compiler settings in Visual Studio 2019 C/C++ projects. +-- Copyright (c) 2011-2020 Jason Perkins and the Premake project +-- + + local p = premake + local suite = test.declare("vstudio_vs2019_compile_settings") + local vc2010 = p.vstudio.vc2010 + local project = p.project + +-- +-- Setup +-- + + local wks, prj + + function suite.setup() + p.action.set("vs2019") + wks, prj = test.createWorkspace() + end + + local function prepare(platform) + local cfg = test.getconfig(prj, "Debug", platform) + vc2010.clCompile(cfg) + end + +-- +-- Check ClCompile for SupportJustMyCode +-- + function suite.SupportJustMyCode() + justmycode "Off" + prepare() + test.capture [[ + + NotUsing + Level3 + Disabled + false + ]] + end \ No newline at end of file diff --git a/modules/vstudio/tests/vc2019/test_link.lua b/modules/vstudio/tests/vc2019/test_link.lua index 3a6ad4be..9e1b27de 100644 --- a/modules/vstudio/tests/vc2019/test_link.lua +++ b/modules/vstudio/tests/vc2019/test_link.lua @@ -5,7 +5,7 @@ -- local p = premake -local suite = test.declare("vstudio_vs2019_compile_settings") +local suite = test.declare("vstudio_vs2019_link") local vc2010 = p.vstudio.vc2010 local project = p.project diff --git a/modules/vstudio/tests/vc2019/test_toolset_settings.lua b/modules/vstudio/tests/vc2019/test_toolset_settings.lua index 8c6174bd..06215fdd 100644 --- a/modules/vstudio/tests/vc2019/test_toolset_settings.lua +++ b/modules/vstudio/tests/vc2019/test_toolset_settings.lua @@ -5,7 +5,7 @@ -- local p = premake - local suite = test.declare("vstudio_vs2019_compile_settings") + local suite = test.declare("vstudio_vs2019_toolset_settings") local vc2010 = p.vstudio.vc2010 local project = p.project diff --git a/modules/vstudio/vs2010_vcxproj.lua b/modules/vstudio/vs2010_vcxproj.lua index 1e072151..87259c48 100644 --- a/modules/vstudio/vs2010_vcxproj.lua +++ b/modules/vstudio/vs2010_vcxproj.lua @@ -365,6 +365,7 @@ m.optimization, m.functionLevelLinking, m.intrinsicFunctions, + m.justMyCodeDebugging, m.minimalRebuild, m.omitFramePointers, m.stringPooling, @@ -2122,6 +2123,13 @@ end end + function m.justMyCodeDebugging(cfg) + local jmc = cfg.justmycode + + if _ACTION >= "vs2017" and jmc == "Off" then + m.element("SupportJustMyCode", nil, "false") + end + end function m.keyword(prj) -- try to determine what kind of targets we're building here diff --git a/src/_premake_init.lua b/src/_premake_init.lua index fd24aa53..c193f45a 100644 --- a/src/_premake_init.lua +++ b/src/_premake_init.lua @@ -1411,6 +1411,15 @@ kind = "boolean" } + api.register { + name = "justmycode", + scope = "project", + kind = "string", + allowed = { + "Off" + } + } + ----------------------------------------------------------------------------- -- -- Field name aliases for backward compatibility diff --git a/src/tools/msc.lua b/src/tools/msc.lua index f0cf85b5..52692a92 100644 --- a/src/tools/msc.lua +++ b/src/tools/msc.lua @@ -105,6 +105,9 @@ }, omitframepointer = { On = "/Oy" + }, + justmycode = { + Off = "false" } }