Fix Botan build on macOS

Since some Xcode version, running clang directly from the Toolchains
directory requires explicitly passing the sysroot to use.
If that is not done, inclusion of some standard headers like string.h
fails.

Change-Id: I640eca41d4132354f1091a7514586cb582e5d05c
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Eike Ziller
2018-08-13 09:01:53 +02:00
parent 13fbd1f867
commit b40b5cb79c
2 changed files with 6 additions and 2 deletions

View File

@@ -30,7 +30,7 @@ mingw {
BOTAN_CXX_FLAGS = BOTAN_CXX_FLAGS =
msvc: BOTAN_CXX_FLAGS += /wd4127 /wd4244 /wd4250 /wd4267 /wd4334 /wd4702 /wd4996 msvc: BOTAN_CXX_FLAGS += /wd4127 /wd4244 /wd4250 /wd4267 /wd4334 /wd4702 /wd4996
else: BOTAN_CXX_FLAGS += -Wno-unused-parameter else: BOTAN_CXX_FLAGS += -Wno-unused-parameter
macos: BOTAN_CXX_FLAGS += -mmacosx-version-min=$$QMAKE_MACOSX_DEPLOYMENT_TARGET macos: BOTAN_CXX_FLAGS += -mmacosx-version-min=$$QMAKE_MACOSX_DEPLOYMENT_TARGET -isysroot $$shell_quote($$QMAKE_MAC_SDK.macosx.Path)
unix: BOTAN_CXX_FLAGS += -fPIC unix: BOTAN_CXX_FLAGS += -fPIC
!isEmpty(BOTAN_CXX_FLAGS): OTHER_FLAGS += --cxxflags=$$shell_quote($$BOTAN_CXX_FLAGS) !isEmpty(BOTAN_CXX_FLAGS): OTHER_FLAGS += --cxxflags=$$shell_quote($$BOTAN_CXX_FLAGS)
win32: OTHER_FLAGS += --link-method=hardlink win32: OTHER_FLAGS += --link-method=hardlink

View File

@@ -6,6 +6,7 @@ Product {
type: ["staticlibrary", "hpp"] type: ["staticlibrary", "hpp"]
Depends { name: "cpp" } Depends { name: "cpp" }
Depends { name: "qtc" } Depends { name: "qtc" }
Depends { name: "xcode"; condition: qbs.toolchain.contains("xcode") }
files: "update-botan.sh" files: "update-botan.sh"
Group { Group {
name: "Botan sources" name: "Botan sources"
@@ -47,8 +48,11 @@ Product {
} }
else if (product.qbs.toolchain.contains("gcc")) else if (product.qbs.toolchain.contains("gcc"))
cxxFlags.push("-Wno-unused-parameter"); cxxFlags.push("-Wno-unused-parameter");
if (product.qbs.targetOS.contains("macos")) if (product.qbs.targetOS.contains("macos")) {
cxxFlags.push("-mmacosx-version-min=" + project.minimumMacosVersion); cxxFlags.push("-mmacosx-version-min=" + project.minimumMacosVersion);
if (product.qbs.toolchain.contains("xcode"))
cxxFlags.push("-isysroot", product.xcode.sdkPath);
}
if (product.qbs.targetOS.contains("unix")) if (product.qbs.targetOS.contains("unix"))
cxxFlags.push("-fPIC"); cxxFlags.push("-fPIC");
if (cxxFlags.length > 0) if (cxxFlags.length > 0)