Commit Graph

43 Commits

Author SHA1 Message Date
Tor Arne Vestbø
9082cc8e8d macOS: Don't hard-code x86_64 as the architecture when using qmake
The qmake variable QMAKE_APPLE_DEVICE_ARCHS was added for iOS,
to support universal builds, as the QT_ARCH is a single value.

Since the qmake macOS builds are non-universal (at the moment),
we remove the hard-coded value for QMAKE_APPLE_DEVICE_ARCHS on
macOS, and let the normal architecture test resolve the arch,
like on other platforms.

To ensure that the following configuration tests are run with
an -arch argument, we trigger a commit of the preliminary Qt
configuration after running the architecture test. This is not
strictly necessary, but makes it clearer what's going on during
configure.

The device_and_simulator configuration option was used by the
iOS toolchain, and needed to be moved up in the configuration
test order to not break later tests.

The logic in mac/default_post.prf for both Xcode and Makefiles
to add -arch flags was kept as is, based on the existing
variable, to avoid too many changes to this logic.

The logic in toolchain.prf was amended to make it clear and
ensure that it only applies to iOS builds. macOS builds do
not have this issue.

Pick-to: 6.0
Pick-to: 5.15
Pick-to: 5.12
Change-Id: I70db7e4c27f0d3da5d0af33cb491d72c312d3fa8
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-12-07 15:35:55 +01:00
Oliver Wolff
04e0306520 toolchain.prf: Use vswhere to obtain VS installation path
Beginning with Visual Studio 2017, vswhere should be used to discover
Visual Studio installations. Installations of 2019 and up are not even
registered inside the registry anymore, so vswhere is the only way to
obtain information about these.

Pick-to: 5.15
Task-number: QTVSADDINBUG-819
Change-Id: Ibd8b2c4d38c7925857887f39e750e87a33f08bf9
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-10-27 07:16:05 +01:00
Tor Arne Vestbø
ac43986aa5 Pass -arch when running toolchain configure test on Apple platforms
Clang doesn't automatically switch architecture just because we're
passing an iPhoneOS sysroot. In the past this resulted in a warning
about trying to link an x86_64 binary to arm64 libraries, but with
Xcode 12 this is now a hard error.

Fixes: QTBUG-86718
Pick-to: 5.15
Pick-to: 5.12
Change-Id: I7e9d2ca513d276029fc2a6cfe694a35fe41c39b3
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-09-21 14:51:33 +00:00
Oliver Wolff
45b0f1be68 Remove winrt
Macros and the await helper function from qfunctions_winrt(_p).h are
needed in other Qt modules which use UWP APIs on desktop windows.

Task-number: QTBUG-84434
Change-Id: Ice09c11436ad151c17bdccd2c7defadd08c13925
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-06-06 20:25:49 +02:00
Michal Klocek
d479c6db2c Override debug generation request on mac for toolchain.prf
Override request for debug info during compiler 'test',
otherwise call to dsymutil will fail call with /dev/null.

Use case here is to pass for example -glldb with CXXFLAGS.

Fixes: QTBUG-62953
Fixes: QTBUG-84467
Pick-to: 5.15
Change-Id: Ief8f987afb40d0b90da732195d67d476e7bb3aff
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-05-28 18:40:57 +00:00
Martin Storsjö
65a33d73ea qmake: Always split QMAKE_DEFAULT_LIBDIRS using ; with clang on windows
When building in a unix style build system (i.e. msys), QMAKE_DIRLIST_SEP
is a colon, not a semicolon. Thus, always split the incoming string
(after the fixup regex) using semicolons on windows.

This matches the code for gcc, further up, which does:

    equals(QMAKE_HOST.os, Windows): \
        paths = $$split(line, ;)
    else: \
        paths = $$split(line, $$QMAKE_DIRLIST_SEP)

