summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Klocek <michal.klocek@qt.io>2016-10-21 19:14:16 +0200
committerMichal Klocek <michal.klocek@qt.io>2016-12-08 13:56:12 +0000
commit0c6c48da2ad5c60f5404636290eb82f492c2a1a8 (patch)
tree219a3d6ac11ce07cf3873181fc0b4dd285b52970
parent72242c614378a43c4563c05678d8e46d6fcbaa8d (diff)
Add gn bootstrap to build system
Bootstraps gn wihout rebuild. Change-Id: I09ee4d6b6f458f16f0d9ac18433823153ab75995 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
-rw-r--r--configure.json10
-rw-r--r--configure.pri12
m---------src/3rdparty0
-rw-r--r--src/core/core.pro62
-rw-r--r--src/core/gn_run.pro39
-rw-r--r--src/src.pro56
-rw-r--r--tools/qmake/mkspecs/features/functions.prf19
7 files changed, 143 insertions, 55 deletions
diff --git a/configure.json b/configure.json
index 66d568de9..a6aae977a 100644
--- a/configure.json
+++ b/configure.json
@@ -12,6 +12,10 @@
"ninja": {
"label": "system ninja",
"type": "detectNinja"
+ },
+ "gn": {
+ "label": "system gn",
+ "type": "detectGn"
}
},
@@ -31,6 +35,11 @@
"label": "Using system ninja",
"condition": "tests.ninja",
"output": [ "privateFeature" ]
+ },
+ "system-gn": {
+ "label": "Using system gn",
+ "condition": "tests.gn",
+ "output": [ "privateFeature" ]
}
},
@@ -40,6 +49,7 @@
"entries": [
"proprietary-codecs",
"spellchecker",
+ "system-gn",
"system-ninja"
]
}
diff --git a/configure.pri b/configure.pri
index dee7847b7..e3200120f 100644
--- a/configure.pri
+++ b/configure.pri
@@ -10,3 +10,15 @@ defineTest(qtConfTest_detectNinja) {
qtLog("Building own ninja")
return(false)
}
+
+defineTest(qtConfTest_detectGn) {
+ gn = $$qtConfFindInPath("gn")
+ !isEmpty(gn) {
+ qtRunLoggedCommand("$$gn --version", version)|return(false)
+ #accept all for now
+ contains(version, ".*"): return(true)
+ qtLog("Gn version too old")
+ }
+ qtLog("Building own gn")
+ return(false)
+}
diff --git a/src/3rdparty b/src/3rdparty
-Subproject 93b3786290ac16c95f15c95e2c2f3d8254171ab
+Subproject 804dc2f5ec4adf6467357919a5187400d7be7f7
diff --git a/src/core/core.pro b/src/core/core.pro
index a205d39a0..86fe838cb 100644
--- a/src/core/core.pro
+++ b/src/core/core.pro
@@ -3,39 +3,43 @@ TEMPLATE = subdirs
# core_headers is a dummy module to syncqt the headers so we can
# use them by later targets
core_headers.file = core_headers.pro
-
-# core_gyp_generator.pro is a dummy .pro file that is used by qmake
-# to generate our main .gyp file
-core_gyp_generator.file = core_gyp_generator.pro
-core_gyp_generator.depends = core_headers
-
-# gyp_run.pro calls gyp through gyp_qtwebengine on the qmake step, and ninja on the make step.
-gyp_run.file = gyp_run.pro
-gyp_run.depends = core_gyp_generator
-
core_api.file = api/core_api.pro
-core_api.depends = gyp_run
# This will take the compile output of ninja, and link+deploy the final binary.
core_module.file = core_module.pro
core_module.depends = core_api
-SUBDIRS += core_headers \
- core_gyp_generator
-
-!win32 {
- # gyp_configure_host.pro and gyp_configure_target.pro are phony pro files that
- # extract things like compiler and linker from qmake
- # Do not use them on Windows, where Qt already expects the toolchain to be
- # selected through environment varibles.
- gyp_configure_host.file = gyp_configure_host.pro
- gyp_configure_target.file = gyp_configure_target.pro
- gyp_configure_target.depends = gyp_configure_host
-
- gyp_run.depends += gyp_configure_host gyp_configure_target
- SUBDIRS += gyp_configure_host gyp_configure_target
+contains(WEBENGINE_CONFIG, use_gn) {
+ gn_run.file = gn_run.pro
+ SUBDIRS += gn_run
+} else {
+
+ # core_gyp_generator.pro is a dummy .pro file that is used by qmake
+ # to generate our main .gyp file
+ core_gyp_generator.file = core_gyp_generator.pro
+ core_gyp_generator.depends = core_headers
+
+ # gyp_run.pro calls gyp through gyp_qtwebengine on the qmake step, and ninja on the make step.
+ gyp_run.file = gyp_run.pro
+ gyp_run.depends = core_gyp_generator
+ core_api.depends = gyp_run
+
+ SUBDIRS += gyp_run \
+ core_api \
+ core_module \
+ core_headers \
+ core_gyp_generator
+
+ !win32 {
+ # gyp_configure_host.pro and gyp_configure_target.pro are phony pro files that
+ # extract things like compiler and linker from qmake
+ # Do not use them on Windows, where Qt already expects the toolchain to be
+ # selected through environment varibles.
+ gyp_configure_host.file = gyp_configure_host.pro
+ gyp_configure_target.file = gyp_configure_target.pro
+ gyp_configure_target.depends = gyp_configure_host
+
+ gyp_run.depends += gyp_configure_host gyp_configure_target
+ SUBDIRS += gyp_configure_host gyp_configure_target
+ }
}
-
-SUBDIRS += gyp_run \
- core_api \
- core_module
diff --git a/src/core/gn_run.pro b/src/core/gn_run.pro
new file mode 100644
index 000000000..c379f9510
--- /dev/null
+++ b/src/core/gn_run.pro
@@ -0,0 +1,39 @@
+isQtMinimum(5, 8) {
+ include($$QTWEBENGINE_OUT_ROOT/qtwebengine-config.pri)
+ QT_FOR_CONFIG += webengine-private
+}
+
+TEMPLATE = aux
+
+build_pass|!debug_and_release {
+
+ ninja_binary = ninja
+ runninja.target = run_ninja
+
+ !qtConfig(system-ninja) {
+ ninja_binary = $$shell_quote($$shell_path($$ninjaPath()))
+ buildninja.target = build_ninja
+ buildninja.commands = $$buildNinja()
+ QMAKE_EXTRA_TARGETS += buildninja
+ runninja.depends = buildninja
+ }
+
+ !qtConfig(system-gn) {
+ buildgn.target = build_gn
+ buildgn.commands = $$buildGn()
+ !qtConfig(system-ninja): buildgn.depends = buildninja
+ QMAKE_EXTRA_TARGETS += buildgn
+ runninja.depends = buildgn
+ }
+
+ runninja.commands = $$ninja_binary \$\(NINJAFLAGS\) -C $$shell_quote($$OUT_PWD/$$getConfigDir())
+ QMAKE_EXTRA_TARGETS += runninja
+
+ default_target.depends = buildgn
+
+ QMAKE_EXTRA_TARGETS += default_target
+} else {
+ # Special GNU make target for the meta Makefile that ensures that our debug and release Makefiles won't both run ninja in parallel.
+ notParallel.target = .NOTPARALLEL
+ QMAKE_EXTRA_TARGETS += notParallel
+}
diff --git a/src/src.pro b/src/src.pro
index 9b5373181..3f793474f 100644
--- a/src/src.pro
+++ b/src/src.pro
@@ -7,33 +7,37 @@ webengine_plugin.subdir = webengine/plugin
webengine_plugin.target = sub-webengine-plugin
webengine_plugin.depends = webengine
-SUBDIRS += core \
- process \
- webengine \
- webengine_plugin \
- plugins
+SUBDIRS += core
-# allow only desktop builds of qwebengine_convert_dict
-contains(WEBENGINE_CONFIG, use_spellchecker):!contains(WEBENGINE_CONFIG, use_native_spellchecker):!cross_compile {
- SUBDIRS += qwebengine_convert_dict
- qwebengine_convert_dict.subdir = tools/qwebengine_convert_dict
- qwebengine_convert_dict.depends = core
-}
+!contains(WEBENGINE_CONFIG, use_gn) {
+ SUBDIRS += process \
+ webengine \
+ webengine_plugin \
+ plugins
-isQMLTestSupportApiEnabled() {
- webengine_testsupport_plugin.subdir = webengine/plugin/testsupport
- webengine_testsupport_plugin.target = sub-webengine-testsupport-plugin
- webengine_testsupport_plugin.depends = webengine
- SUBDIRS += webengine_testsupport_plugin
-}
-# FIXME: We probably want a bit more control over config options to tweak what to build/ship or not.
-# Another example of where this could be necessary is to make it easy to build proprietery codecs support.
-!contains(WEBENGINE_CONFIG, no_ui_delegates) {
- SUBDIRS += webengine/ui \
- webengine/ui2
-}
-qtHaveModule(widgets) {
- SUBDIRS += webenginewidgets
- plugins.depends = webenginewidgets
+ # allow only desktop builds of qwebengine_convert_dict
+ contains(WEBENGINE_CONFIG, use_spellchecker):!contains(WEBENGINE_CONFIG, use_native_spellchecker):!cross_compile {
+ SUBDIRS += qwebengine_convert_dict
+ qwebengine_convert_dict.subdir = tools/qwebengine_convert_dict
+ qwebengine_convert_dict.depends = core
+ }
+
+ isQMLTestSupportApiEnabled() {
+ webengine_testsupport_plugin.subdir = webengine/plugin/testsupport
+ webengine_testsupport_plugin.target = sub-webengine-testsupport-plugin
+ webengine_testsupport_plugin.depends = webengine
+ SUBDIRS += webengine_testsupport_plugin
+ }
+
+ # FIXME: We probably want a bit more control over config options to tweak what to build/ship or not.
+ # Another example of where this could be necessary is to make it easy to build proprietery codecs support.
+ !contains(WEBENGINE_CONFIG, no_ui_delegates) {
+ SUBDIRS += webengine/ui \
+ webengine/ui2
+ }
+ qtHaveModule(widgets) {
+ SUBDIRS += webenginewidgets
+ plugins.depends = webenginewidgets
+ }
}
diff --git a/tools/qmake/mkspecs/features/functions.prf b/tools/qmake/mkspecs/features/functions.prf
index 8191f7589..22ce695de 100644
--- a/tools/qmake/mkspecs/features/functions.prf
+++ b/tools/qmake/mkspecs/features/functions.prf
@@ -386,6 +386,25 @@ defineReplace(buildNinja) {
}
}
+defineReplace(gnPath) {
+ src_3rd_party_dir = $$absolute_path("$${getChromiumSrcDir()}/../", "$$QTWEBENGINE_ROOT")
+ out = $$shadowed($$absolute_path(chromium/tools/gn/gn, $$src_3rd_party_dir))
+ win32: out = $${out}.exe
+ return($$out)
+}
+
+defineReplace(buildGn) {
+ out = $$gnPath()
+ !qtConfig(system-ninja): ninja_path = "--path $$ninjaPath()"
+ # check if it is not already build
+ !exists($$out) {
+ mkpath($$dirname(out))
+ src_3rd_party_dir = $$absolute_path("$${getChromiumSrcDir()}/../", "$$QTWEBENGINE_ROOT")
+ gn_configure = $$system_path($$absolute_path(chromium/tools/gn/bootstrap/bootstrap.py, $$src_3rd_party_dir))
+ system("cd $$system_quote($$system_path($$dirname(out))) && python $$system_quote($$gn_configure) --no-rebuild $$ninja_path")
+ }
+}
+
defineTest(skipBuild) {
skipBuildReason = "$$skipBuildReason $${EOL}$$1"
export(skipBuildReason)