diff options
author | Michal Klocek <michal.klocek@qt.io> | 2022-04-26 21:18:44 +0200 |
---|---|---|
committer | Michal Klocek <michal.klocek@qt.io> | 2022-05-05 10:03:34 +0200 |
commit | 06fc47309609b9be735817da4f3bdf2e30e0b99c (patch) | |
tree | c5b798ff3bc07a3c631b7aa66bea9d088cb73c5b /src/core | |
parent | 8a52dee5ab480eef88b95361cf4db2ce36374c69 (diff) |
Add support for universal builds for qtwebengine and qtpdf
As 5.15 is in maintenance mode add basic support for
universal build without doing major refactors.
The popper implementation should unify build layout instead
of adding "isUniversal()" hacks.
Add intermediate build files per architecture for Chromium build part
and lipo them before final module linking.
Task-number: QTBUG-85279
Change-Id: Iebfd7a277b23c1b10c8719041c5959fd9d5e2f06
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/api/core_api.pro | 7 | ||||
-rw-r--r-- | src/core/core.pro | 6 | ||||
-rw-r--r-- | src/core/core_chromium.pri | 10 | ||||
-rw-r--r-- | src/core/core_gn_config.pri | 10 | ||||
-rw-r--r-- | src/core/core_lipo.pro | 9 | ||||
-rw-r--r-- | src/core/core_module.pro | 14 | ||||
-rw-r--r-- | src/core/gn_run.pro | 41 |
7 files changed, 75 insertions, 22 deletions
diff --git a/src/core/api/core_api.pro b/src/core/api/core_api.pro index 2ddd0d69f..28d5586ba 100644 --- a/src/core/api/core_api.pro +++ b/src/core/api/core_api.pro @@ -23,7 +23,12 @@ DEFINES += \ NOMINMAX CHROMIUM_SRC_DIR = $$QTWEBENGINE_ROOT/$$getChromiumSrcDir() -CHROMIUM_GEN_DIR = $$OUT_PWD/../$$getConfigDir()/gen + +isUniversal() { + CHROMIUM_GEN_DIR = $$OUT_PWD/../$$QT_ARCH/$$getConfigDir()/gen +} else { + CHROMIUM_GEN_DIR = $$OUT_PWD/../$$getConfigDir()/gen +} INCLUDEPATH += $$QTWEBENGINE_ROOT/src/core \ $$CHROMIUM_GEN_DIR \ $$CHROMIUM_SRC_DIR/third_party/abseil-cpp \ diff --git a/src/core/core.pro b/src/core/core.pro index f2d3fd307..fa1d7f6a7 100644 --- a/src/core/core.pro +++ b/src/core/core.pro @@ -7,9 +7,13 @@ TEMPLATE = subdirs core_headers.file = core_headers.pro core_api.file = api/core_api.pro +core_lipo.file = core_lipo.pro +core_lipo.depends = gn_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 +isUniversal(): core_module.depends += core_lipo core_generator.file = core_generator.pro core_generator.depends = core_headers @@ -44,5 +48,7 @@ core_project.depends = gn_run core_api \ core_module + isUniversal(): SUBDIRS += core_lipo + false: SUBDIRS += core_project } diff --git a/src/core/core_chromium.pri b/src/core/core_chromium.pri index e978d20a1..a846f2fbc 100644 --- a/src/core/core_chromium.pri +++ b/src/core/core_chromium.pri @@ -21,9 +21,13 @@ DEFINES += QT_NO_KEYWORDS \ BUILDING_CHROMIUM # Ensure that response files, generated by qtbase/mkspecs/features/moc.prf, are found by moc. -MOC_DIR = $$OUT_PWD/$$getConfigDir()/.moc -RCC_DIR = $$OUT_PWD/$$getConfigDir()/.rcc - +isUniversal() { + MOC_DIR = $$OUT_PWD/$$QT_ARCH/$$getConfigDir()/.moc + RCC_DIR = $$OUT_PWD/$$QT_ARCH/$$getConfigDir()/.rcc +} else { + MOC_DIR = $$OUT_PWD/$$getConfigDir()/.moc + RCC_DIR = $$OUT_PWD/$$getConfigDir()/.rcc +} # Assume that we want mobile touch and low-end hardware behaviors # whenever we are cross compiling. qtConfig(webengine-embedded-build): DEFINES += QTWEBENGINE_EMBEDDED_SWITCHES diff --git a/src/core/core_gn_config.pri b/src/core/core_gn_config.pri index 2b8f2e18f..379bbac94 100644 --- a/src/core/core_gn_config.pri +++ b/src/core/core_gn_config.pri @@ -1,10 +1,16 @@ CONFIG = gn_generator $$CONFIG GN_SRC_DIR = $$PWD -GN_FILE = $$OUT_PWD/$$getConfigDir()/BUILD.gn +isUniversal() { + for(arch, QT_ARCHS) { + GN_FILES += $$OUT_PWD/$$arch/$$getConfigDir()/BUILD.gn + } +} else { + GN_FILES = $$OUT_PWD/$$getConfigDir()/BUILD.gn +} GN_FIND_MOCABLES_SCRIPT = $$shell_path($$QTWEBENGINE_ROOT/tools/scripts/gn_find_mocables.py) GN_RUN_BINARY_SCRIPT = $$shell_path($$QTWEBENGINE_ROOT/tools/scripts/gn_run_binary.py) GN_IMPORTS = $$PWD/qtwebengine.gni -qtConfig (webengine-extensions) { +qtConfig(webengine-extensions) { GN_INCLUDES += $$PWD/qtwebengine_sources.gni $$PWD/qtwebengine_resources.gni $$PWD/common/extensions/api/qtwebengine_extensions_features.gni } else { GN_INCLUDES = $$PWD/qtwebengine_sources.gni $$PWD/qtwebengine_resources.gni diff --git a/src/core/core_lipo.pro b/src/core/core_lipo.pro new file mode 100644 index 000000000..41846b7f2 --- /dev/null +++ b/src/core/core_lipo.pro @@ -0,0 +1,9 @@ +TEMPLATE = aux + +qtConfig(debug_and_release): CONFIG += debug_and_release +qtConfig(build_all): CONFIG += build_all + +TARGET= QtWebEngineCore +include($${QTWEBENGINE_ROOT}/src/buildtools/config/lipo.pri) + + diff --git a/src/core/core_module.pro b/src/core/core_module.pro index 520b452f7..9e087c815 100644 --- a/src/core/core_module.pro +++ b/src/core/core_module.pro @@ -1,7 +1,11 @@ MODULE = webenginecore include(core_common.pri) -include($${QTWEBENGINE_ROOT}/src/buildtools/config/linking.pri) +isUniversal() { + include($${QTWEBENGINE_ROOT}/src/buildtools/config/lipo_linking.pri) +} else { + include($${QTWEBENGINE_ROOT}/src/buildtools/config/linking.pri) +} api_library_name = qtwebenginecoreapi$$qtPlatformTargetSuffix() api_library_path = $$OUT_PWD/api/$$getConfigDir() @@ -49,7 +53,11 @@ linux { qtConfig(separate_debug_info): QMAKE_POST_LINK="cd $(DESTDIR) && $(STRIP) --strip-unneeded $(TARGET)" } -REPACK_DIR = $$OUT_PWD/$$getConfigDir() +isUniversal() { + REPACK_DIR = $$OUT_PWD/$$QT_ARCH/$$getConfigDir() +} else { + REPACK_DIR = $$OUT_PWD/$$getConfigDir() +} # 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 @@ -61,7 +69,7 @@ resources.files = $$REPACK_DIR/qtwebengine_resources.pak \ $$REPACK_DIR/qtwebengine_resources_200p.pak \ $$REPACK_DIR/qtwebengine_devtools_resources.pak -icu.files = $$OUT_PWD/$$getConfigDir()/icudtl.dat +icu.files = $$REPACK_DIR/icudtl.dat !qtConfig(debug_and_release)|!qtConfig(build_all)|CONFIG(release, debug|release) { qtConfig(framework) { diff --git a/src/core/gn_run.pro b/src/core/gn_run.pro index 3d6fda80e..9072f2847 100644 --- a/src/core/gn_run.pro +++ b/src/core/gn_run.pro @@ -28,36 +28,51 @@ build_pass|!debug_and_release { gn_binary = gn runninja.target = run_ninja + QMAKE_EXTRA_TARGETS += runninja gn_args = $$gnWebEngineArgs() - gn_args += "qtwebengine_target=\"$$system_path($$OUT_PWD/$$getConfigDir()):QtWebEngineCore\"" !qtConfig(webengine-system-gn) { gn_binary = $$system_quote($$system_path($$gnPath())) } - gn_args = $$system_quote($$gn_args) gn_src_root = $$system_quote($$system_path($$QTWEBENGINE_ROOT/$$getChromiumSrcDir())) - gn_build_root = $$system_quote($$system_path($$OUT_PWD/$$getConfigDir())) gn_python = "--script-executable=$$pythonPathForSystem()" - 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!") - } ninjaflags = $$(NINJAFLAGS) isEmpty(ninjaflags):!silent: ninjaflags = "-v" - - runninja.commands = $$NINJA $$ninjaflags \$\(NINJAJOBS\) -C $$gn_build_root QtWebEngineCore - QMAKE_EXTRA_TARGETS += runninja - build_pass:build_all: default_target.target = all else: default_target.target = first default_target.depends = runninja QMAKE_EXTRA_TARGETS += default_target + + isUniversal(){ + for(arch, QT_ARCHS) { + gn_target = "qtwebengine_target=\"$$system_path($$OUT_PWD/$$arch/$$getConfigDir()):QtWebEngineCore\"" + gn_args_per_arch = $$system_quote($$gn_args $$gn_target target_cpu=\"$$gnArch($$arch)\") + gn_build_root = $$system_quote($$system_path($$OUT_PWD/$$arch/$$getConfigDir())) + gn_run = $$gn_binary gen $$gn_build_root $$gn_python --args=$$gn_args_per_arch --root=$$gn_src_root + message("Running for $$arch: $$gn_run") + !system($$gn_run) { + error("GN run error for $$arch!") + } + runninja_$${arch}.target = run_ninja_$${arch} + runninja_$${arch}.commands = $$NINJA $$ninjaflags \$\(NINJAJOBS\) -C $$gn_build_root QtWebEngineCore + QMAKE_EXTRA_TARGETS += runninja_$${arch} + runninja.depends += runninja_$${arch} + } + } else { + gn_args+= "qtwebengine_target=\"$$system_path($$OUT_PWD/$$getConfigDir()):QtWebEngineCore\"" + gn_args = $$system_quote($$gn_args) + gn_build_root = $$system_quote($$system_path($$OUT_PWD/$$getConfigDir())) + gn_run = $$gn_binary gen $$gn_build_root $$gn_python --args=$$gn_args --root=$$gn_src_root + message("Running: $$gn_run for $$arch") + !system($$gn_run) { + error("GN run error!") + } + runninja.commands = $$NINJA $$ninjaflags \$\(NINJAJOBS\) -C $$gn_build_root QtWebEngineCore + } } !build_pass:debug_and_release { |