Change-Id: I6a0175f9d14ae9ca188553483b7868f0549c784a
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2019-04-25 09:29:23 +00:00
Eric Lemanissier
fd88c152db configure: use proper separator for mingw libraries
Change-Id: Ic328691fe2f08e918c1bb67910521d85b274a8fd
Fixes: QTBUG-73466
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2019-02-12 05:48:58 +00:00
Oswald Buddenhagen
45e4dfb449 qmake: rewrite msvc/nmake cross-build environment setup
rather than reproducing vcvarsall.bat's functionality as hard-wired code
in the nmake generator, just invoke the actual script from
toolchain.prf. this is much easier, more future proof, and - critically
- makes the detected variables available to configure's new library &
header search facilities.

[ChangeLog][Important Behavior Changes][qmake][WinRT] Cross-builds will
now ignore pre-set values of %INCLUDE% and %LIB% when building target
executables. If necessary, use configure's -I and -L switches when
building Qt, and pass QMAKE_INCDIR and QMAKE_LIBDIR on qmake's command
line when building own projects.

Change-Id: I36f53e8880d6523f3f6f7a44d40d87d04bd06854
Reviewed-by: Thomas Miller <thomaslmiller91@gmail.com>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2019-01-05 20:33:24 +00:00
Oswald Buddenhagen
ef14c3dc1a qmake: reshuffle toolchain.prf
swap the order of compiler version detection and default path detection.
this keeps a subsequent commit smaller, which introduces a dependency
between the two.

Change-Id: I2d4cbee1fd3555411c18833bbee0201c994a9942
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2019-01-05 20:33:14 +00:00
Oswald Buddenhagen
49c8595bf8 qmake: fix typo in function name
Change-Id: Ie88ae0f13be83d6e63078eeb359d9ddf012c94fb
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2018-12-20 21:01:11 +00:00
Friedemann Kleint
a8cb177d31 Fix build with win32-clang-msvc and win32-icc
fbbe8aba9d introduced a check for
MSVC_VER to qmake, which is not set in win32-clang-msvc,
causing the build to fail:

Mkspec does not specify MSVC_VER. Cannot continue.
Unable to generate output for: .../config.tests/verifyspec/Makefile

Extract a minimal msvc-based-version.conf which determines
MSVC_VER from QMAKE_MSC_VER for win32-clang-msvc and win32-icc.

Task-number: QTBUG-63512
Change-Id: Ia6de8c4b1aae2ae1962cf4e60e3e6d51fdbbbabe
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2018-12-14 18:20:26 +00:00
Oswald Buddenhagen
852b1afa56 qmake: don't misuse cache()
... when QMAKE_DEFAULT_{INC,LIB}DIRS cannot be determined.

it would have been nicer to actually persist empty results, but cache()
won't do that, and fixing it doesn't seem worth the effort now.

Change-Id: I95d5645e40a0da572f0def16462703373eaeb804
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2018-12-14 17:57:20 +00:00
Oswald Buddenhagen
74cdd89e0f qmake: don't assign fallbacks for QMAKE_DEFAULT_{INC,LIB}DIRS in x-builds
these cannot be possibly correct, and might mislead.

Change-Id: Ie10531807978def04768e2429304949415cafb2a
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2018-12-14 17:57:11 +00:00
Oswald Buddenhagen
d941ebc150 qmake: fix QMAKE_DEFAULT_LIBDIRS detection for android on windows
clearly, nobody told clang that on windows you're supposed to use
semicolons instead of colons to separate elements of a path list ...

Fixes: QTBUG-72268
Change-Id: Ia7adc8de3bca586d4c15b069cb04e4cb647ae823
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2018-12-07 23:47:45 +00:00
Oswald Buddenhagen
46a2b44b2b qmake: fix QMAKE_DEFAULT_LIBDIRS detection on android
amazingly enough, android has different sysroots for the compiler
(shared includes full of #ifdefs) and the linker (per-platform
libraries).

this patch supports only clang for non-darwin, which notably covers all
supported android ndks.

with this fixed, we also remove the hard-coded setting of
QMAKE_DEFAULT_*DIRS from the specs.

amends 353fb118c.

Change-Id: Ie0513de0f7123d7f5b8ca1ffcc72c017cddd126c
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2018-12-03 11:25:47 +00:00
Morten Johan Sørvig
29c0377f07 WebAssembly for QtBase
This is the squashed diff from wip/webassembly to dev.

