From 922a363fb43fbedc37de7c0ffa8b937e1b12a800 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Fri, 12 Oct 2018 17:00:42 +0200 Subject: [PATCH] Botan: Enable optimizations in release mode Because we override the cxx flags manually to silence some warnings, we have to pass the -O flag too. On my machine, this results in a speed-up of factor four when uplading via SFTP. Change-Id: I3279f0cc95624530fdb5b7ea868a8a51962fb4f8 Reviewed-by: Eike Ziller --- src/libs/botan/botan.pro | 9 +++++++-- src/libs/botan/botan.qbs | 6 ++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/libs/botan/botan.pro b/src/libs/botan/botan.pro index ed5542a6f27..0f2f18b1812 100644 --- a/src/libs/botan/botan.pro +++ b/src/libs/botan/botan.pro @@ -33,9 +33,14 @@ msvc: BOTAN_CXX_FLAGS += /wd4100 /wd4800 /wd4127 /wd4244 /wd4250 /wd4267 /wd4334 else: BOTAN_CXX_FLAGS += -Wno-unused-parameter macos: BOTAN_CXX_FLAGS += -mmacosx-version-min=$$QMAKE_MACOSX_DEPLOYMENT_TARGET -isysroot $$shell_quote($$QMAKE_MAC_SDK_PATH) unix: BOTAN_CXX_FLAGS += -fPIC -!isEmpty(BOTAN_CXX_FLAGS): OTHER_FLAGS += --cxxflags=$$shell_quote($$BOTAN_CXX_FLAGS) win32: OTHER_FLAGS += --link-method=hardlink -CONFIG(debug, debug|release): OTHER_FLAGS += --debug-mode +CONFIG(debug, debug|release) { + OTHER_FLAGS += --with-debug-info +} else { + msvc: BOTAN_CXX_FLAGS += /O2 + else: BOTAN_CXX_FLAGS += -O3 +} +!isEmpty(BOTAN_CXX_FLAGS): OTHER_FLAGS += --cxxflags=$$shell_quote($$BOTAN_CXX_FLAGS) CONFIGURE_FILE_PATH_FOR_SHELL = $$shell_quote($$shell_path($$BOTAN_SOURCE_DIR/configure.py)) configure_inputs = $$BOTAN_SOURCE_DIR/configure.py diff --git a/src/libs/botan/botan.qbs b/src/libs/botan/botan.qbs index e6a7369f368..004cdc2f2cd 100644 --- a/src/libs/botan/botan.qbs +++ b/src/libs/botan/botan.qbs @@ -42,7 +42,8 @@ Product { + "sha2_32,sha2_32_x86,sha2_64,simd,system_rng,emsa_pkcs1,pbes2,pbkdf2"; args.push("--enable-modules=" + modules); var cxxFlags = []; - if (product.qbs.toolchain.contains("msvc")) { + var tc = product.qbs.toolchain; + if (tc.contains("msvc")) { cxxFlags.push("/wd4100", "/wd4800", "/wd4127", "/wd4244", "/wd4250", "/wd4267", "/wd4334", "/wd4702", "/wd4996", "/D_ENABLE_EXTENDED_ALIGNED_STORAGE"); } @@ -55,10 +56,11 @@ Product { } if (product.qbs.targetOS.contains("unix")) cxxFlags.push("-fPIC"); + if (product.qbs.buildVariant === "release") + cxxFlags.push(tc.contains("msvc") ? "/O2" : "-O3"); if (cxxFlags.length > 0) args.push("--cxxflags=" + cxxFlags.join(" ")); var ccOption = "--cc="; - var tc = product.qbs.toolchain; if (tc.contains("msvc")) ccOption += "msvc"; else if (tc.contains("clang"))