summaryrefslogtreecommitdiffstats
path: root/src/buildtools/gn.pro
blob: f66f4bd6847b13ce68d3452ee21c30fa67f5f775 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
TEMPLATE = aux
option(host_build)

!debug_and_release: CONFIG += release

include($$QTWEBENGINE_OUT_ROOT/qtwebengine-config.pri)
QT_FOR_CONFIG += webengine webengine-private

build_pass|!debug_and_release {
    !qtConfig(webengine-system-gn): CONFIG(release, debug|release) {
        buildgn.target = build_gn
        gn_args = $$gnArgs()
        out = $$gnPath()
        !qtConfig(webengine-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)
            win32:isDeveloperBuild() {
              # GN is always built in release mode, which conflicts with incremental linking when
              # doing a developer build of WebEngine.
              gn_args = $$replace(gn_args, "use_incremental_linking=true ", "")
            }

            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
    }
}