Done-with: Peng Wu <peng.wu@intopalo.com>
Done-with: Sami Enne <sami.enne@intopalo.com>
Done-with: Morten Johan Sørvig <morten.sorvig@qt.io>
Started-by: Andrew Knight <andrew.knight@intopalo.com>
Change-Id: I6562433c0a38d6ec49ab675e0f104f2665f3392d
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2018-08-30 06:48:33 +00:00
Oswald Buddenhagen
89f2a731cf qmake: add default path and version detection for ghs toolchain
Change-Id: Ic35f3e25078909e212864218835663989f647aae
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Nikola Velinov <nvelinov@ghs.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2018-08-17 15:07:00 +00:00
Oswald Buddenhagen
32b4cb1b54 qmake: remove pointless input redirections from compiler calls
Change-Id: I1b5d2b33ec62d24f1d6a9bd155bf3f28ab8bbf4e
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2018-08-17 15:06:53 +00:00
Oswald Buddenhagen
7830cdd833 configure: during early setup, skip all of default_pre.prf
... instead of only toolchain.prf.
the license check could go haywire, and everything else that file does
is meaningless in configure context anyway.

Task-number: QTBUG-63452
Change-Id: I5e31c87fe717fda40978c0317556070637e537e2
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2017-12-14 18:06:07 +00:00
Oswald Buddenhagen
fb326ae126 qmake: print compiler output if detection phase fails
helps enormously with debugging.

Change-Id: Ic8876e74a4dbb14006d8b48658eb141a3f0e0fbf
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-12-14 18:05:53 +00:00
Orgad Shaneh
5fa6438633 Qmake: Introduce and use QMAKE_{SYSTEM,SHELL}_NULL_DEVICE variable, take 2
SYSTEM is used for system() calls, while SHELL is used in the target
Makefiles.

Task-number: QTBUG-62985
Change-Id: Ia75d3939c59c98699359421166433e8b4a6ee35e
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-10-13 13:32:36 +00:00
Tony Sarajärvi
06cb408979 Add support for ICC in toolchain.prf
Task-number: QTBUG-62531
Change-Id: Ie15a349c830258058d48c9da18b52b343bdb943a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-09-29 03:19:57 +00:00
Robert Loehning
2d7b143085 Fix conditions in some QMAKE_COMPILER_DEFINES assignments
We obviously should check the variable we're about to get the data from.

Amends 1216f596bd.

Change-Id: Ibe87138b9c9aa99837b4fbf3769cd26ca1aaacb9
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2017-09-15 09:03:12 +00:00
Oswald Buddenhagen
49cb039a5c make compiler invocation error messages mention host/target
it's unclear where to look for the error when the message talks about
'g++' when '${CROSS_COMPILE}g++' would have been expected. help it by
saying whether it was supposed to be the host or target compiler.

this also centralizes the error emissions in a function.

Change-Id: I454c6ff7c0e7dd945dcee0de01e2818caeeb7409
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2017-08-11 06:38:56 +00:00
Tor Arne Vestbø
16799ba394 Only try to resolve library paths via linker for Drawin clang
Task-number: QTBUG-61735
Change-Id: Ia8e777928aa0cff44f092968eac14d32501a5d73
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-07-08 16:59:07 +00:00
Giuseppe D'Angelo
353fb118c3 Fix detection of QMAKE_DEFAULT_LIBDIRS with Clang under Linux
With 4183475080, Qt fails to build if
qmake is unable to detect the compiler's default include and
library search paths. Clang on non-Darwin systems was missing working
code for the detection.

Unlike GCC, Clang on its own does not print the library search paths
when called with the -v option.

On Darwin, the -Wl,-v option will reach ld64, which will print those paths.
However, neither GNU ld nor gold will print anything useful with just
-v. GNU ld has a --verbose option that does print some search paths, but
those are not the ones used when ld is invoked (via collect2) by GCC or
Clang, so it can't be used.

To make Clang print its library search paths one can use
-print-search-dirs, which however doesn't print include search paths. So
amend the existing code in order to make a second call to clang on
non-Darwin systems. This second call is used for library path detection,
and fixes the build on non-Darwin (tested on Linux).

