From 4aaeaea1d7c16fe12194c1d78214de34879645a4 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Fri, 20 Aug 2021 17:23:54 +0200 Subject: Add --debug-symbols to include debug symbols in release builds --- backend/ninja/Ninja.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'backend/ninja') diff --git a/backend/ninja/Ninja.cpp b/backend/ninja/Ninja.cpp index d2465b4..54b86d1 100644 --- a/backend/ninja/Ninja.cpp +++ b/backend/ninja/Ninja.cpp @@ -396,9 +396,10 @@ namespace backend } case OPT_LEV_RELEASE: { - std::vector result = { ninja::NinjaArg::createRaw("-O3 -g0 -DNDEBUG") }; + std::vector result = { ninja::NinjaArg::createRaw("-O3 -DNDEBUG") }; if(config.use_lto) result.push_back(ninja::NinjaArg::createRaw("-flto")); + result.push_back(ninja::NinjaArg::createRaw(config.include_debug_symbols_in_release ? "-g3" : "-g0")); return result; } } @@ -1125,10 +1126,9 @@ namespace backend if(config.getOptimizationLevel() == sibs::OPT_LEV_RELEASE) { // TODO: Specify a way to change these options, either in project.conf or argument to sibs build - commonZigArgs.insert(commonZigArgs.end(), { - ninja::NinjaArg::createRaw("--release-safe"), - ninja::NinjaArg::createRaw("--strip") - }); + commonZigArgs.push_back(ninja::NinjaArg::createRaw("--release-safe")); + if(!config.include_debug_symbols_in_release) + commonZigArgs.push_back(ninja::NinjaArg::createRaw("--strip")); } zigTestArgs.insert(zigTestArgs.end(), commonZigArgs.begin(), commonZigArgs.end()); @@ -1356,7 +1356,8 @@ namespace backend else if(config.getOptimizationLevel() == OPT_LEV_RELEASE) { // Strip binary - buildExeArgs.push_back(ninja::NinjaArg::createRaw("-s")); + if(!config.include_debug_symbols_in_release) + buildExeArgs.push_back(ninja::NinjaArg::createRaw("-s")); } if(config.use_lto) -- cgit v1.2.3