diff options
-rw-r--r-- | src/buildtools/buildtools.pro | 14 | ||||
-rw-r--r-- | src/buildtools/configure_host.pro | 48 | ||||
-rw-r--r-- | src/buildtools/configure_target.pro | 29 | ||||
-rw-r--r-- | src/buildtools/gn.pro | 2 | ||||
-rw-r--r-- | src/core/config/embedded_linux.pri | 5 | ||||
-rw-r--r-- | src/core/config/linux.pri | 79 | ||||
-rw-r--r-- | src/core/core_generator.pro | 2 | ||||
-rw-r--r-- | tools/qmake/mkspecs/features/configure.prf | 3 | ||||
-rw-r--r-- | tools/qmake/mkspecs/features/functions.prf | 19 |
9 files changed, 170 insertions, 31 deletions
diff --git a/src/buildtools/buildtools.pro b/src/buildtools/buildtools.pro index 4ca21768e..bbf8bd610 100644 --- a/src/buildtools/buildtools.pro +++ b/src/buildtools/buildtools.pro @@ -8,3 +8,17 @@ use?(gn) { gn.depends = ninja SUBDIRS += gn } + +linux { + # configure_host.pro and configure_target.pro are phony pro files that + # extract things like compiler and linker from qmake. + # Only used on Linux as it is only important for cross-building and alternative compilers. + configure_host.file = configure_host.pro + configure_target.file = configure_target.pro + configure_target.depends = configure_host + + use?(gn) { + gn.depends += configure_target + } + SUBDIRS += configure_host configure_target +} diff --git a/src/buildtools/configure_host.pro b/src/buildtools/configure_host.pro new file mode 100644 index 000000000..217fad775 --- /dev/null +++ b/src/buildtools/configure_host.pro @@ -0,0 +1,48 @@ +# Prevent generating a makefile that attempts to create a lib +TEMPLATE = aux + +# Pick up the host toolchain +option(host_build) + +GN_TARGET_CPU = $$gnArch($$QT_ARCH) +GN_CPU = $$gnArch($$QMAKE_HOST.arch) +GN_OS = $$gnOS() + +clang: GN_CLANG = true +else: GN_CLANG = false + +# We always use the gcc_toolchain, because clang_toolchain is just +# a broken wrapper around it for Google's custom clang binaries. +GN_CONTENTS = \ +"import(\"//build/config/sysroot.gni\")" \ +"import(\"//build/toolchain/gcc_toolchain.gni\")" \ +"gcc_toolchain(\"host\") {" \ +" cc = \"$$which($$QMAKE_CC)\" " \ +" cxx = \"$$which($$QMAKE_CXX)\" " \ +" ld = \"$$which($$QMAKE_LINK)\" " \ +" ar = \"$$which(ar)\" " \ +" nm = \"$$which(nm)\" " \ +" toolchain_args = { " \ +" current_os = \"$$GN_OS\" " \ +" current_cpu = \"$$GN_CPU\" " \ +" } " \ +"}" \ +"gcc_toolchain(\"v8_snapshot\") {" \ +" cc = \"$$which($$QMAKE_CC)\" " \ +" cxx = \"$$which($$QMAKE_CXX)\" " \ +" ld = \"$$which($$QMAKE_LINK)\" " \ +" ar = \"$$which(ar)\" " \ +" nm = \"$$which(nm)\" " \ +" toolchain_args = { " \ +" current_os = \"$$GN_OS\" " \ +" current_cpu = \"$$GN_CPU\" " \ +" v8_current_cpu = \"$$GN_TARGET_CPU\" " \ +" } " \ +"}" + + + +GN_FILE = $$OUT_PWD/../toolchain/BUILD.gn +!build_pass { + write_file($$GN_FILE, GN_CONTENTS) +} diff --git a/src/buildtools/configure_target.pro b/src/buildtools/configure_target.pro new file mode 100644 index 000000000..ab30570e0 --- /dev/null +++ b/src/buildtools/configure_target.pro @@ -0,0 +1,29 @@ +# Prevent generating a makefile that attempts to create a lib +TEMPLATE = aux + +GN_CPU = $$gnArch($$QT_ARCH) +GN_OS = $$gnOS() + +clang: GN_CLANG = true +else: GN_CLANG = false + +# We always use the gcc_toolchain, because clang_toolchain is just +# a broken wrapper around it for Google's custom clang binaries. +GN_CONTENTS = \ +"gcc_toolchain(\"target\") {" \ +" cc = \"$$which($$QMAKE_CC)\" " \ +" cxx = \"$$which($$QMAKE_CXX)\" " \ +" ld = \"$$which($$QMAKE_LINK)\" " \ +" ar = \"$$which($${CROSS_COMPILE}ar)\" " \ +" nm = \"$$which($${CROSS_COMPILE}nm)\" " \ +" toolchain_args = { " \ +" current_os = \"$$GN_OS\" " \ +" current_cpu = \"$$GN_CPU\" " \ +" is_clang = $$GN_CLANG " \ +" } " \ +"}" + +GN_FILE = $$OUT_PWD/../toolchain/BUILD.gn +!build_pass { + write_file($$GN_FILE, GN_CONTENTS, append) +} diff --git a/src/buildtools/gn.pro b/src/buildtools/gn.pro index e9383bc3f..092888e0e 100644 --- a/src/buildtools/gn.pro +++ b/src/buildtools/gn.pro @@ -1,6 +1,8 @@ TEMPLATE = aux CONFIG += release +option(host_build) + defineReplace(buildGn) { gn_args = $$1 out = $$gnPath() diff --git a/src/core/config/embedded_linux.pri b/src/core/config/embedded_linux.pri index 853be7be9..89c9672e9 100644 --- a/src/core/config/embedded_linux.pri +++ b/src/core/config/embedded_linux.pri @@ -18,6 +18,11 @@ use?(gn) { use?(icecc) { gn_args += use_debug_fission=false } + + cross_compile:!host_build { + TOOLCHAIN_SYSROOT = $$[QT_SYSROOT] + !isEmpty(TOOLCHAIN_SYSROOT): gn_args += target_sysroot=\"$${TOOLCHAIN_SYSROOT}\" + } } GYP_CONFIG += \ diff --git a/src/core/config/linux.pri b/src/core/config/linux.pri index 4854fae0d..7b8af34b0 100644 --- a/src/core/config/linux.pri +++ b/src/core/config/linux.pri @@ -22,36 +22,59 @@ use?(gn) { } gcc:!clang: greaterThan(QT_GCC_MAJOR_VERSION, 5): gn_args += no_delete_null_pointer_checks=true - - qtConfig(system-zlib): use?(system_minizip): gn_args += use_system_zlib=true use_system_minizip=true - qtConfig(system-png): gn_args += use_system_libpng=true - qtConfig(system-jpeg): gn_args += use_system_libjpeg=true - use?(system_harfbuzz): gn_args += use_system_harfbuzz=true - !use?(glib): gn_args += use_glib=false - qtConfig(pulseaudio) { - gn_args += use_pulseaudio=true - } else { - gn_args += use_pulseaudio=false - } - qtConfig(alsa) { - gn_args += use_alsa=true + host_build { + gn_args += custom_toolchain=\"$$QTWEBENGINE_OUT_ROOT/src/toolchain:host\" + # Don't bother trying to use system libraries in this case + gn_args += use_glib=false + gn_args += use_system_libffi=false } else { - gn_args += use_alsa=false - } - packagesExist(libffi): gn_args += use_system_libffi=true - else: gn_args += use_system_libffi=false + gn_args += custom_toolchain=\"$$QTWEBENGINE_OUT_ROOT/src/toolchain:target\" + cross_compile { + # FIXME: Try enabling snapshot again + gn_args += v8_use_snapshot=false + gn_args += host_toolchain=\"$$QTWEBENGINE_OUT_ROOT/src/toolchain:host\" + gn_args += v8_snapshot_toolchain=\"$$QTWEBENGINE_OUT_ROOT/src/toolchain:v8_snapshot\" + GN_HOST_CPU = $$gnArch($$QMAKE_HOST.arch) + GN_TARGET_CPU = $$gnArch($$QT_ARCH) + gn_args += host_cpu=\"$$GN_HOST_CPU\" target_cpu=\"$$GN_TARGET_CPU\" + } + !contains(QT_CONFIG, no-pkg-config) { + # Strip '>2 /dev/null' from $$pkgConfigExecutable() + PKGCONFIG = $$first($$list($$pkgConfigExecutable())) + gn_args += pkg_config=\"$$PKGCONFIG\" + } + + qtConfig(system-zlib): use?(system_minizip): gn_args += use_system_zlib=true use_system_minizip=true + qtConfig(system-png): gn_args += use_system_libpng=true + qtConfig(system-jpeg): gn_args += use_system_libjpeg=true + use?(system_harfbuzz): gn_args += use_system_harfbuzz=true + !use?(glib): gn_args += use_glib=false + qtConfig(pulseaudio) { + gn_args += use_pulseaudio=true + } else { + gn_args += use_pulseaudio=false + } + qtConfig(alsa) { + gn_args += use_alsa=true + } else { + gn_args += use_alsa=false + } + packagesExist(libffi): gn_args += use_system_libffi=true + else: gn_args += use_system_libffi=false + !packagesExist(libpci): gn_args += use_libpci=false - use?(system_libevent): gn_args += use_system_libevent=true - use?(system_libwebp): gn_args += use_system_libwebp=true - #use?(system_libsrtp): gn_args += use_system_libsrtp=true - use?(system_libxslt): gn_args += use_system_libxml=true use_system_libxslt=true - #use?(system_jsoncpp): gn_args += use_system_jsoncpp=true - #use?(system_opus): gn_args += use_system_opus=true - use?(system_snappy): gn_args += use_system_snappy=true - #use?(system_vpx): gn_args += use_system_libvpx=true - #use?(system_icu): gn_args += use_system_icu=true icu_use_data_file=false - #use?(system_ffmpeg): gn_args += use_system_ffmpeg=true - #use?(system_protobuf): gn_args += use_system_protobuf=true + use?(system_libevent): gn_args += use_system_libevent=true + use?(system_libwebp): gn_args += use_system_libwebp=true + #use?(system_libsrtp): gn_args += use_system_libsrtp=true + use?(system_libxslt): gn_args += use_system_libxml=true use_system_libxslt=true + #use?(system_jsoncpp): gn_args += use_system_jsoncpp=true + #use?(system_opus): gn_args += use_system_opus=true + use?(system_snappy): gn_args += use_system_snappy=true + #use?(system_vpx): gn_args += use_system_libvpx=true + #use?(system_icu): gn_args += use_system_icu=true icu_use_data_file=false + #use?(system_ffmpeg): gn_args += use_system_ffmpeg=true + #use?(system_protobuf): gn_args += use_system_protobuf=true + } } # linux_use_bundled_gold currently relies on a hardcoded relative path from chromium/src/out/(Release|Debug) diff --git a/src/core/core_generator.pro b/src/core/core_generator.pro index 9ea3f7246..c99e10ef8 100644 --- a/src/core/core_generator.pro +++ b/src/core/core_generator.pro @@ -40,7 +40,7 @@ RCC_DIR = $$OUT_PWD/$$getConfigDir()/.rcc # Assume that we want mobile touch and low-end hardware behaviors # whenever we are cross compiling. -cross_compile: DEFINES += QTWEBENGINE_EMBEDDED_SWITCHES +contains(WEBENGINE_CONFIG, embedded_build): DEFINES += QTWEBENGINE_EMBEDDED_SWITCHES qtConfig(egl): CONFIG += egl diff --git a/tools/qmake/mkspecs/features/configure.prf b/tools/qmake/mkspecs/features/configure.prf index b17626c3e..f12bf5ae9 100644 --- a/tools/qmake/mkspecs/features/configure.prf +++ b/tools/qmake/mkspecs/features/configure.prf @@ -35,7 +35,7 @@ defineTest(runConfigure) { } isQtMinimum(5, 9) { qtConfig(appstore-compliant): WEBENGINE_CONFIG += use_appstore_compliant_code - linux: !cross_compile: WEBENGINE_CONFIG += use_gn + linux: WEBENGINE_CONFIG += use_gn macos: WEBENGINE_CONFIG += use_gn win32: WEBENGINE_CONFIG += use_gn } @@ -57,7 +57,6 @@ defineTest(runConfigure) { packagesExist("\'glib-2.0 >= 2.32.0\'"): WEBENGINE_CONFIG += use_glib else: skipBuild("System glib is too old (min. version 2.32).$${EOL}") } - !contains(WEBENGINE_CONFIG, embedded_build): REQUIRED_PACKAGES += libpci for(package, $$list($$REQUIRED_PACKAGES)) { !packagesExist($$package):skipBuild("Unmet dependency: $$package") diff --git a/tools/qmake/mkspecs/features/functions.prf b/tools/qmake/mkspecs/features/functions.prf index 6ef87f867..5e294b96b 100644 --- a/tools/qmake/mkspecs/features/functions.prf +++ b/tools/qmake/mkspecs/features/functions.prf @@ -411,6 +411,25 @@ defineReplace(gnArgs) { return($$gn_args) } +defineReplace(gnArch) { + qtArch = $$1 + contains(qtArch, "i386"): return(x86) + contains(qtArch, "x86_64"): return(x64) + contains(qtArch, "arm"): return(arm) + contains(qtArch, "arm64"): return(arm64) + contains(qtArch, "mips"): return(mipsel) + contains(qtArch, "mips64"): return(mips64el) + return(unknown) +} + +defineReplace(gnOS) { + macos: return(mac) + win32: return(win) + linux: return(linux) + error(Unsupported platform) + return(unknown) +} + defineTest(skipBuild) { skipBuildReason = "$$skipBuildReason $${EOL}$$1" export(skipBuildReason) |