From 00cd5681c3a83c85d2a34fb2c4b6cfb691ef1b3d Mon Sep 17 00:00:00 2001 From: dec05eba Date: Thu, 22 Apr 2021 19:32:57 +0200 Subject: rename flto option to lto --- backend/ninja/Ninja.cpp | 17 ++++++++++------- include/Conf.hpp | 4 ++-- src/main.cpp | 12 ++++++------ 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/backend/ninja/Ninja.cpp b/backend/ninja/Ninja.cpp index ace95d9..ea3d96f 100644 --- a/backend/ninja/Ninja.cpp +++ b/backend/ninja/Ninja.cpp @@ -448,20 +448,23 @@ namespace backend case OPT_LEV_DEBUG: { // TODO: Add _GLIBCXX_DEBUG - return { + std::vector result = { ninja::NinjaArg::createRaw("-O0 -g3"), ninja::NinjaArg::createRaw("-D_GLIBCXX_ASSERTIONS"), ninja::NinjaArg::createRaw("-fasynchronous-unwind-tables"), ninja::NinjaArg::createRaw("-D_DEBUG"), ninja::NinjaArg::createRaw("-fno-omit-frame-pointer"), }; + if(config.use_lto) + result.push_back(ninja::NinjaArg::createRaw("-flto")); + return result; } case OPT_LEV_RELEASE: { - if(config.use_flto) - return { ninja::NinjaArg::createRaw("-O3 -g0 -DNDEBUG -flto") }; - else - return { ninja::NinjaArg::createRaw("-O3 -g0 -DNDEBUG") }; + std::vector result = { ninja::NinjaArg::createRaw("-O3 -g0 -DNDEBUG") }; + if(config.use_lto) + result.push_back(ninja::NinjaArg::createRaw("-flto")); + return result; } } break; @@ -1411,7 +1414,7 @@ namespace backend buildExeArgs.push_back(ninja::NinjaArg::createRaw("-s")); } - if(config.getOptimizationLevel() == OPT_LEV_RELEASE && config.use_flto) + if(config.use_lto) { buildExeArgs.push_back(ninja::NinjaArg::createRaw("-flto")); } @@ -1639,7 +1642,7 @@ namespace backend if(sanitizeFlag.type != ninja::NinjaArg::Type::NONE) buildDynamicArgs.push_back(std::move(sanitizeFlag)); - if(config.getOptimizationLevel() == OPT_LEV_RELEASE && config.use_flto) + if(config.use_lto) { buildDynamicArgs.push_back(ninja::NinjaArg::createRaw("-flto")); } diff --git a/include/Conf.hpp b/include/Conf.hpp index eb922bc..8098206 100644 --- a/include/Conf.hpp +++ b/include/Conf.hpp @@ -231,7 +231,7 @@ namespace sibs packaging(false), bundling(false), platform(SYSTEM_PLATFORM), - use_flto(false) + use_lto(false) { cmakeDirGlobal = projectPath; switch(optimizationLevel) @@ -431,7 +431,7 @@ namespace sibs std::string versionStr; PackageVersion version; Platform platform; - bool use_flto; + bool use_lto; std::vector includeDirs; std::vector exposeIncludeDirs; std::vector ignoreDirs; diff --git a/src/main.cpp b/src/main.cpp index a812b8a..365cb1b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -137,7 +137,7 @@ static void usageBuild(bool run) printf(" --debug|--release Optimization level to build project and dependencies with (if not a system package) - Optional (default: --debug)\n"); printf(" --sanitize Add runtime address/undefined behavior sanitization. Program can be up to 3 times slower and use 10 times as much RAM. Ignored if compiler doesn't support sanitization - Optional (default: none)\n"); printf(" --platform The platform to build for - Optional (default: the running platform)\n"); - printf(" --flto Use link-time optimization. May increase compile times - Optional (default: false)\n"); + printf(" --lto Use link-time optimization. May increase compile times - Optional (default: false)\n"); printf("Examples:\n"); printf(" sibs %s\n", run ? "run" : "build"); if(run) @@ -516,7 +516,7 @@ static int buildProject(int argc, const _tinydir_char_t **argv, bool run) FileString projectPath; Sanitize sanitize = Sanitize::NONE; FileString platformName; - bool use_flto = false; + bool use_lto = false; std::vector run_args; for(int i = 0; i < argc; ++i) @@ -540,9 +540,9 @@ static int buildProject(int argc, const _tinydir_char_t **argv, bool run) } optimizationLevel = OPT_LEV_RELEASE; } - else if(_tinydir_strcmp(arg, TINYDIR_STRING("--flto")) == 0) + else if(_tinydir_strcmp(arg, TINYDIR_STRING("--lto")) == 0) { - use_flto = true; + use_lto = true; } else if(_tinydir_strncmp(arg, TINYDIR_STRING("--sanitize="), 11) == 0) { @@ -651,7 +651,7 @@ static int buildProject(int argc, const _tinydir_char_t **argv, bool run) sibsConfig.showWarnings = true; sibsConfig.platform = platform; sibsConfig.setSanitize(sanitize); - sibsConfig.use_flto = use_flto; + sibsConfig.use_lto = use_lto; return buildProject(projectPath, projectConfFilePath, sibsConfig, run, escape_args(run_args)); } @@ -1235,7 +1235,7 @@ static int packageProject(int argc, const _tinydir_char_t **argv) sibsConfig.showWarnings = true; sibsConfig.packaging = packagingType == PackagingType::STATIC; sibsConfig.bundling = (packagingType == PackagingType::BUNDLE) || (packagingType == PackagingType::BUNDLE_INSTALL); - sibsConfig.use_flto = true; + sibsConfig.use_lto = true; int result = buildProject(projectPath, projectConfFilePath, sibsConfig, false, TINYDIR_STRING("")); if(result != 0) return result; -- cgit v1.2.3