Skip to content

Commit 7326c15

Browse files
committed
Add additional debug configuration
I've added the DebugOpt config for a better debugging experience. This version enables some optimizations and uses `_ITERATOR_DEBUG_LEVEL=0` to remove many of the slowdowns of traditional debugging while still keeping the debuggability of the app intact. It uses the release versions of llvm and crt.
1 parent b9685f0 commit 7326c15

File tree

5 files changed

+30
-2
lines changed

5 files changed

+30
-2
lines changed

Directory.Build.props

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<PropertyGroup>
55
<RootDir>$(MSBuildThisFileDirectory)</RootDir>
66
<Platforms>x86;x64</Platforms>
7+
<Configurations>Debug;DebugOpt;Release</Configurations>
78
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
89
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
910
<PackageLicenseExpression>MIT</PackageLicenseExpression>

build/Helpers.lua

+7-1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ newoption {
3636
allowed = {
3737
{ "Release", "Release" },
3838
{ "Debug", "Debug" },
39+
{ "DebugOpt", "DebugOpt" },
3940
}
4041
}
4142

@@ -104,10 +105,15 @@ function SetupNativeProject()
104105

105106
filter { "configurations:Debug" }
106107
defines { "DEBUG" }
108+
109+
filter { "configurations:DebugOpt" }
110+
defines { "DEBUG", "_ITERATOR_DEBUG_LEVEL=0" }
111+
optimize "Debug"
112+
runtime "Release"
107113

108114
filter { "configurations:Release" }
109115
defines { "NDEBUG" }
110-
optimize "On"
116+
optimize "Full"
111117

112118
-- Compiler-specific options
113119

build/LLVM.lua

+18
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,18 @@ function SetupLLVMIncludes()
3838
local c = filter()
3939

4040
if LLVMDirPerConfiguration then
41+
filter { "configurations:DebugOpt" }
42+
includedirs
43+
{
44+
path.join(LLVMRootDirRelease, "include"),
45+
path.join(LLVMRootDirRelease, "llvm/include"),
46+
path.join(LLVMRootDirRelease, "lld/include"),
47+
path.join(LLVMRootDirRelease, "clang/include"),
48+
path.join(LLVMRootDirRelease, "clang/lib"),
49+
path.join(LLVMRootDirRelease, "build/include"),
50+
path.join(LLVMRootDirRelease, "build/clang/include"),
51+
}
52+
4153
filter { "configurations:Debug" }
4254
includedirs
4355
{
@@ -121,6 +133,9 @@ function SetupLLVMLibs()
121133
filter {}
122134

123135
if LLVMDirPerConfiguration then
136+
filter { "configurations:DebugOpt" }
137+
libdirs { path.join(LLVMRootDirRelease, "build/lib") }
138+
124139
filter { "configurations:Debug" }
125140
libdirs { path.join(LLVMRootDirDebug, "build/lib") }
126141

@@ -129,6 +144,9 @@ function SetupLLVMLibs()
129144
else
130145
local LLVMBuildDir = get_llvm_build_dir()
131146
libdirs { path.join(LLVMBuildDir, "lib") }
147+
148+
filter { "configurations:DebugOpt", "toolset:msc*" }
149+
libdirs { path.join(LLVMBuildDir, "RelWithDebInfo/lib") }
132150

133151
filter { "configurations:Debug", "toolset:msc*" }
134152
libdirs { path.join(LLVMBuildDir, "Debug/lib") }

build/build.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ set -e
33
builddir=$(cd "$(dirname "$0")"; pwd)
44
platform=x64
55
vs=vs2022
6-
configuration=Release
6+
configuration=DebugOpt
77
build_only=false
88
ci=false
99
target_framework=

build/llvm/LLVM.lua

+3
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,9 @@ function get_llvm_package_name(rev, conf, arch)
137137
end
138138

139139
function get_llvm_configuration_name(debug)
140+
if string.find(_OPTIONS["configuration"], "DebugOpt") then
141+
return os.istarget("windows") and "RelWithDebInfo" or "Release"
142+
end
140143
if string.find(_OPTIONS["configuration"], "Debug") then
141144
return "Debug"
142145
end

0 commit comments

Comments
 (0)