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 <eike.ziller@qt.io>
This commit is contained in:
Christian Kandeler
2018-10-12 17:00:42 +02:00
parent fdde4529e8
commit 922a363fb4
2 changed files with 11 additions and 4 deletions

View File

@@ -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

View File

@@ -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"))