Change-Id: Ic858f908ee1a2e0eb307abb074daee0ded38abd5
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-07-07 16:23:46 +00:00
Oswald Buddenhagen
23e2cc38ff fix QMAKE_DEFAULT_INCDIRS detection with Xcode targeting uikit platforms
uikit/sdk.prf replaces QMAKE_MAC_SDK_PATH with a make expansion of that
variable, which of course does not work when we use the contents
directly.

amends 6d5489f5d.

Task-number: QTBUG-61690
Change-Id: Id77dff8ee7d737dd35f74cc7d39faaa50b4b1ab9
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2017-07-02 15:38:32 +00:00
James McDonnell
b2ec7317c8 Add query of default include/library paths for QNX
Change-Id: Iafc5a573a2ddb277d2a786cb6b48521985defe44
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-06-29 14:13:04 +00:00
Tor Arne Vestbø
4183475080 Error out when compiler is unable to produce default include/library paths
Adds a bit of extra safeguard to ensure we don't accidentally fall into
the generic unix isEmpty(QMAKE_DEFAULT_{INC,LIB}DIRS) code-paths.

Change-Id: Id760b32cd29cb2b9db1390c174e1637e2dddaabc
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-06-25 22:01:21 +00:00
Oswald Buddenhagen
76223ecbaa complain when toolchain.prf fails to run the compiler
Task-number: QTBUG-60059
Change-Id: I2babe8aaf7cdf5912686f679d14bebc82231a846
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2017-06-12 09:55:32 +00:00
Oswald Buddenhagen
1216f596bd make qconfig.pri export QT_<compiler>_VERSION variables again
... and rename those determined by toolchain.prf to QMAKE_* (this was
already the case for the newly introduced msvc and icc variables).

this restores the ability for user projects to query the toolchain qt
itself was built with, which is necessary for compatibility checks.
in fact, we may do such validation in toolchain.prf itself at a later
point.

Change-Id: I35f4c393c5e4e0fe987c0844714b7a8f8687c24e
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2017-06-12 09:55:26 +00:00
Tor Arne Vestbø
3702b3f68b Pick up default library paths for clang
We need to actually run the linker, otherwise clang will just
run the preprocessing step as we asked for. We build as a shared
library to not have to provide a main() function.

Change-Id: Ied34757bb5c43a862bf2d9778340c497b93d572f
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-06-09 00:09:33 +00:00
Thiago Macieira
a03390a8b0 Detect the (stated) C++ standard edition at build time
The configure-time detection (cxx11default) isn't enough if the compiler
can be changed. This is especially necessary if Qt is compiled with a
compiler that defaults to >= C++11 (e.g., GCC 6) and then the user
selects a compiler another compiler (e.g., Clang) via -spec option. In
that case, we'd miss adding the -std=c++11 or -std=gnu++11 option to the
command-line, causing the compilation to fail.

As a nice side-effect, even moc without moc_predefs.h will now get the
__cplusplus setting.

Task-number: QTBUG-58321
Change-Id: I74966ed02f674a7295f8fffd14a8be35da9640e1
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-03-31 21:08:32 +00:00
Jake Petroules
6d5489f5df Apple: fix QMAKE_DEFAULT_INCDIRS so compiler invocations use the sysroot
The compiler command line used to populate QMAKE_DEFAULT_INCDIRS must
include the sysroot in order to generate the correct paths list.

This fixes a regression introduced in afd8263 which in turn attempted to
fix an earlier regression making it impossible to override the
deployment target in user project files.

Task-number: QTBUG-58325
Change-Id: I93e6b7ef90b2744dd2f03c77da31c692cb194976
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-01-26 20:10:27 +00:00
Oswald Buddenhagen
6b8666c7f2 don't separate host and target toolchain when not x-building
there isn't a point to determining the values separately if they are
actually the same things.

