From 1ef12bf1e09ded871cd4074fff4222a1f14547ef Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Fri, 23 Sep 2016 17:21:46 +0200 Subject: Fix namespace build on macOS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Allan Sandfeld Jensen --- src/core/core_gyp_generator.pro | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/core') 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 -- cgit v1.2.3