diff options
Diffstat (limited to 'mkspecs/features')
26 files changed, 476 insertions, 127 deletions
diff --git a/mkspecs/features/data/macros.cpp b/mkspecs/features/data/macros.cpp index 9dcb8f0914..7a06fad1a6 100644 --- a/mkspecs/features/data/macros.cpp +++ b/mkspecs/features/data/macros.cpp @@ -27,3 +27,6 @@ QMAKE_GCC_MAJOR_VERSION = __GNUC__ QMAKE_GCC_MINOR_VERSION = __GNUC_MINOR__ QMAKE_GCC_PATCH_VERSION = __GNUC_PATCHLEVEL__ #endif +#ifdef __ghs__ +QMAKE_GHS_VERSION = __GHS_VERSION_NUMBER +#endif diff --git a/mkspecs/features/default_post.prf b/mkspecs/features/default_post.prf index 9eba5bcf00..ad4a5f6365 100644 --- a/mkspecs/features/default_post.prf +++ b/mkspecs/features/default_post.prf @@ -134,7 +134,7 @@ c++11|c++14|c++1z { isEmpty(QMAKE_CXXFLAGS_GNU$$cxxstd) { strict_c++: QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_STRICTCXX } else { - !strict_c++: cxxstd = GNU$$cxxstd + !strict_c++|isEmpty(QMAKE_CXXFLAGS_$$cxxstd): cxxstd = GNU$$cxxstd } QMAKE_CXXFLAGS += $$eval(QMAKE_CXXFLAGS_$$cxxstd) @@ -143,6 +143,19 @@ c++11|c++14|c++1z { unset(cxxstd) } +c99|c11 { + c11: cstd = C11 + else: cstd = C99 + + !isEmpty(QMAKE_CFLAGS_GNU$$cstd) { + !strict_c|isEmpty(QMAKE_CFLAGS_$$cstd): cstd = GNU$$cstd + } + + QMAKE_CFLAGS += $$eval(QMAKE_CFLAGS_$$cstd) + + unset(cstd) +} + utf8_source { QMAKE_CFLAGS += $$QMAKE_CFLAGS_UTF8_SOURCE QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_UTF8_SOURCE diff --git a/mkspecs/features/exclusive_builds.prf b/mkspecs/features/exclusive_builds.prf index 2d7f0e1ab6..1ff9a04d42 100644 --- a/mkspecs/features/exclusive_builds.prf +++ b/mkspecs/features/exclusive_builds.prf @@ -38,5 +38,5 @@ defineTest(addExclusiveBuilds) { } # Default directories to process -QMAKE_DIR_REPLACE = OBJECTS_DIR MOC_DIR RCC_DIR PRECOMPILED_DIR QGLTF_DIR DESTDIR TRACEGEN_DIR QMLCACHE_DIR -QMAKE_DIR_REPLACE_SANE += QGLTF_DIR TRACEGEN_DIR QMLCACHE_DIR +QMAKE_DIR_REPLACE = OBJECTS_DIR MOC_DIR RCC_DIR PRECOMPILED_DIR QGLTF_DIR DESTDIR TRACEGEN_DIR QMLCACHE_DIR LRELEASE_DIR +QMAKE_DIR_REPLACE_SANE += QGLTF_DIR TRACEGEN_DIR QMLCACHE_DIR LRELEASE_DIR diff --git a/mkspecs/features/gc_binaries.prf b/mkspecs/features/gc_binaries.prf new file mode 100644 index 0000000000..111d5d95ef --- /dev/null +++ b/mkspecs/features/gc_binaries.prf @@ -0,0 +1,3 @@ +QMAKE_CFLAGS += $$QMAKE_CFLAGS_SPLIT_SECTIONS +QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_SPLIT_SECTIONS +QMAKE_LFLAGS += $$QMAKE_LFLAGS_GCSECTIONS diff --git a/mkspecs/features/lrelease.prf b/mkspecs/features/lrelease.prf new file mode 100644 index 0000000000..1e828b64df --- /dev/null +++ b/mkspecs/features/lrelease.prf @@ -0,0 +1,41 @@ +# Automatically generate .qm files out of .ts files in TRANSLATIONS and +# EXTRA_TRANSLATIONS. +# +# If embed_translations is enabled, the generated .qm files are made available +# in the resource system under :/i18n/. +# +# Otherwise, the .qm files are available in the build directory in LRELEASE_DIR. +# They can also be automatically installed by setting QM_FILES_INSTALL_PATH. + +qtPrepareTool(QMAKE_LRELEASE, lrelease) + +isEmpty(LRELEASE_DIR): LRELEASE_DIR = .qm +isEmpty(QM_FILES_RESOURCE_PREFIX): QM_FILES_RESOURCE_PREFIX = i18n + +lrelease.name = lrelease +lrelease.input = TRANSLATIONS EXTRA_TRANSLATIONS +lrelease.output = $$LRELEASE_DIR/${QMAKE_FILE_IN_BASE}.qm +lrelease.commands = $$QMAKE_LRELEASE ${QMAKE_FILE_IN} $$QMAKE_LRELEASE_FLAGS -qm ${QMAKE_FILE_OUT} +silent: lrelease.commands = @echo lrelease ${QMAKE_FILE_IN} && $$lrelease.commands +lrelease.CONFIG = no_link +QMAKE_EXTRA_COMPILERS += lrelease + +all_translations = $$TRANSLATIONS $$EXTRA_TRANSLATIONS +for (translation, all_translations) { + # mirrors $$LRELEASE_DIR/${QMAKE_FILE_IN_BASE}.qm above + translation = $$basename(translation) + QM_FILES += $$OUT_PWD/$$LRELEASE_DIR/$$replace(translation, \\..*$, .qm) +} +embed_translations { + qmake_qm_files.files = $$QM_FILES + qmake_qm_files.base = $$OUT_PWD/$$LRELEASE_DIR + qmake_qm_files.prefix = $$QM_FILES_RESOURCE_PREFIX + RESOURCES += qmake_qm_files +} else { + !isEmpty(QM_FILES_INSTALL_PATH) { + qm_files.files = $$QM_FILES + qm_files.path = $$QM_FILES_INSTALL_PATH + INSTALLS += qm_files + } + lrelease.CONFIG += target_predeps no_clean +} diff --git a/mkspecs/features/qml_module.prf b/mkspecs/features/qml_module.prf index 4db0040dc5..65212b2abf 100644 --- a/mkspecs/features/qml_module.prf +++ b/mkspecs/features/qml_module.prf @@ -31,13 +31,17 @@ qml1_target { instbase = $$[QT_INSTALL_QML] } -!qml1_target:static: CONFIG += builtin_resources +!qml1_target:static: \ + CONFIG += builtin_resources +else: \ + CONFIG += install_qml_files builtin_resources { URITARGET = $$replace(URI, "\\.", "_") - # Ensure the QML files are included in the resources. In static builds, - # the QML engine reads also the qmldir file from the resources. - $${URITARGET}.files = $$qmldir_file $$fq_qml_files + # In static builds, the QML engine reads also the qmldir file from the resources. + static: $${URITARGET}.files = $$qmldir_file + # Ensure the QML files are included in the resources. + $${URITARGET}.files += $$fq_qml_files # qt-project.org/imports is the path used for locating imports inside the resources $${URITARGET}.prefix = /qt-project.org/imports/$$TARGETPATH RESOURCES += $${URITARGET} @@ -47,7 +51,7 @@ builtin_resources { qmldir.base = $$_PRO_FILE_PWD_ # Tools need qmldir and plugins.qmltypes always installed on the file system qmldir.files = $$qmldir_file $$fq_aux_qml_files -!builtin_resources: qmldir.files += $$fq_qml_files +install_qml_files: qmldir.files += $$fq_qml_files qmldir.path = $$instbase/$$TARGETPATH INSTALLS += qmldir diff --git a/mkspecs/features/qml_plugin.prf b/mkspecs/features/qml_plugin.prf index d49f4c49c1..0786dbfd84 100644 --- a/mkspecs/features/qml_plugin.prf +++ b/mkspecs/features/qml_plugin.prf @@ -111,7 +111,7 @@ load(qt_common) load(resolve_target) TARGETPATHBASE = $$replace(TARGETPATH, \\.\\d+\$, ) qmltypes.target = qmltypes - qmltypes.commands = $$QMLPLUGINDUMP -nonrelocatable $$replace(TARGETPATHBASE, /, .) $$IMPORT_VERSION > $$QMLTYPEFILE + qmltypes.commands = $$QMLPLUGINDUMP -nonrelocatable $$QMAKE_QMLPLUGINDUMP_FLAGS $$replace(TARGETPATHBASE, /, .) $$IMPORT_VERSION > $$QMLTYPEFILE qmltypes.depends = $$QMAKE_RESOLVED_TARGET } else { qmltypes.CONFIG += recursive diff --git a/mkspecs/features/qt.prf b/mkspecs/features/qt.prf index b57afcf72d..90e318e2a4 100644 --- a/mkspecs/features/qt.prf +++ b/mkspecs/features/qt.prf @@ -230,7 +230,16 @@ for(ever) { QMAKE_FRAMEWORKPATH *= $$MODULE_FRAMEWORKS !isEmpty(MODULE_MODULE) { contains(MODULE_CONFIG, lib_bundle) { - LIBS$$var_sfx += -framework $$MODULE_MODULE + framework = $$MODULE_MODULE + qtConfig(debug_and_release):!macx-xcode { + platform_target_suffix = $$qtPlatformTargetSuffix() + !isEmpty(platform_target_suffix): \ + # The -framework linker argument supports a name[,suffix] version, + # where if the suffix is specified the framework is first searched + # for the library with the suffix and then without. + framework = $$framework,$$platform_target_suffix + } + LIBS$$var_sfx += -framework $$framework } else { !isEmpty(MODULE_LIBS_ADD): \ LIBS$$var_sfx += -L$$MODULE_LIBS_ADD diff --git a/mkspecs/features/qt_app.prf b/mkspecs/features/qt_app.prf index 883f8ca215..8354f30eea 100644 --- a/mkspecs/features/qt_app.prf +++ b/mkspecs/features/qt_app.prf @@ -20,9 +20,6 @@ isEmpty(QMAKE_TARGET_DESCRIPTION): \ isEmpty(QMAKE_INFO_PLIST): CONFIG -= app_bundle -# This decreases the binary size for tools if statically linked -QMAKE_LFLAGS += $$QMAKE_LFLAGS_GCSECTIONS - host_build: QT -= gui # no host tool will ever use gui host_build:force_bootstrap { !build_pass:qtConfig(release_tools): CONFIG += release diff --git a/mkspecs/features/qt_build_config.prf b/mkspecs/features/qt_build_config.prf index 021036e4f9..0c6c10dded 100644 --- a/mkspecs/features/qt_build_config.prf +++ b/mkspecs/features/qt_build_config.prf @@ -27,6 +27,7 @@ RCC_DIR = .rcc UI_DIR = .uic TRACEGEN_DIR = .tracegen QMLCACHE_DIR = .qmlcache +LRELEASE_DIR = .qm intel_icl { # ICL 14.0 has a bug that makes it not find #includes in dirs starting with . MOC_DIR = tmp/moc diff --git a/mkspecs/features/qt_build_paths.prf b/mkspecs/features/qt_build_paths.prf index 1848f00e90..3bb3823a8e 100644 --- a/mkspecs/features/qt_build_paths.prf +++ b/mkspecs/features/qt_build_paths.prf @@ -12,7 +12,8 @@ # Find the module's source root dir. isEmpty(_QMAKE_CONF_): error("Project has no top-level .qmake.conf file.") MODULE_BASE_INDIR = $$dirname(_QMAKE_CONF_) -MODULE_BASE_OUTDIR = $$shadowed($$MODULE_BASE_INDIR) +REAL_MODULE_BASE_OUTDIR = $$shadowed($$MODULE_BASE_INDIR) +MODULE_BASE_OUTDIR = $$REAL_MODULE_BASE_OUTDIR !isEmpty(MODULE_BASE_DIR): MODULE_SYNCQT_DIR = $$MODULE_BASE_DIR # compat for webkit isEmpty(MODULE_SYNCQT_DIR): MODULE_SYNCQT_DIR = $$MODULE_BASE_INDIR isEmpty(MODULE_QMAKE_OUTDIR): MODULE_QMAKE_OUTDIR = $$MODULE_BASE_OUTDIR diff --git a/mkspecs/features/qt_common.prf b/mkspecs/features/qt_common.prf index 415044bb64..4ad9946ae0 100644 --- a/mkspecs/features/qt_common.prf +++ b/mkspecs/features/qt_common.prf @@ -17,6 +17,8 @@ DEFINES *= QT_NO_NARROWING_CONVERSIONS_IN_CONNECT qtConfig(c++11): CONFIG += c++11 strict_c++ qtConfig(c++14): CONFIG += c++14 qtConfig(c++1z): CONFIG += c++1z +qtConfig(c99): CONFIG += c99 +qtConfig(c11): CONFIG += c11 qtConfig(stack-protector-strong): CONFIG += stack_protector_strong contains(TEMPLATE, .*lib) { # module and plugins @@ -56,19 +58,31 @@ host_build:cross_compile: return() # -Wvla: use of variable-length arrays (an extension to C++) clang { clang_ver = $${QT_CLANG_MAJOR_VERSION}.$${QT_CLANG_MINOR_VERSION} + apple_ver = $${QT_APPLE_CLANG_MAJOR_VERSION}.$${QT_APPLE_CLANG_MINOR_VERSION} versionAtLeast(clang_ver, 3.5): \ QMAKE_CXXFLAGS_WARN_ON += -Wdate-time - # Clang/LLVM 5.0 and Xcode 9.0 introduced unguarded availability warnings. - # The same construct has been a hard error in Swift from the very beginning. - apple_ver = $${QT_APPLE_CLANG_MAJOR_VERSION}.$${QT_APPLE_CLANG_MINOR_VERSION} - darwin:if(versionAtLeast(clang_ver, 5.0)|versionAtLeast(apple_ver, 9.0)): \ + versionAtLeast(clang_ver, 3.6)|versionAtLeast(apple_ver, 6.3): \ + QMAKE_CXXFLAGS_WARN_ON += -Winconsistent-missing-override + + darwin { QMAKE_CXXFLAGS_WARN_ON += \ - -Werror=unguarded-availability \ - -Werror=unguarded-availability-new \ - -Werror=unsupported-availability-guard + -Wobjc-interface-ivars \ + -Wobjc-method-access \ + -Wobjc-multiple-method-names + + # Clang/LLVM 5.0 and Xcode 9.0 introduced unguarded availability warnings. + # The same construct has been a hard error in Swift from the very beginning. + versionAtLeast(clang_ver, 5.0)|versionAtLeast(apple_ver, 9.0): \ + QMAKE_CXXFLAGS_WARN_ON += \ + -Werror=unguarded-availability \ + -Werror=unguarded-availability-new \ + -Werror=unsupported-availability-guard + } } else: gcc:!intel_icc { QMAKE_CXXFLAGS_WARN_ON += -Wvla + # GCC 5 fixed -Wmissing-field-initializers for when there are no initializers + lessThan(QT_GCC_MAJOR_VERSION, 5): QMAKE_CXXFLAGS_WARN_ON += -Wno-missing-field-initializers # GCC 5 introduced -Wdate-time greaterThan(QT_GCC_MAJOR_VERSION, 4): QMAKE_CXXFLAGS_WARN_ON += -Wdate-time # GCC 6 introduced these @@ -82,11 +96,11 @@ warnings_are_errors:warning_clean { # This setting is compiler-dependent anyway because it depends on the version of the # compiler. clang { - # Apple clang 4.0-4.2,5.0-5.1,6.0-6.4,7.0-7.3 + # Apple clang 4.0-4.2,5.0-5.1,6.0-6.4,7.0-7.3,8.0-8.3,9.0-9.2 # Regular clang 3.x-6.0 apple_ver = $${QT_APPLE_CLANG_MAJOR_VERSION}.$${QT_APPLE_CLANG_MINOR_VERSION} reg_ver = $${QT_CLANG_MAJOR_VERSION}.$${QT_CLANG_MINOR_VERSION} - contains(apple_ver, "4\\.[012]|5\\.[01]|6\\.[01234]|7\\.[0123]")|contains(reg_ver, "[345]\\.|6\\.0") { + contains(apple_ver, "4\\.[012]|5\\.[01]|6\\.[01234]|7\\.[0123]|8\\.[0123]|9\\.[012]")|contains(reg_ver, "[345]\\.|6\\.0") { QMAKE_CXXFLAGS_WARN_ON += -Werror -Wno-error=\\$${LITERAL_HASH}warnings -Wno-error=deprecated-declarations $$WERROR } } else:intel_icc:linux { diff --git a/mkspecs/features/qt_configure.prf b/mkspecs/features/qt_configure.prf index 4039bba431..81b820978a 100644 --- a/mkspecs/features/qt_configure.prf +++ b/mkspecs/features/qt_configure.prf @@ -495,6 +495,15 @@ defineTest(qtConfLibrary_inline) { !defined($${1}.libs, var):isEmpty($${1}.builds._KEYS_): \ error("'inline' source in library '$$lib' specifies neither 'libs' nor 'builds'.") + # library lists are specified as strings in the json sources for + # readability, but it's a pain to work with that, so expand it now. + eval($${1}.libs = $$eval($${1}.libs)) + export($${1}.libs) + for (b, $${1}.builds._KEYS_) { + eval($${1}.builds.$${b} = $$eval($${1}.builds.$${b})) + export($${1}.builds.$${b}) + } + # if multiple libraries provide the same export, it makes sense # to make them recognize the same input variables. input = $$eval($${2}.alias) @@ -507,7 +516,7 @@ defineTest(qtConfLibrary_inline) { iv = $${input}.libs.$${b} vars += $$eval(config.commandline.rev_assignments.$${iv}) defined(config.input.$${iv}, var) { - $${1}.builds.$${b} = $$eval(config.input.$${iv}) + eval($${1}.builds.$${b} = $$eval(config.input.$${iv})) export($${1}.builds.$${b}) $${1}.builds._KEYS_ *= $${b} any = true @@ -528,28 +537,28 @@ defineTest(qtConfLibrary_inline) { # direct libs. overwrites inline libs. defined(config.input.$${input}.libs, var) { - $${1}.libs = $$eval(config.input.$${input}.libs) + eval($${1}.libs = $$eval(config.input.$${input}.libs)) export($${1}.libs) } # prefix. prepends to (possibly overwritten) inline libs. - prefix = $$val_escape(config.input.$${input}.prefix) + prefix = $$eval(config.input.$${input}.prefix) !isEmpty(prefix) { $${1}.includedir = $$prefix/include export($${1}.includedir) - $${1}.libs = "-L$$prefix/lib $$eval($${1}.libs)" + $${1}.libs = -L$$prefix/lib $$eval($${1}.libs) export($${1}.libs) } - incdir = $$val_escape(config.input.$${input}.incdir) + incdir = $$eval(config.input.$${input}.incdir) !isEmpty(incdir) { $${1}.includedir = $$incdir export($${1}.includedir) } - libdir = $$val_escape(config.input.$${input}.libdir) + libdir = $$eval(config.input.$${input}.libdir) !isEmpty(libdir) { - $${1}.libs = "-L$$libdir $$eval($${1}.libs)" + $${1}.libs = -L$$libdir $$eval($${1}.libs) export($${1}.libs) } @@ -563,13 +572,12 @@ defineTest(qtConfLibrary_makeSpec) { isEmpty(spec): \ error("makeSpec source in library '$$eval($${1}.library)' does not specify 'spec'.") - $${1}.includedir = "$$val_escape(QMAKE_INCDIR_$$spec)" + $${1}.includedir = $$eval(QMAKE_INCDIR_$$spec) export($${1}.includedir) - libs = + $${1}.libs = for (l, QMAKE_LIBDIR_$$spec): \ - libs += -L$$l - libs += $$eval(QMAKE_LIBS_$$spec) - $${1}.libs = "$$val_escape(libs)" + $${1}.libs += -L$$l + $${1}.libs += $$eval(QMAKE_LIBS_$$spec) export($${1}.libs) # the library definition is always in scope, so no point in exporting it. @@ -596,13 +604,39 @@ defineTest(qtConfLibrary_pkgConfig) { qtRunLoggedCommand("$$pkg_config --modversion $$args", version)|return(false) qtRunLoggedCommand("$$pkg_config --libs-only-L $$args", libpaths)|return(false) qtRunLoggedCommand("$$pkg_config --libs-only-l $$args", libs)|return(false) - qtRunLoggedCommand("$$pkg_config --cflags $$args", $${1}.cflags)|return(false) version ~= s/[^0-9.].*$// $${1}.version = $$first(version) export($${1}.version) - libpaths += $$libs - $${1}.libs = "$$libpaths" + eval($${1}.libs = $$libpaths $$libs) export($${1}.libs) + + qtRunLoggedCommand("$$pkg_config --cflags $$args", $${1}.cflags)|return(false) + # Split CFLAGS into stuff that goes into DEFINES, INCLUDEPATH, and other stuff. + # The compound variable is still set in case something wants to use it outside + # regular library exports. + defines = + includes = + ignored = + eval(cflags = $$eval($${1}.cflags)) + for (i, cflags) { + contains(i, "-I.*") { + i ~= s/^-I// + includes += $$i + } else: contains(i, "-D.*") { + i ~= s/^-D// + defines += $$i + } else { + # Sometimes, pkg-config files include other flags + # we really don't need and shouldn't add. + ignored += $$i + } + } + !isEmpty(ignored): \ + qtLog("Note: Dropped compiler flags '$$ignored'.") + $${1}.defines = $$defines + export($${1}.defines) + $${1}.includedir = $$includes + export($${1}.includedir) return(true) } @@ -624,21 +658,35 @@ defineTest(qtConfTest_getPkgConfigVariable) { } defineReplace(qtConfLibraryArgs) { - qmake_args = - libs = $$eval($${1}.libs) - !isEmpty(libs): \ - qmake_args += $$system_quote(LIBS += $$libs) + NAME = $$upper($$eval($${1}.library)) + qmake_args = "QMAKE_LIBS_$${NAME} = $$val_escape($${1}.libs)" for (b, $${1}.builds._KEYS_): \ - qmake_args += $$system_quote(LIBS_$$upper($$b) += $$eval($${1}.builds.$${b})) + qmake_args += "QMAKE_LIBS_$${NAME}_$$upper($$b) = $$val_escape($${1}.builds.$${b})" includedir = $$eval($${1}.includedir) !isEmpty(includedir): \ - qmake_args += $$system_quote(INCLUDEPATH *= $$includedir) - cflags = $$eval($${1}.cflags) - !isEmpty(cflags): \ - qmake_args += $$system_quote(QMAKE_CFLAGS += $$cflags) $$system_quote(QMAKE_CXXFLAGS += $$cflags) + qmake_args += "QMAKE_INCDIR_$${NAME} = $$val_escape(includedir)" + defines = $$eval($${1}.defines) + !isEmpty(defines): \ + qmake_args += "QMAKE_DEFINES_$${NAME} = $$val_escape(defines)" return($$qmake_args) } +defineReplace(qtConfAllLibraryArgs) { + isEmpty(1): return() + dep_uses = + dep_args = + for (use, 1) { + use_cfg = $$section(use, :, 0, 0) + use_lib = $$section(use, :, 1, 1) + dep_uses += $$use_lib + !isEmpty(use_cfg) { + lpfx = $${use_cfg}.libraries.$$use_lib + dep_args += $$qtConfLibraryArgs($${lpfx}.sources.$$eval($${lpfx}.source)) + } + } + return("QMAKE_USE += $$dep_uses" $$dep_args) +} + defineTest(qtConfExportLibrary) { lpfx = $${currentConfig}.libraries.$$1 alias = $$eval($${lpfx}.alias) @@ -650,38 +698,17 @@ defineTest(qtConfExportLibrary) { !$$qtConfEvaluate($$eval($${spfx}.export)): return() output = privatePro - - eval(libs = $$eval($${spfx}.libs)) - eval(cflags = $$eval($${spfx}.cflags)) - eval(includes = $$eval($${spfx}.includedir)) - - # Split $$cflags into stuff that goes into DEFINES, INCLUDEPATH, and other stuff. - defines = - ignored = - for (i, cflags) { - contains(i, "-I.*") { - i ~= s/^-I// - includes += $$i - } else: contains(i, "-D.*") { - i ~= s/^-D// - defines += $$i - } else { - # Sometimes, pkg-config files or *-config scripts include other flags - # we really don't need and shouldn't add (pg_config is really bad). - ignored += $$i - } - } - !isEmpty(ignored): \ - qtConfAddNote("Dropped compiler flags '$$ignored' when detecting library '$$name'.") - NAME = $$upper($$name) # LIBS is emitted even if empty, as this allows the library to be "seen". + libs = $$eval($${spfx}.libs) qtConfOutputVar(assign, $$output, QMAKE_LIBS_$$NAME, $$libs) for (b, $${spfx}.builds._KEYS_) { - eval(blibs = $$eval($${spfx}.builds.$${b})) + blibs = $$eval($${spfx}.builds.$${b}) qtConfOutputVar(assign, $$output, QMAKE_LIBS_$${NAME}_$$upper($$b), $$blibs) } + defines = $$eval($${spfx}.defines) !isEmpty(defines): qtConfOutputVar(assign, $$output, QMAKE_DEFINES_$$NAME, $$defines) + includes = $$eval($${spfx}.includedir) !isEmpty(includes): qtConfOutputVar(assign, $$output, QMAKE_INCDIR_$$NAME, $$includes) !isEmpty($${currentConfig}.module): \ qtConfExtendVar($$output, "QT.$${currentModule}_private.libraries", $$name) @@ -708,7 +735,7 @@ defineTest(qtConfHandleLibrary) { export($${lpfx}.result) return() } - use_args = $$eval($${lpfx}.literal_args) + resolved_uses = $$eval($${lpfx}.resolved_uses) qtConfLoadResult($${lpfx}, $$1, "library") { $$eval($${lpfx}.result): \ @@ -741,9 +768,12 @@ defineTest(qtConfHandleLibrary) { next() } + $${lpfx}.source = $$s + export($${lpfx}.source) + # if the library defines a test, use it to verify the source. !isEmpty($${lpfx}.test)|!isEmpty($${lpfx}.test._KEYS_) { - $${lpfx}.literal_args = $$qtConfLibraryArgs($$spfx) $$use_args + $${lpfx}.resolved_uses = $$currentConfig:$$1 $$resolved_uses $${lpfx}.host = $$eval($${spfx}.host) !qtConfTest_compile($$lpfx) { qtLog(" => source failed verification.") @@ -759,9 +789,6 @@ defineTest(qtConfHandleLibrary) { for (b, $${spfx}.builds._KEYS_): \ $${lpfx}.cache += sources.$${s}.builds.$${b} - $${lpfx}.source = $$s - export($${lpfx}.source) - # immediately output the library as well. qtConfExportLibrary($$1) @@ -855,21 +882,30 @@ defineTest(qtConfTestPrepare_compile) { !defined(QMAKE_LIBS_$$nu, var): \ error("Test $$1 tries to use undeclared library '$$u'") # using an external library by exported name. - $${1}.literal_args += $$system_quote(QMAKE_USE += $$u) + $${1}.resolved_uses += :$$u } else { lpfx = $${libConfig}.libraries.$${u} - isEmpty($${lpfx}.source): \ + !equals($${lpfx}.result, true): \ return(false) - $${1}.literal_args += $$qtConfLibraryArgs($${lpfx}.sources.$$eval($${lpfx}.source)) + $${1}.resolved_uses += $$libConfig:$$u } } - export($${1}.literal_args) + export($${1}.resolved_uses) return(true) } defineTest(qtConfPrepareCompileTestSource) { test_dir = $$2 + test_lang = $$eval($${1}.lang) + isEmpty(test_lang): test_lang = "c++" + + equals(test_lang, "c++"): suffix = "cpp" + else: equals(test_lang, "c"): suffix = "c" + else: equals(test_lang, "objc"): suffix = "m" + else: equals(test_lang, "objc++"): suffix = "mm" + else: error("Unknown language '$$test_lang' in compile test $$1") + # Create source code contents = "/* Generated by configure */" # Custom code before includes @@ -893,10 +929,10 @@ defineTest(qtConfPrepareCompileTestSource) { " /* END TEST */" \ " return 0;" \ "}" - write_file($$test_dir/main.cpp, contents)|error() + write_file($$test_dir/main.$$suffix, contents)|error() # Create stub .pro file - contents = "SOURCES = main.cpp" + contents = "SOURCES = main.$$suffix" # Custom project code for (ent, $$qtConfScalarOrList($${1}.qmake)): \ contents += $$ent @@ -983,8 +1019,12 @@ defineTest(qtConfTest_compile) { cont = "CONFIG += QTDIR_build" write_file($$test_base_out_dir/.qmake.cache, cont)|error() + $${1}.literal_args += $$qtConfAllLibraryArgs($$eval($${1}.resolved_uses)) + # add possible command line args - qmake_args += $$qtConfPrepareArgs($$eval($${1}.args)) $$eval($${1}.literal_args) + qmake_args += \ + $$qtConfPrepareArgs($$eval($${1}.args)) \ + $$qtSystemQuote($$eval($${1}.literal_args)) qtRunLoggedCommand("$$test_cmd_base $$qmake_args $$system_quote($$test_dir)") { qtRunLoggedCommand("$$test_cmd_base $$QMAKE_MAKE"): \ @@ -994,11 +1034,6 @@ defineTest(qtConfTest_compile) { return(false) } -defineTest(qtConfTest_verifySpec) { - qtConfTest_compile($$1): return(true) - qtConfFatalError("Cannot compile a minimal program. The toolchain or QMakeSpec is broken.", log) -} - defineTest(qtConfTest_files) { for(i, $${1}.files._KEYS_) { f = $$eval($${1}.files.$${i}) diff --git a/mkspecs/features/qt_module.prf b/mkspecs/features/qt_module.prf index 8c7adc45eb..51b5bde67a 100644 --- a/mkspecs/features/qt_module.prf +++ b/mkspecs/features/qt_module.prf @@ -29,8 +29,6 @@ host_build|staticlib: CONFIG += static host_build { QT -= gui # no host module will ever use gui - QMAKE_CFLAGS += $$QMAKE_CFLAGS_SPLIT_SECTIONS - QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_SPLIT_SECTIONS force_bootstrap { !build_pass:qtConfig(release_tools): CONFIG += release contains(QT, core(-private)?|xml) { @@ -266,15 +264,20 @@ load(qt_installs) load(qt_targets) # this builds on top of qt_common -!internal_module:!lib_bundle:if(unix|mingw) { +!internal_module:if(unix|mingw) { CONFIG += create_pc QMAKE_PKGCONFIG_DESTDIR = pkgconfig host_build: \ QMAKE_PKGCONFIG_LIBDIR = $$[QT_HOST_LIBS] else: \ QMAKE_PKGCONFIG_LIBDIR = $$[QT_INSTALL_LIBS/raw] - QMAKE_PKGCONFIG_INCDIR = $$[QT_INSTALL_HEADERS/raw] - QMAKE_PKGCONFIG_CFLAGS = -D$$MODULE_DEFINE -I${includedir}/$$MODULE_INCNAME + lib_bundle { + QMAKE_PKGCONFIG_INCDIR = $$[QT_INSTALL_LIBS/raw]/$${MODULE_INCNAME}.framework/Headers + QMAKE_PKGCONFIG_CFLAGS = -D$$MODULE_DEFINE + } else { + QMAKE_PKGCONFIG_INCDIR = $$[QT_INSTALL_HEADERS/raw] + QMAKE_PKGCONFIG_CFLAGS = -D$$MODULE_DEFINE -I${includedir}/$$MODULE_INCNAME + } QMAKE_PKGCONFIG_NAME = $$replace(TARGET, ^Qt, "Qt$$QT_MAJOR_VERSION ") QMAKE_PKGCONFIG_FILE = $$replace(TARGET, ^Qt, Qt$$QT_MAJOR_VERSION) for(i, MODULE_DEPENDS): \ diff --git a/mkspecs/features/qt_module_headers.prf b/mkspecs/features/qt_module_headers.prf index bbded56b42..70d3520e5c 100644 --- a/mkspecs/features/qt_module_headers.prf +++ b/mkspecs/features/qt_module_headers.prf @@ -123,7 +123,7 @@ MODULE_INC_OUTDIR = $$MODULE_BASE_OUTDIR/include/$$MODULE_INCNAME isEmpty(MODULE_CFG_FILE): MODULE_CFG_FILE = qt$${MODULE}-config exists($$OUT_PWD/$${MODULE_CFG_FILE}.h) { - fwd_rel = $$relative_path($$OUT_PWD, $$MODULE_INC_OUTDIR) + fwd_rel = $$relative_path($$OUT_PWD, $$REAL_MODULE_BASE_OUTDIR) SYNCQT.INJECTIONS += \ $$fwd_rel/$${MODULE_CFG_FILE}.h:$${MODULE_CFG_FILE}.h \ $$fwd_rel/$${MODULE_CFG_FILE}_p.h:$$MODULE_VERSION/$$MODULE_INCNAME/private/$${MODULE_CFG_FILE}_p.h @@ -131,7 +131,7 @@ exists($$OUT_PWD/$${MODULE_CFG_FILE}.h) { for (injection, SYNCQT.INJECTIONS) { injects = $$split(injection, :) - dst_hdr = $$absolute_path($$member(injects, 0), $$MODULE_INC_OUTDIR) + dst_hdr = $$absolute_path($$member(injects, 0), $$REAL_MODULE_BASE_OUTDIR) ofwd_hdr = $$member(injects, 1) fwd_hdr = $$replace(ofwd_hdr, ^\\^, ) MAIN_FWD = $$MODULE_INC_OUTDIR/$$fwd_hdr diff --git a/mkspecs/features/qt_test_helper.prf b/mkspecs/features/qt_test_helper.prf new file mode 100644 index 0000000000..5daa14731d --- /dev/null +++ b/mkspecs/features/qt_test_helper.prf @@ -0,0 +1,35 @@ +# +# W A R N I N G +# ------------- +# +# This file is not part of the Qt API. It exists purely as an +# implementation detail. It may change from version to version +# without notice, or even be removed. +# +# We mean it. +# + +# If an auto test needs a helper application, this helper should +# be put into the same directory as the test itself. This common +# folder should be the test's "main directory" or a "debug" or "release" +# subfolder inside this main directory if debug_and_release is enabled. +# Additionally the helper's executable is suffixed with "_helper" to +# avoid name clashes with its folder. + +CONFIG -= app_bundle +CONFIG += console + +debug_and_release { + CONFIG(debug, debug|release) { + TARGET = ../../debug/$${TARGET}_helper + } else { + TARGET = ../../release/$${TARGET}_helper + } +} else { + TARGET = ../$${TARGET}_helper +} + +parentFolder = $$dirname(_PRO_FILE_PWD_) +testFolder = $$basename(parentFolder) +target.path = $$[QT_INSTALL_TESTS]/$$testFolder +INSTALLS += target diff --git a/mkspecs/features/resources.prf b/mkspecs/features/resources.prf index ff45446219..a25846bd77 100644 --- a/mkspecs/features/resources.prf +++ b/mkspecs/features/resources.prf @@ -72,10 +72,44 @@ for(resource, RESOURCES) { RESOURCES += $$resource_file } +!isEmpty(RESOURCES):contains(TEMPLATE, .*lib):plugin:static { + pluginName = $$lower($$replace(_PRO_FILE_, .*/([^/.]+)\\.[^/.]+, \\1)) + + resource_init_function = $${pluginName}_plugin_resource_init + DEFINES += "QT_PLUGIN_RESOURCE_INIT_FUNCTION=$$resource_init_function" + + RESOURCE_INIT_CPP = $$OUT_PWD/$${pluginName}_plugin_resources.cpp + + GENERATED_SOURCES += $$RESOURCE_INIT_CPP + QMAKE_DISTCLEAN += $$RESOURCE_INIT_CPP + + !build_pass { + RESOURCE_INIT_CONT = \ + "// This file is autogenerated by qmake. It contains a function that" \ + "// references all resources the plugin includes and the function is" \ + "// referenced by Qt_(MOC_)EXPORT_PLUGIN to ensure the inclusion in" \ + "// the statically linked plugin." \ + "$${LITERAL_HASH}include <QtCore/qglobal.h>" \ + "void $${resource_init_function}() " \ + "{" \ + + for (resource, RESOURCES) { + resource_name = $$section($$list($$basename(resource)), ., 0, 0) + resource_name = $$replace(resource_name, [^a-zA-Z0-9_], _) + RESOURCE_INIT_CONT += " Q_INIT_RESOURCE($$resource_name);" + } + + RESOURCE_INIT_CONT += \ + "}" + + write_file($$RESOURCE_INIT_CPP, RESOURCE_INIT_CONT)|error() + } +} + rcc.input = RESOURCES rcc.name = RCC ${QMAKE_FILE_IN} rcc.depend_command = $$QMAKE_RCC_DEP -list $$QMAKE_RESOURCE_FLAGS ${QMAKE_FILE_IN} -rcc.CONFIG += add_inputs_as_makefile_deps +rcc.CONFIG += add_inputs_as_makefile_deps dep_lines !resources_big|ltcg|macx-xcode|contains(TEMPLATE, "vc.*") { diff --git a/mkspecs/features/simd.prf b/mkspecs/features/simd.prf index e4bee7107c..a0b40fcf11 100644 --- a/mkspecs/features/simd.prf +++ b/mkspecs/features/simd.prf @@ -141,6 +141,28 @@ addSimdCompiler(neon) addSimdCompiler(mips_dsp) addSimdCompiler(mips_dspr2) +# Haswell sub-architecture +defineTest(addSimdArch) { + name = arch_$$1 + dependencies = $$2 + upname = $$upper($$name) + + cpu_features_missing = + for(part, dependencies) { + !contains(QT_CPU_FEATURES, $$part): cpu_features_missing = 1 + } + + CONFIG += $$name + isEmpty(cpu_features_missing): QT_CPU_FEATURES += $$name + + export(QT_CPU_FEATURES) + export(CONFIG) + addSimdCompiler($$name) +} + +isEmpty(QMAKE_CFLAGS_ARCH_HASWELL): QMAKE_CFLAGS_ARCH_HASWELL = $$QMAKE_CFLAGS_AVX2 +avx2: addSimdArch(haswell, avx2 bmi bmi2 f16c fma lzcnt popcnt) + # Follow the Intel compiler's lead and define profiles of AVX512 instructions defineTest(addAvx512Profile) { name = $$1 @@ -149,7 +171,7 @@ defineTest(addAvx512Profile) { varname = QMAKE_CFLAGS_$$upname cpu_features_missing = - cflags = $$QMAKE_CFLAGS_AVX512F + cflags = $$QMAKE_CFLAGS_ARCH_HASWELL $$QMAKE_CFLAGS_AVX512F for(part, dependencies) { !CONFIG($$part): return() # Profile isn't supported by the compiler @@ -168,7 +190,4 @@ defineTest(addAvx512Profile) { addSimdCompiler($$name) } addAvx512Profile(avx512common, avx512cd) -addAvx512Profile(avx512mic, avx512cd avx512er avx512pf) addAvx512Profile(avx512core, avx512cd avx512bw avx512dq avx512vl) -addAvx512Profile(avx512ifmavl, avx512ifma avx512vl) -addAvx512Profile(avx512vbmivl, avx512vbmi avx512vl) diff --git a/mkspecs/features/testcase.prf b/mkspecs/features/testcase.prf index 8d51c9d028..79883b7f09 100644 --- a/mkspecs/features/testcase.prf +++ b/mkspecs/features/testcase.prf @@ -9,6 +9,18 @@ testcase_exceptions: CONFIG += exceptions # Set in qt_build_config.prf testcase_no_bundle: CONFIG -= app_bundle +# Allow testcases to mark themselves as not supporting high-DPI +testcase_lowdpi { + macos { + !isEmpty(QMAKE_INFO_PLIST): \ + error("QMAKE_INFO_PLIST already set, can't apply testcase_lowdpi") + + QMAKE_INFO_PLIST = $$QMAKESPEC/Info.plist.disable_highdpi + } else { + # TODO: Add support for other platforms if possible + } +} + benchmark: type = benchmark else: type = check @@ -77,12 +89,11 @@ isEmpty(BUILDS)|build_pass { # Install tests unless no_testcase_installs is set, or there is already # a `target' in INSTALLS. # - # Tests are installed under a directory named after the target so that each - # test has its own directory for testdata etc. + # Tests are installed under a directory named after their source folder + # so that each test has its own directory for testdata etc. # - load(resolve_target) - TARGET_BASENAME = $$basename(QMAKE_RESOLVED_TARGET) - target.path = $$[QT_INSTALL_TESTS]/$$TARGET_BASENAME + TEST_FOLDER = $$basename(_PRO_FILE_PWD_) + target.path = $$[QT_INSTALL_TESTS]/$$TEST_FOLDER INSTALLS += target } @@ -183,20 +194,26 @@ isEmpty(BUILDS)|build_pass { } builtin_testdata { - ALL_TESTDATA = $$TESTDATA $$GENERATED_TESTDATA - - # BLACKLIST needs to be added to the testdata - BLACKLISTPATH = $$_PRO_FILE_PWD_/BLACKLIST - exists($$BLACKLISTPATH): ALL_TESTDATA *= $$BLACKLISTPATH - # RESOURCES does not support wildcards (for good reasons) - for(td, ALL_TESTDATA): \ + for (td, TESTDATA): \ testdata.files += $$files($$absolute_path($$td, $$_PRO_FILE_PWD_)) + # BLACKLIST needs to be added to the testdata + BLACKLISTPATH = $$_PRO_FILE_PWD_/BLACKLIST + exists($$BLACKLISTPATH): \ + testdata.files *= $$BLACKLISTPATH !isEmpty(testdata.files) { testdata.base = $$_PRO_FILE_PWD_ RESOURCES += testdata } + # Extra compilers don't create wildcards to start with. + for (td, GENERATED_TESTDATA): \ + gentestdata.files += $$absolute_path($$td, $$OUT_PWD) + !isEmpty(gentestdata.files) { + gentestdata.base = $$OUT_PWD + RESOURCES += gentestdata + } + !isEmpty(TEST_HELPER_INSTALLS): \ error("This platform does not support tests which require helpers.") } diff --git a/mkspecs/features/toolchain.prf b/mkspecs/features/toolchain.prf index fdf3d1cdd3..4ecfb8d889 100644 --- a/mkspecs/features/toolchain.prf +++ b/mkspecs/features/toolchain.prf @@ -34,7 +34,9 @@ isEmpty($${target_prefix}.INCDIRS) { # # Get default include and library paths from compiler # - gcc { + wasm { + # wasm compiler does not work here, just use defaults + } else: gcc { cmd_suffix = "<$$QMAKE_SYSTEM_NULL_DEVICE >$$QMAKE_SYSTEM_NULL_DEVICE" equals(QMAKE_HOST.os, Windows): \ cmd_prefix = "set LC_ALL=C&" @@ -142,6 +144,29 @@ isEmpty($${target_prefix}.INCDIRS) { !integrity: \ error("failed to parse default search paths from compiler output") QMAKE_DEFAULT_LIBDIRS = $$unique(QMAKE_DEFAULT_LIBDIRS) + } else: ghs { + cmd = $$QMAKE_CXX $$QMAKE_CXXFLAGS -$${LITERAL_HASH} -o /tmp/fake_output /tmp/fake_input.cpp + output = $$system("$$cmd", blob, ec) + !equals(ec, 0): qtCompilerErrror($$QMAKE_CXX, $$output) + output ~= s/\\\\\\n {8}//g + output = $$split(output, $$escape_expand(\\n)) + for (line, output) { + contains(line, "^[^ ]+/ecom[^ ]+ .* /tmp/fake_input\\.cpp") { + for (parameter, $$list($$line)) { + contains(parameter, "^(-I|--include_no_mmd=|--sys_include=).*") { + parameter ~= s/^(-I|--include_no_mmd=|--sys_include=)// + QMAKE_DEFAULT_INCDIRS += $$clean_path($$parameter) + } + } + } else: contains(line, "^[^ ]+/elxr .*") { + for (parameter, $$list($$line)) { + contains(parameter, "^-L.*") { + parameter ~= s/^-L// + QMAKE_DEFAULT_LIBDIRS += $$clean_path($$parameter) + } + } + } + } } else: msvc { # This doesn't differentiate between host and target, # but neither do the compilers. @@ -168,14 +193,14 @@ isEmpty($${target_prefix}.INCDIRS) { # defineReplace(qtVariablesFromMSVC) { - ret = $$system("$$1 -nologo -E $$2 $$system_quote($$PWD/data/macros.cpp) <NUL 2>NUL", lines, ec) + ret = $$system("$$1 -nologo -E $$2 $$system_quote($$PWD/data/macros.cpp) 2>NUL", lines, ec) !equals(ec, 0): qtCompilerErrror($$1, $$ret) return($$ret) } defineReplace(qtVariablesFromGCC) { ret = $$system("$$1 -E $$system_quote($$PWD/data/macros.cpp) \ - <$$QMAKE_SYSTEM_NULL_DEVICE 2>$$QMAKE_SYSTEM_NULL_DEVICE", lines, ec) + 2>$$QMAKE_SYSTEM_NULL_DEVICE", lines, ec) !equals(ec, 0): qtCompilerErrror($$1, $$ret) return($$ret) } @@ -199,11 +224,11 @@ isEmpty($${target_prefix}.COMPILER_MACROS) { } else { vars = $$qtVariablesFromMSVC($$QMAKE_CXX) } - } else: gcc { + } else: gcc|ghs { vars = $$qtVariablesFromGCC($$QMAKE_CXX) } for (v, vars) { - contains(v, $${LITERAL_HASH}.*)|contains(v, " *"): next() + !contains(v, "[A-Z_]+ = .*"): next() # Set both <varname> for the outer scope ... eval($$v) v ~= s/ .*// @@ -245,6 +270,8 @@ QMAKE_COMPILER_DEFINES += __cplusplus=$$QT_COMPILER_STDCXX __GNUC__=$$QMAKE_GCC_MAJOR_VERSION \ __GNUC_MINOR__=$$QMAKE_GCC_MINOR_VERSION \ __GNUC_PATCHLEVEL__=$$QMAKE_GCC_PATCH_VERSION +!isEmpty(QMAKE_GHS_VERSION): \ + QMAKE_COMPILER_DEFINES += __ghs__ __GHS_VERSION_NUMBER=$$QMAKE_GHS_VERSION QMAKE_CFLAGS += $$QMAKE_CFLAGS_MSVC_COMPAT QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_MSVC_COMPAT diff --git a/mkspecs/features/uic.prf b/mkspecs/features/uic.prf index 134d3b4acb..1cedce5ae7 100644 --- a/mkspecs/features/uic.prf +++ b/mkspecs/features/uic.prf @@ -3,15 +3,13 @@ qtPrepareTool(QMAKE_UIC, uic, _DEP) isEmpty(UI_DIR):UI_DIR = . isEmpty(QMAKE_MOD_UIC):QMAKE_MOD_UIC = ui_ -contains(TEMPLATE, .*lib):dll: QMAKE_UIC_FLAGS += -no-stringliteral - uic.depends += $$QMAKE_UIC_EXE uic.commands = $$QMAKE_UIC $$QMAKE_UIC_FLAGS ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT} uic.depend_command = $$QMAKE_UIC_DEP -d ${QMAKE_FILE_IN} uic.output = $$UI_DIR/$${QMAKE_MOD_UIC}${QMAKE_FILE_BASE}$${first(QMAKE_EXT_H)} uic.input = FORMS uic.variable_out = GENERATED_FILES -uic.CONFIG += no_link target_predeps +uic.CONFIG += no_link target_predeps dep_lines uic.name = UIC ${QMAKE_FILE_IN} silent:uic.commands = @echo uic ${QMAKE_FILE_IN} && $$uic.commands QMAKE_EXTRA_COMPILERS += uic diff --git a/mkspecs/features/uikit/default_pre.prf b/mkspecs/features/uikit/default_pre.prf index 6a44a67bca..ea6882fbc8 100644 --- a/mkspecs/features/uikit/default_pre.prf +++ b/mkspecs/features/uikit/default_pre.prf @@ -24,5 +24,3 @@ load(default_pre) !versionAtLeast(QMAKE_XCODE_VERSION, 4.3): \ error("This mkspec requires Xcode 4.3 or later") -ios:shared:!versionAtLeast(QMAKE_IOS_DEPLOYMENT_TARGET, 8.0): \ - QMAKE_IOS_DEPLOYMENT_TARGET = 8.0 diff --git a/mkspecs/features/uikit/gc_binaries.prf b/mkspecs/features/uikit/gc_binaries.prf new file mode 100644 index 0000000000..c4f7445951 --- /dev/null +++ b/mkspecs/features/uikit/gc_binaries.prf @@ -0,0 +1,2 @@ +# bitcode (release mode) is incompatible with splitting sections. +!bitcode|!release: load(gc_binaries) diff --git a/mkspecs/features/unix/separate_debug_info.prf b/mkspecs/features/unix/separate_debug_info.prf index 0b34b17c27..9070cf33f0 100644 --- a/mkspecs/features/unix/separate_debug_info.prf +++ b/mkspecs/features/unix/separate_debug_info.prf @@ -72,10 +72,12 @@ have_target:!static:if(darwin|!isEmpty(QMAKE_OBJCOPY)) { debug_info_plist_target.path += $${target.path}/$${debug_info_target_rel}.$$debug_info_suffix/Contents INSTALLS += debug_info_plist_target - debug_script_target.CONFIG += no_check_exist - debug_script_target.files = $${debug_info_target}.$$debug_info_suffix/Contents/Resources/Python/$${TARGET}.py - debug_script_target.path += $${target.path}/$${debug_info_target_rel}.$$debug_info_suffix/Contents/Resources/Python - INSTALLS += debug_script_target + !isEmpty(debug_script.output) { + debug_script_target.CONFIG += no_check_exist + debug_script_target.files = $${debug_script.output} + debug_script_target.path += $${target.path}/$${debug_info_target_rel}.$$debug_info_suffix/Contents/Resources/Python + INSTALLS += debug_script_target + } } debug_info_target.CONFIG += no_check_exist diff --git a/mkspecs/features/wasm/qt.prf b/mkspecs/features/wasm/qt.prf new file mode 100644 index 0000000000..9b9b58d3de --- /dev/null +++ b/mkspecs/features/wasm/qt.prf @@ -0,0 +1,12 @@ + +qt_depends = $$resolve_depends(QT, "QT.") +equals(TEMPLATE, app):contains(qt_depends, gui(-private)?) { + LIBS *= -L$$[QT_INSTALL_PLUGINS/get]/platforms + + lib_name = wasm + lib_path_and_base = $$[QT_INSTALL_PLUGINS/get]/platforms/lib$${lib_name}$$qtPlatformTargetSuffix() + LIBS += -l$${lib_name}$$qtPlatformTargetSuffix() $$fromfile($${lib_path_and_base}.prl, QMAKE_PRL_LIBS) +} + +load(qt) + diff --git a/mkspecs/features/wasm/wasm.prf b/mkspecs/features/wasm/wasm.prf new file mode 100644 index 0000000000..278a6719c7 --- /dev/null +++ b/mkspecs/features/wasm/wasm.prf @@ -0,0 +1,81 @@ + +# DESTDIR will be empty if not set in the app .pro file; make sure it has a value +isEmpty(DESTDIR): DESTDIR = $$OUT_PWD + +# Create js and wasm files for applications +contains(TEMPLATE, .*app) { + TARGET_BASE = $${TARGET} + TARGET_HTML = $${TARGET}.html + TARGET_JS = $${TARGET}.js + + # Make the emscripten compiler generate a js file + TARGET = $$TARGET_JS + + QMAKE_INCDIR += $$(HOME)/.emscripten_ports/openssl/include + + CONFIG += static + js_file.files = $$TARGET_JS + js_file.path = $$target.path + isEmpty(js_file.path): \ + js_file.path += ./ + INSTALLS += js_file + + # Copy hosting html and javascript to the application build directory. + exists($$[QT_INSTALL_PLUGINS]/platforms/wasm_shell.html) { + # don't pass this until it's installed somewhere + # otherwise makespec test fails during qt configure + WASM_PLUGIN_PATH = $$[QT_INSTALL_PLUGINS]/platforms + } else { + ## internal build. not installed + WASM_PLUGIN_PATH = $$PWD/../../../src/plugins/platforms/wasm + } + + # Copy/Generate main .html file (e.g. myapp.html) from the webassembly_shell.html by + # replacing the app name placeholder with the actual app name. + apphtml.name = application main html file + apphtml.output = $$DESTDIR/$$TARGET_HTML + apphtml.commands = sed -e s/APPNAME/$$TARGET_BASE/g $$WASM_PLUGIN_PATH/wasm_shell.html > $$DESTDIR/$$TARGET_HTML + apphtml.input = $$WASM_PLUGIN_PATH/wasm_shell.html + apphtml.depends = $$apphtml.input + QMAKE_EXTRA_COMPILERS += apphtml + + appjs.name = application qtloader.js + appjs.output = $$DESTDIR/qtloader.js + appjs.commands = $$QMAKE_COPY $$WASM_PLUGIN_PATH/qtloader.js $$DESTDIR + appjs.input = $$WASM_PLUGIN_PATH/qtloader.js + appjs.depends = $$appjs.input + QMAKE_EXTRA_COMPILERS += appjs + + appsvg.name = application qtlogo.svg + appsvg.output = $$DESTDIR/qtlogo.svg + appsvg.commands = $$QMAKE_COPY $$WASM_PLUGIN_PATH/qtlogo.svg $$DESTDIR + appsvg.input = $$WASM_PLUGIN_PATH/qtlogo.svg + appsvg.depends = $$appsvg.input + QMAKE_EXTRA_COMPILERS += appsvg + + QMAKE_EXTRA_TARGETS += apphtml appjs appsvg + POST_TARGETDEPS += apphtml appjs appsvg + + # Add manual target to make "make -B shellfiles" work. + shellfiles.target = shellfiles + shellfiles.depends = apphtml appjs appsvg + QMAKE_EXTRA_TARGETS += shellfiles + + # emscripten ports are linked into the main module (this app), not the Qt + # libs which reference them + qt { + qt_depends = $$resolve_depends(QT, "QT.") + contains(qt_depends, core(-private)?): QMAKE_LFLAGS += \ + $$QMAKE_LIBS_THREAD $$QMAKE_LIBS_ZLIB + contains(qt_depends, gui(-private)?): QMAKE_LFLAGS += \ + $$QMAKE_LIBS_FREETYPE $$QMAKE_LIBS_LIBPNG + } +} + +# Creates the stand-alone version of the library from bitcode +!static:contains(TEMPLATE, .*lib): { + load(resolve_target) + QMAKE_POST_LINK += $$QMAKE_LINK_SHLIB $$QMAKE_RESOLVED_TARGET -o $${QMAKE_RESOLVED_TARGET}.js + + QMAKE_INCDIR += $$(HOME)/.emscripten_ports/openssl/include +} |