Commit 1ef12bf1 authored by Alexandru Croitor's avatar Alexandru Croitor Committed by Allan Sandfeld Jensen
Browse files

Fix namespace build on macOS


The namespace build was broken because both Qt and Chromium try to
forward declare NSString in certain cpp files. The forward declarations
were incompatible, because the Qt NSString was inside a namespace which
is brought into scope with "using QtNamespace::NSString", whereas the
Chromium one isn't in a namespace, and that leads to ambiguity issues.

Fix is not to use QT_FORWARD_DECLARE_CLASS which prepends the Qt
namespace, but rather do a simple forward declaration.

Change-Id: I8cd5fd0a9a2f62643f6afbd4508df885e13c9ae5
Reviewed-by: default avatarMichael Brüning <michael.bruning@qt.io>
Reviewed-by: default avatarAllan Sandfeld Jensen <allan.jensen@qt.io>
Showing with 9 additions and 1 deletion
......@@ -10,10 +10,18 @@ TEMPLATE = lib
include(core_common.pri)
macos {
# This fixes namespace builds on macOS. Specifically namespace ambiguity issues between Qt and
# Chromium forward declarations of NSString.
forward_declaration_macro = $$shell_quote(\"Q_FORWARD_DECLARE_OBJC_CLASS(name)=class name;\")
} else {
forward_declaration_macro = "Q_FORWARD_DECLARE_OBJC_CLASS=QT_FORWARD_DECLARE_CLASS"
}
# Defining keywords such as 'signal' clashes with the chromium code base.
DEFINES += QT_NO_KEYWORDS \
QT_USE_QSTRINGBUILDER \
Q_FORWARD_DECLARE_OBJC_CLASS=QT_FORWARD_DECLARE_CLASS \
$$forward_declaration_macro \
QTWEBENGINECORE_VERSION_STR=\\\"$$MODULE_VERSION\\\" \
BUILDING_CHROMIUM
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment