summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2016-12-15 16:31:26 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2017-01-27 12:32:34 +0000
commitebc88886041fb1f38c22e2ef33b17ca1baff7bc8 (patch)
tree9612b2486ff94b5b1f5a97c4e3920d9fafdb71c2
parentbec2be57891f87f2b8bc046bb212be4788f96033 (diff)
macOS GN integration
Change-Id: I89850d43c8f11ec54b3a47318ef0b3f083ae3dee Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
-rw-r--r--src/core/config/mac_osx.pri55
-rw-r--r--src/core/content_browser_client_qt.cpp2
-rw-r--r--src/core/core_generator.pro10
-rw-r--r--src/core/core_module.pro112
-rw-r--r--src/core/gn_run.pro1
-rw-r--r--src/core/qtwebengine.gni2
-rw-r--r--src/core/qtwebengine_resources.gni6
-rw-r--r--src/core/qtwebengine_sources.gni16
-rw-r--r--src/tools/qwebengine_convert_dict/qwebengine_convert_dict.pro7
-rw-r--r--tools/qmake/mkspecs/features/gn_generator.prf34
10 files changed, 163 insertions, 82 deletions
diff --git a/src/core/config/mac_osx.pri b/src/core/config/mac_osx.pri
index dfc8d840..e52051b0 100644
--- a/src/core/config/mac_osx.pri
+++ b/src/core/config/mac_osx.pri
@@ -19,21 +19,42 @@ QMAKE_CLANG_PATH = $$eval(QMAKE_MAC_SDK.macx-clang.$${QMAKE_MAC_SDK}.QMAKE_CXX)
QMAKE_CLANG_PATH = "$${QMAKE_CLANG_DIR}/bin/clang++"
message("Using clang++ from $${QMAKE_CLANG_PATH}")
system("$${QMAKE_CLANG_PATH} --version")
-GYP_CONFIG += \
- qt_os=\"mac\" \
- mac_sdk_min=\"$${QMAKE_MAC_SDK_VERSION}\" \
- mac_deployment_target=\"$${QMAKE_MACOSX_DEPLOYMENT_TARGET}\" \
- make_clang_dir=\"$${QMAKE_CLANG_DIR}\" \
- clang_use_chrome_plugins=0
-
-# Force touch API is used in 49-based Chromium, which is included starting with 10.10.3 SDK, so we
-# disable the API usage if the SDK version is lower.
-!isMinOSXSDKVersion(10, 10, 3): GYP_CONFIG += disable_force_touch=1
-
-# Pass a supported -fstack-protect flag depending on Xcode version.
-lessThan(QMAKE_XCODE_VERSION, 6.3) {
- GYP_CONFIG += use_xcode_stack_protector_strong=0
-}
-QMAKE_MAC_SDK_PATH = "$$eval(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.path)"
-exists($$QMAKE_MAC_SDK_PATH): GYP_CONFIG += mac_sdk_path=\"$${QMAKE_MAC_SDK_PATH}\"
+
+use?(gn) {
+ gn_args += \
+ is_clang=true \
+ use_sysroot=false \
+ use_kerberos=false \
+ clang_base_path=\"$${QMAKE_CLANG_DIR}\" \
+ clang_use_chrome_plugins=false \
+ mac_deployment_target=\"$${QMAKE_MACOSX_DEPLOYMENT_TARGET}\" \
+ mac_sdk_min=\"$${QMAKE_MAC_SDK_VERSION}\"
+
+ use?(spellchecker) {
+ use?(native_spellchecker): gn_args += use_browser_spellchecker=true
+ else: gn_args += use_browser_spellchecker=false
+ } else {
+ macos: gn_args += use_browser_spellchecker=false
+ }
+
+} else {
+ GYP_CONFIG += \
+ qt_os=\"mac\" \
+ mac_sdk_min=\"$${QMAKE_MAC_SDK_VERSION}\" \
+ mac_deployment_target=\"$${QMAKE_MACOSX_DEPLOYMENT_TARGET}\" \
+ make_clang_dir=\"$${QMAKE_CLANG_DIR}\" \
+ clang_use_chrome_plugins=0
+
+ # Force touch API is used in 49-based Chromium, which is included starting with 10.10.3 SDK, so we
+ # disable the API usage if the SDK version is lower.
+ !isMinOSXSDKVersion(10, 10, 3): GYP_CONFIG += disable_force_touch=1
+
+ # Pass a supported -fstack-protect flag depending on Xcode version.
+ lessThan(QMAKE_XCODE_VERSION, 6.3) {
+ GYP_CONFIG += use_xcode_stack_protector_strong=0
+ }
+
+ QMAKE_MAC_SDK_PATH = "$$eval(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.path)"
+ exists($$QMAKE_MAC_SDK_PATH): GYP_CONFIG += mac_sdk_path=\"$${QMAKE_MAC_SDK_PATH}\"
+}
diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp
index 78758654..f9b6f31d 100644
--- a/src/core/content_browser_client_qt.cpp
+++ b/src/core/content_browser_client_qt.cpp
@@ -386,7 +386,7 @@ void ContentBrowserClientQt::RenderProcessWillLaunch(content::RenderProcessHost*
// SpellCheckMessageFilter is required for both Hunspell and Native configurations.
host->AddFilter(new SpellCheckMessageFilter(id));
#endif
-#if defined(Q_OS_MACOS) && defined(USE_BROWSER_SPELLCHECKER)
+#if defined(Q_OS_MACOS) && defined(ENABLE_SPELLCHECK) && defined(USE_BROWSER_SPELLCHECKER)
host->AddFilter(new SpellCheckMessageFilterPlatform(id));
#endif
#if defined(ENABLE_BASIC_PRINTING)
diff --git a/src/core/core_generator.pro b/src/core/core_generator.pro
index e1e7ab1d..ed47a47e 100644
--- a/src/core/core_generator.pro
+++ b/src/core/core_generator.pro
@@ -12,7 +12,15 @@ 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;\")
+ contains(WEBENGINE_CONFIG, use_gn) {
+ # The single quotes are present so that qmake iteration does not interpret the space as
+ # delimiting a new value, they are removed before writing to the GN file, and the final shell
+ # quoting is done by GN itself.
+ forward_declaration_macro = "'Q_FORWARD_DECLARE_OBJC_CLASS(name)=class name;'"
+ } else {
+ # For GYP, quoting should be done by qmake itself.
+ 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"
}
diff --git a/src/core/core_module.pro b/src/core/core_module.pro
index fc1c3278..a7853e52 100644
--- a/src/core/core_module.pro
+++ b/src/core/core_module.pro
@@ -24,13 +24,25 @@ use?(gn){
isEmpty(NINJA_LFLAGS): error("Missing linker flags from QtWebEngineCore linking pri")
isEmpty(NINJA_ARCHIVES): error("Missing archive files from QtWebEngineCore linking pri")
isEmpty(NINJA_LIBS): error("Missing library files from QtWebEngineCore linking pri")
- OBJECTS = $$NINJA_OBJECTS
- linux: LIBS_PRIVATE = -Wl,-whole-archive $$NINJA_ARCHIVES -Wl,-no-whole-archive
+ NINJA_OBJECTS = $$eval($$list($$NINJA_OBJECTS))
+ # Do manual response file linking for macOS and Linux
+ unix {
+ RSP_FILE = $$OUT_PWD/$$getConfigDir()/$${TARGET}.rsp
+ for(object, NINJA_OBJECTS): RSP_CONTENT += $$object
+ write_file($$RSP_FILE, RSP_CONTENT)
+ macos:LIBS_PRIVATE += -Wl,-filelist,$$shell_quote($$RSP_FILE)
+ linux:LIBS_PRIVATE += @$$RSP_FILE
+ } else {
+ OBJECTS = $$NINJA_OBJECTS
+ }
+ linux: LIBS_PRIVATE += -Wl,--start-group $$NINJA_ARCHIVES -Wl,--end-group
+ else: LIBS_PRIVATE += $$NINJA_ARCHIVES
LIBS_PRIVATE += $$NINJA_LIB_DIRS $$NINJA_LIBS
QMAKE_LFLAGS += $$NINJA_LFLAGS
POST_TARGETDEPS += $$NINJA_TARGETDEPS
}
+
LIBS_PRIVATE += -L$$api_library_path
CONFIG *= no_smart_library_merge
osx {
@@ -58,58 +70,60 @@ qtConfig(egl): CONFIG += egl
linux:qtConfig(separate_debug_info): QMAKE_POST_LINK="cd $(DESTDIR) && $(STRIP) --strip-unneeded $(TARGET)"
-!use?(gn) {
-
+use?(gn) {
+ REPACK_DIR = $$OUT_PWD/$$getConfigDir()
+} else {
REPACK_DIR = $$OUT_PWD/$$getConfigDir()/gen/repack
- # Duplicated from resources/resources.gyp
- LOCALE_LIST = am ar bg bn ca cs da de el en-GB en-US es-419 es et fa fi fil fr gu he hi hr hu id it ja kn ko lt lv ml mr ms nb nl pl pt-BR pt-PT ro ru sk sl sr sv sw ta te th tr uk vi zh-CN zh-TW
- for(LOC, LOCALE_LIST) {
- locales.files += $$REPACK_DIR/qtwebengine_locales/$${LOC}.pak
- }
- resources.files = $$REPACK_DIR/qtwebengine_resources.pak \
- $$REPACK_DIR/qtwebengine_resources_100p.pak \
- $$REPACK_DIR/qtwebengine_resources_200p.pak \
- $$REPACK_DIR/qtwebengine_devtools_resources.pak
-
- icu.files = $$OUT_PWD/$$getConfigDir()/icudtl.dat
-
- !debug_and_release|!build_all|CONFIG(release, debug|release) {
- qtConfig(framework) {
- locales.version = Versions
- locales.path = Resources/qtwebengine_locales
- resources.version = Versions
- resources.path = Resources
- icu.version = Versions
- icu.path = Resources
- # No files, this prepares the bundle Helpers symlink, process.pro will create the directories
- qtwebengineprocessplaceholder.version = Versions
- qtwebengineprocessplaceholder.path = Helpers
- QMAKE_BUNDLE_DATA += icu locales resources qtwebengineprocessplaceholder
- } else {
- locales.CONFIG += no_check_exist
- locales.path = $$[QT_INSTALL_TRANSLATIONS]/qtwebengine_locales
- resources.CONFIG += no_check_exist
- resources.path = $$[QT_INSTALL_DATA]/resources
- INSTALLS += locales resources
-
- !use?(system_icu) {
- icu.CONFIG += no_check_exist
- icu.path = $$[QT_INSTALL_DATA]/resources
- INSTALLS += icu
- }
- }
+}
- !qtConfig(framework):!force_independent {
- #
- # Copy essential files to the qtbase build directory for non-prefix builds
- #
+# Duplicated from resources/resources.gyp
+LOCALE_LIST = am ar bg bn ca cs da de el en-GB en-US es-419 es et fa fi fil fr gu he hi hr hu id it ja kn ko lt lv ml mr ms nb nl pl pt-BR pt-PT ro ru sk sl sr sv sw ta te th tr uk vi zh-CN zh-TW
+for(LOC, LOCALE_LIST) {
+ locales.files += $$REPACK_DIR/qtwebengine_locales/$${LOC}.pak
+}
+resources.files = $$REPACK_DIR/qtwebengine_resources.pak \
+ $$REPACK_DIR/qtwebengine_resources_100p.pak \
+ $$REPACK_DIR/qtwebengine_resources_200p.pak \
+ $$REPACK_DIR/qtwebengine_devtools_resources.pak
+
+icu.files = $$OUT_PWD/$$getConfigDir()/icudtl.dat
+
+!debug_and_release|!build_all|CONFIG(release, debug|release) {
+ qtConfig(framework) {
+ locales.version = Versions
+ locales.path = Resources/qtwebengine_locales
+ resources.version = Versions
+ resources.path = Resources
+ icu.version = Versions
+ icu.path = Resources
+ # No files, this prepares the bundle Helpers symlink, process.pro will create the directories
+ qtwebengineprocessplaceholder.version = Versions
+ qtwebengineprocessplaceholder.path = Helpers
+ QMAKE_BUNDLE_DATA += icu locales resources qtwebengineprocessplaceholder
+ } else {
+ locales.CONFIG += no_check_exist
+ locales.path = $$[QT_INSTALL_TRANSLATIONS]/qtwebengine_locales
+ resources.CONFIG += no_check_exist
+ resources.path = $$[QT_INSTALL_DATA]/resources
+ INSTALLS += locales resources
+
+ !use?(system_icu) {
+ icu.CONFIG += no_check_exist
+ icu.path = $$[QT_INSTALL_DATA]/resources
+ INSTALLS += icu
+ }
+ }
- !use?(system_icu) {
- COPIES += icu
- }
+ !qtConfig(framework):!force_independent {
+ #
+ # Copy essential files to the qtbase build directory for non-prefix builds
+ #
- COPIES += resources locales
+ !use?(system_icu) {
+ COPIES += icu
}
+
+ COPIES += resources locales
}
}
diff --git a/src/core/gn_run.pro b/src/core/gn_run.pro
index 5bb90d8b..534f0c7b 100644
--- a/src/core/gn_run.pro
+++ b/src/core/gn_run.pro
@@ -7,6 +7,7 @@ TEMPLATE = aux
build_pass|!debug_and_release {
+ macos: include(config/mac_osx.pri)
linux: include(config/desktop_linux.pri)
isEmpty(gn_args): error(No gn_args found please make sure you have valid configuration.)
diff --git a/src/core/qtwebengine.gni b/src/core/qtwebengine.gni
index e73f9eb8..4e561e7a 100644
--- a/src/core/qtwebengine.gni
+++ b/src/core/qtwebengine.gni
@@ -13,6 +13,7 @@ include_dirs = [
deps = [
"//base",
+ "//components/cdm/renderer",
"//components/devtools_http_handler",
"//components/error_page/common",
"//components/keyed_service/content",
@@ -30,6 +31,7 @@ deps = [
"//third_party/WebKit/public:blink",
"//third_party/widevine/cdm:version_h",
"//ui/accessibility",
+ "//third_party/mesa:mesa_headers",
":qtwebengine_sources",
":qtwebengine_resources"
]
diff --git a/src/core/qtwebengine_resources.gni b/src/core/qtwebengine_resources.gni
index e6d3b5a3..e3cd4216 100644
--- a/src/core/qtwebengine_resources.gni
+++ b/src/core/qtwebengine_resources.gni
@@ -81,10 +81,6 @@ repack("qtwebengine_repack_resources_devtools") {
chrome_repack_locales("qtwebengine_repack_locales_pack") {
input_locales = locales
output_dir_name = "qtwebengine_locales"
- if (is_mac) {
- output_locales = locales_as_mac_outputs
- } else {
- output_locales = locales
- }
+ output_locales = locales
}
diff --git a/src/core/qtwebengine_sources.gni b/src/core/qtwebengine_sources.gni
index 6389bdf6..2d3503e9 100644
--- a/src/core/qtwebengine_sources.gni
+++ b/src/core/qtwebengine_sources.gni
@@ -27,6 +27,11 @@ source_set("qtwebengine_sources") {
"//chrome/renderer/pepper/pepper_shared_memory_message_filter.cc",
"//chrome/renderer/pepper/pepper_shared_memory_message_filter.h",
]
+
+ deps += [
+ # Need to depend on //content/ppapi_plugin, which is private, thus depending on parent.
+ "//content",
+ ]
}
if (enable_spellcheck) {
@@ -49,8 +54,6 @@ source_set("qtwebengine_sources") {
"//chrome/browser/spellchecker/spellcheck_hunspell_dictionary.h",
"//chrome/browser/spellchecker/spellcheck_message_filter.cc",
"//chrome/browser/spellchecker/spellcheck_message_filter.h",
- "//chrome/browser/spellchecker/spellcheck_message_filter_platform.h",
- "//chrome/browser/spellchecker/spellcheck_message_filter_platform_mac.cc",
"//chrome/browser/spellchecker/spellcheck_platform_mac.mm",
"//chrome/browser/spellchecker/spellcheck_service.cc",
"//chrome/browser/spellchecker/spellcheck_service.h",
@@ -84,11 +87,18 @@ source_set("qtwebengine_sources") {
include_dirs += [
"//third_party/WebKit"
]
- deps = [
+ deps += [
"//third_party/icu",
"//third_party/hunspell",
"//chrome/tools/convert_dict"
]
+
+ if (is_mac && use_browser_spellchecker) {
+ sources += [
+ "//chrome/browser/spellchecker/spellcheck_message_filter_platform.h",
+ "//chrome/browser/spellchecker/spellcheck_message_filter_platform_mac.cc",
+ ]
+ }
}
if (enable_basic_printing || enable_print_preview) {
diff --git a/src/tools/qwebengine_convert_dict/qwebengine_convert_dict.pro b/src/tools/qwebengine_convert_dict/qwebengine_convert_dict.pro
index 21add015..7bece36c 100644
--- a/src/tools/qwebengine_convert_dict/qwebengine_convert_dict.pro
+++ b/src/tools/qwebengine_convert_dict/qwebengine_convert_dict.pro
@@ -13,7 +13,12 @@ use?(gn){
isEmpty(NINJA_LFLAGS): error("Missing linker flags from QtWebEngineCore linking pri")
isEmpty(NINJA_ARCHIVES): error("Missing archive files from QtWebEngineCore linking pri")
isEmpty(NINJA_LIBS): error("Missing library files from QtWebEngineCore linking pri")
- linux: LIBS_PRIVATE = $$NINJA_OBJECTS -Wl,-whole-archive $$NINJA_ARCHIVES -Wl,-no-whole-archive
+ OBJECTS = $$eval($$list($$NINJA_OBJECTS))
+ linux {
+ LIBS_PRIVATE = -Wl,--start-group $$NINJA_ARCHIVES -Wl,--end-group
+ } else {
+ LIBS_PRIVATE = $$NINJA_ARCHIVES
+ }
LIBS_PRIVATE += $$NINJA_LIB_DIRS $$NINJA_LIBS
QMAKE_LFLAGS += $$NINJA_LFLAGS
POST_TARGETDEPS += $$NINJA_TARGETDEPS
diff --git a/tools/qmake/mkspecs/features/gn_generator.prf b/tools/qmake/mkspecs/features/gn_generator.prf
index f53132fe..ccc2831a 100644
--- a/tools/qmake/mkspecs/features/gn_generator.prf
+++ b/tools/qmake/mkspecs/features/gn_generator.prf
@@ -10,6 +10,18 @@ defineReplace(getTargetType) {
return("none")
}
+defineReplace(filter_flag_values) {
+ value_to_check = $$1
+ macos:equals(value_to_check, "$(EXPORT_ARCH_ARGS)") {
+ # EXPORT_ARCH_ARGS comes from qtbase/mkspecs/features/mac/default_post.prf which is a way
+ # to figure out the architectures to pass to the compiler at Makefile time. Because this
+ # variable expansion is not supported by GN, we filter it out. GN takes care of assigning
+ # the architecture itself.
+ return("")
+ }
+ return($$value_to_check)
+}
+
isEmpty(GN_FILE): GN_FILE = $$system_path($$_PRO_FILE_PWD_/BUILD.gn)
isEmpty(GN_RUN_BINARY_SCRIPT): GN_RUN_BINARY_SCRIPT = "//build/gn_run_binary.py"
isEmpty(GN_FIND_MOCABLES_SCRIPT): GN_FIND_MOCABLES_SCRIPT = "//build/gn_find_mocables.py"
@@ -106,12 +118,19 @@ for (imp, GN_IMPORTS): GN_CONTENTS += " import(\"$$imp\")"
!isEmpty(QMAKE_CFLAGS) {
GN_CONTENTS += " cflags = ["
- for(flag, QMAKE_CFLAGS): GN_CONTENTS += " \"$$flag\","
+ for(flag, QMAKE_CFLAGS): GN_CONTENTS += " \"$$filter_flag_values($$flag)\","
GN_CONTENTS += " ]"
}
+
+# Stop the barrage of unused variables warnings.
+gcc|clang {
+ QMAKE_CXXFLAGS += "-Wno-unused-parameter"
+ QMAKE_CXXFLAGS += "-Wno-unused-variable"
+}
+
!isEmpty(QMAKE_CXXFLAGS) {
GN_CONTENTS += " cflags_cc = ["
- for(flag, QMAKE_CXXFLAGS): GN_CONTENTS += " \"$$flag\","
+ for(flag, QMAKE_CXXFLAGS): GN_CONTENTS += " \"$$filter_flag_values($$flag)\","
GN_CONTENTS += " ]"
}
@@ -119,7 +138,9 @@ GN_CONTENTS += " if (!defined(defines)) {"\
" defines = []"\
" }"
GN_CONTENTS += " defines += ["
-for (define, DEFINES): GN_CONTENTS += " \"$$define\","
+# Remove single quotes around function macro defines, so that GN doesn't escape them, thus breaking
+# the macro.
+for (define, DEFINES): GN_CONTENTS += " \"$$replace(define,\',)\","
!isEmpty(QMAKE_LIBDIR_EGL):
GN_CONTENTS += " \"QT_LIBDIR_EGL=\\\"$${QMAKE_DIR_SEP}$$relative_path($$QMAKE_LIBDIR_EGL, $$[QT_SYSROOT])\\\"\","
!isEmpty(QMAKE_LIBDIR_OPENGL_ES2)
@@ -147,9 +168,12 @@ GN_CONTENTS += " if (!defined(ldflags)) {"\
" ldflags = []"\
" }"
GN_CONTENTS += " ldflags += ["
-for (flag, QMAKE_LFLAGS): GN_CONTENTS += " \"$$flag\","
+for (flag, QMAKE_LFLAGS): GN_CONTENTS += " \"$$filter_flag_values($$flag)\","
for (flag, GN_FLAGS): GN_CONTENTS += " \"$$flag\","
-!isEmpty(QMAKE_RPATHDIR): GN_CONTENTS += " \"-Wl,-rpath=$${QMAKE_RPATHDIR}\","
+!isEmpty(QMAKE_RPATHDIR) {
+ macos: GN_CONTENTS += " \"-Wl,-rpath,$${QMAKE_RPATHDIR}\","
+ else:unix: GN_CONTENTS += " \"-Wl,-rpath=$${QMAKE_RPATHDIR}\","
+}
!isEmpty(QMAKE_RPATHLINKDIR): GN_CONTENTS += " \"-Wl,-rpath-link=$${QMAKE_RPATHLINKDIR}\","
GN_CONTENTS += " ]"