Change-Id: I74cd2bf39e96d559630709559602c234c38b0c47
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2017-01-20 09:29:59 +00:00
Oswald Buddenhagen
f67afee9e9 determine QMAKE_DEFAULT_{INC,LIB}DIRS separately for host and target
note that in principle this leaves room for a race condition, as the
first project to determine the host config is not going to be the
top-level one.
in qtbase and qtdeclarative, this is naturally serialized via the common
bootstrapped libraries (bootstrap resp. qmldevtools). activeqt, qt3d,
qtscxml, and qtwayland all build only one bootstrapped tool each.
qtwebengine makes a fake host build to create files for gyp/gn; the
convert_dict tool is declared a host tool, but isn't actually built when
x-building anyway, and even if, it's serialized on the former. qttools
needs explicit serialization, though. no other host builds exist within
qt as of now.

Task-number: QTBUG-58126
Change-Id: I81a02a2d98f2bfe5d6aaa51119d5e7919549f119
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2017-01-20 09:29:52 +00:00
Oswald Buddenhagen
6834d0eecc prevent configure from putting garbage into .qmake.stash
in cross-builds, toolchain.prf was loaded before CROSS_COMPILE was set
up, leading to caching of possibly nonsensical values.

this change also necessitated that msvc-version.conf is loaded only when
toolchain.prf is, which is best done by loading the former from within
the latter. that seems quite appropriate in the first place.

Change-Id: I62577e827a75e335e03df016bd1aa1932643fd6c
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-01-20 09:29:37 +00:00
Oswald Buddenhagen
5196d5602c determine msvc compat version in clang spec dynamically
instead of hardcoding the compat version in the spec, run cl.exe (which
needs to be around anyway) to figure out what version to emulate.

Change-Id: I6eae97fe9a78f8e340ecdabcdc0d48738497c6d2
Started-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-12-23 13:44:57 +00:00
Oswald Buddenhagen
1b5271f27f determine compiler version at build time, not in configure
this makes it consistent with the determination of the default
include/library paths. this makes sense, as it's possible to switch the
sdk/toolchain after building qt (within reason).

a side effect of this change is that for compilers which emulate other
compilers, both the real and the emulated version are now made
available.

Change-Id: Icfcc672c0d2e3d1b5e622993c366063d70ad327c
Started-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-12-23 13:44:50 +00:00
Oswald Buddenhagen
8861b82f9e move qdevice.pri creation to qmake-based configure system
Change-Id: I06540c3b6d98303bd9a218feedfb529993477ed6
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2016-12-13 18:56:28 +00:00
Oswald Buddenhagen
1e701cf062 quote regexps
the parens aren't matched, so the syntax was bogus.

amends 32a3413b13.

Task-number: QTBUG-56580
Change-Id: Ic00ba50844b822c7e4524ae81fbb1bc112a158a9
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Reviewed-by: Liang Qi <liang.qi@qt.io>
2016-10-20 19:23:48 +00:00
Oswald Buddenhagen
32a3413b13 make-expand cflags before passing them to $$system()
mac/sdk.prf puts some indirections into them.

Task-number: QTBUG-56580
Change-Id: I8ffd2438309702466edd3ad5c51284c7cab4fda9
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2016-10-19 11:42:26 +00:00
Oswald Buddenhagen
418494ecb6 fix QMAKE_DEFAULT_*DIRS resolution with apple SDK, take 2
the code got factored out to an own toolchain.prf file, which is
load()ed from default_pre.prf, so no change at first.
however, on mac, we shadow toolchain.prf, and make it load() sdk.prf
first.

a side effect, it has become harder to disable the use of an sdk
altogether: putting CONFIG-=sdk into a project file or the qmake
command line has no effect now. instead, it's possible to put it into
.qmake.{conf,cache}.
to make it simpler again, it's conceivable to finally add qmake -pre,
which would allow setting variables before default_pre.prf is executed.

take 2: there was nothing wrong with the original patch, but in 5.8,
CONFIG+=simulator_and_device moved from qconfig.pri to various prf files
that would do it according to the simulator_and_device configure
feature, which would be way too late for the "pulled ahead" sdk.prf
loading. as simulator_and_device is now gone entirely, it is safe to
re-apply this patch (mostly) as-is.

Task-number: QTBUG-56144
Change-Id: I6cf484982eaed8af39f7a539c60f5a087a299914
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2016-10-16 00:12:11 +00:00