Commit 9df14dff authored by Michal Klocek's avatar Michal Klocek Committed by Alexandru Croitor
Browse files

Clean "system" calls to build&run gn and ninja


There was a time when gn build was called during make step,
however this was not working with recursive qmake calls.
Clean up leftovers and fix path and warnings like
"Conditional must expand to exactly one word." during builds.

Change-Id: I8546520345a5f89ee829558fa0fd9183587848b3
Reviewed-by: default avatarJoerg Bornemann <joerg.bornemann@qt.io>
Showing with 46 additions and 60 deletions
TEMPLATE = aux TEMPLATE = aux
CONFIG += release
option(host_build) option(host_build)
defineReplace(buildGn) { !debug_and_release: CONFIG += release
gn_args = $$1
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_bootstrap = $$system_path($$absolute_path(chromium/tools/gn/bootstrap/bootstrap.py, $$src_3rd_party_dir))
gn_args = $$system_quote($$gn_args)
gn_configure = $$system_quote($$gn_bootstrap) --shadow --gn-gen-args=$$gn_args $$ninja_path
!system("cd $$system_quote($$system_path($$dirname(out))) && $$pythonPathForSystem() $$gn_configure") {
error("GN build error!")
}
}
}
isQtMinimum(5, 8) { isQtMinimum(5, 8) {
include($$QTWEBENGINE_OUT_ROOT/qtwebengine-config.pri) include($$QTWEBENGINE_OUT_ROOT/qtwebengine-config.pri)
QT_FOR_CONFIG += webengine-private QT_FOR_CONFIG += webengine-private
} }
!qtConfig(system-gn) { build_pass|!debug_and_release {
buildgn.target = build_gn !qtConfig(system-gn): CONFIG(release, debug|release) {
buildgn.commands = $$buildGn($$gnArgs()) buildgn.target = build_gn
QMAKE_EXTRA_TARGETS += buildgn gn_args = $$gnArgs()
out = $$gnPath()
default_target.target = first !qtConfig(system-ninja): ninja_path = "--path $$ninjaPath()"
default_target.depends = buildgn # check if it is not already build
QMAKE_EXTRA_TARGETS += default_target !exists($$out) {
mkpath($$dirname(out))
src_3rd_party_dir = $$absolute_path("$${getChromiumSrcDir()}/../", "$$QTWEBENGINE_ROOT")
gn_bootstrap = $$system_path($$absolute_path(chromium/tools/gn/bootstrap/bootstrap.py, $$src_3rd_party_dir))
gn_args = $$system_quote($$gn_args)
gn_configure = $$system_quote($$gn_bootstrap) --shadow --gn-gen-args=$$gn_args $$ninja_path
!system("cd $$system_quote($$system_path($$dirname(out))) && $$pythonPathForSystem() $$gn_configure") {
error("GN build error!")
}
}
QMAKE_DISTCLEAN += $$out
}
} }
TEMPLATE = aux TEMPLATE = aux
CONFIG += release
defineReplace(buildNinja) { !debug_and_release: CONFIG += release
out = $$ninjaPath()
# check if it is not already build
!exists($$out) {
mkpath($$dirname(out))
src_3rd_party_dir = $$absolute_path("$${getChromiumSrcDir()}/../", "$$QTWEBENGINE_ROOT")
ninja_configure = $$system_quote($$system_path($$absolute_path(ninja/configure.py, $$src_3rd_party_dir)))
!system("cd $$system_quote($$system_path($$dirname(out))) && $$pythonPathForSystem() $$ninja_configure --bootstrap") {
error("NINJA build error!")
}
}
}
isQtMinimum(5, 8) { isQtMinimum(5, 8) {
include($$QTWEBENGINE_OUT_ROOT/qtwebengine-config.pri) include($$QTWEBENGINE_OUT_ROOT/qtwebengine-config.pri)
QT_FOR_CONFIG += webengine-private QT_FOR_CONFIG += webengine-private
} }
!qtConfig(system-ninja) { build_pass|!debug_and_release {
buildninja.target = build_ninja !qtConfig(system-ninja): CONFIG(release, debug|release) {
buildninja.commands = $$buildNinja() out = $$ninjaPath()
QMAKE_EXTRA_TARGETS += buildninja # check if it is not already build
!exists($$out) {
default_target.target = first mkpath($$dirname(out))
default_target.depends = buildninja src_3rd_party_dir = $$absolute_path("$${getChromiumSrcDir()}/../", "$$QTWEBENGINE_ROOT")
QMAKE_EXTRA_TARGETS += default_target ninja_configure = $$system_quote($$system_path($$absolute_path(ninja/configure.py, $$src_3rd_party_dir)))
!system("cd $$system_quote($$system_path($$dirname(out))) && $$pythonPathForSystem() $$ninja_configure --bootstrap") {
error("NINJA build error!")
}
}
QMAKE_DISTCLEAN += $$out
}
} }
...@@ -5,13 +5,6 @@ isQtMinimum(5, 8) { ...@@ -5,13 +5,6 @@ isQtMinimum(5, 8) {
TEMPLATE = aux TEMPLATE = aux
defineReplace(runGn) {
message("Running: $$1")
!system($$1) {
error("GN run error!")
}
}
qtConfig(debug_and_release): CONFIG += debug_and_release build_all qtConfig(debug_and_release): CONFIG += debug_and_release build_all
qtConfig(system-ninja) { qtConfig(system-ninja) {
...@@ -42,17 +35,22 @@ build_pass|!debug_and_release { ...@@ -42,17 +35,22 @@ build_pass|!debug_and_release {
gn_args += is_debug=false gn_args += is_debug=false
} }
gn_args += "qtwebengine_target=\"$$shell_path($$OUT_PWD/$$getConfigDir()):QtWebEngineCore\"" gn_args += "qtwebengine_target=\"$$system_path($$OUT_PWD/$$getConfigDir()):QtWebEngineCore\""
!qtConfig(system-gn) { !qtConfig(system-gn) {
gn_binary = $$shell_quote($$shell_path($$gnPath())) gn_binary = $$system_quote($$system_path($$gnPath()))
} }
gn_args = $$shell_quote($$gn_args) gn_args = $$system_quote($$gn_args)
gn_src_root = $$shell_quote($$shell_path($$QTWEBENGINE_ROOT/$$getChromiumSrcDir())) gn_src_root = $$system_quote($$system_path($$QTWEBENGINE_ROOT/$$getChromiumSrcDir()))
gn_build_root = $$shell_quote($$shell_path($$OUT_PWD/$$getConfigDir())) gn_build_root = $$system_quote($$system_path($$OUT_PWD/$$getConfigDir()))
gn_python = "--script-executable=$$pythonPathForSystem()" gn_python = "--script-executable=$$pythonPathForSystem()"
$$runGn($$gn_binary gen $$gn_build_root $$gn_python --args=$$gn_args --root=$$gn_src_root) gn_run = $$gn_binary gen $$gn_build_root $$gn_python --args=$$gn_args --root=$$gn_src_root
message("Running: $$gn_run ")
!system($$gn_run) {
error("GN run error!")
}
runninja.commands = $$NINJA \$\(NINJAFLAGS\) -C $$gn_build_root QtWebEngineCore runninja.commands = $$NINJA \$\(NINJAFLAGS\) -C $$gn_build_root QtWebEngineCore
QMAKE_EXTRA_TARGETS += runninja QMAKE_EXTRA_TARGETS += runninja
......
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