Browse Source

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.
pull/1893/head
duckdoom5 5 months ago
parent
commit
7326c154d4
  1. 1
      Directory.Build.props
  2. 8
      build/Helpers.lua
  3. 18
      build/LLVM.lua
  4. 2
      build/build.sh
  5. 3
      build/llvm/LLVM.lua

1
Directory.Build.props

@ -4,6 +4,7 @@ @@ -4,6 +4,7 @@
<PropertyGroup>
<RootDir>$(MSBuildThisFileDirectory)</RootDir>
<Platforms>x86;x64</Platforms>
<Configurations>Debug;DebugOpt;Release</Configurations>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<PackageLicenseExpression>MIT</PackageLicenseExpression>

8
build/Helpers.lua

@ -36,6 +36,7 @@ newoption { @@ -36,6 +36,7 @@ newoption {
allowed = {
{ "Release", "Release" },
{ "Debug", "Debug" },
{ "DebugOpt", "DebugOpt" },
}
}
@ -104,10 +105,15 @@ function SetupNativeProject() @@ -104,10 +105,15 @@ function SetupNativeProject()
filter { "configurations:Debug" }
defines { "DEBUG" }
filter { "configurations:DebugOpt" }
defines { "DEBUG", "_ITERATOR_DEBUG_LEVEL=0" }
optimize "Debug"
runtime "Release"
filter { "configurations:Release" }
defines { "NDEBUG" }
optimize "On"
optimize "Full"
-- Compiler-specific options

18
build/LLVM.lua

@ -38,6 +38,18 @@ function SetupLLVMIncludes() @@ -38,6 +38,18 @@ function SetupLLVMIncludes()
local c = filter()
if LLVMDirPerConfiguration then
filter { "configurations:DebugOpt" }
includedirs
{
path.join(LLVMRootDirRelease, "include"),
path.join(LLVMRootDirRelease, "llvm/include"),
path.join(LLVMRootDirRelease, "lld/include"),
path.join(LLVMRootDirRelease, "clang/include"),
path.join(LLVMRootDirRelease, "clang/lib"),
path.join(LLVMRootDirRelease, "build/include"),
path.join(LLVMRootDirRelease, "build/clang/include"),
}
filter { "configurations:Debug" }
includedirs
{
@ -121,6 +133,9 @@ function SetupLLVMLibs() @@ -121,6 +133,9 @@ function SetupLLVMLibs()
filter {}
if LLVMDirPerConfiguration then
filter { "configurations:DebugOpt" }
libdirs { path.join(LLVMRootDirRelease, "build/lib") }
filter { "configurations:Debug" }
libdirs { path.join(LLVMRootDirDebug, "build/lib") }
@ -129,6 +144,9 @@ function SetupLLVMLibs() @@ -129,6 +144,9 @@ function SetupLLVMLibs()
else
local LLVMBuildDir = get_llvm_build_dir()
libdirs { path.join(LLVMBuildDir, "lib") }
filter { "configurations:DebugOpt", "toolset:msc*" }
libdirs { path.join(LLVMBuildDir, "RelWithDebInfo/lib") }
filter { "configurations:Debug", "toolset:msc*" }
libdirs { path.join(LLVMBuildDir, "Debug/lib") }

2
build/build.sh

@ -3,7 +3,7 @@ set -e @@ -3,7 +3,7 @@ set -e
builddir=$(cd "$(dirname "$0")"; pwd)
platform=x64
vs=vs2022
configuration=Release
configuration=DebugOpt
build_only=false
ci=false
target_framework=

3
build/llvm/LLVM.lua

@ -137,6 +137,9 @@ function get_llvm_package_name(rev, conf, arch) @@ -137,6 +137,9 @@ function get_llvm_package_name(rev, conf, arch)
end
function get_llvm_configuration_name(debug)
if string.find(_OPTIONS["configuration"], "DebugOpt") then
return os.istarget("windows") and "RelWithDebInfo" or "Release"
end
if string.find(_OPTIONS["configuration"], "Debug") then
return "Debug"
end

Loading…
Cancel
Save