diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2016-09-23 17:21:46 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2016-09-23 19:25:55 +0000 |
commit | 1ef12bf1e09ded871cd4074fff4222a1f14547ef (patch) | |
tree | c04c760e2141601d8114b8a5647b12a71828c4c5 | |
parent | dd7917e0203a9144719214c5a5d36fcd7a0b6f93 (diff) |
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: Michael BrĂ¼ning <michael.bruning@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
-rw-r--r-- | src/core/core_gyp_generator.pro | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/core/core_gyp_generator.pro b/src/core/core_gyp_generator.pro index 5196d6438..1f745a3f5 100644 --- a/src/core/core_gyp_generator.pro +++ b/src/core/core_gyp_generator.pro @@ -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 |