Make console a no-op for WinRT

Compared to other platforms there is no concept of a console
application in WinRT. Hence all applications need to be UI
applications and use winmain.
Furthermore winmain takes care of launch arguments to be
properly converted to arguments passed to user's main().

There is a chicken and egg problem with config.tests as
compilation needs to have an existing entry point which is not
available at configure time.
Hence hardcode the entry point to main for configuring to WinRT.
Those tests are pure compile tests, so the logic of the test
does not change.

Change-Id: I4d3186691a8440845c24b2529cc9646e86dfd8da
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
This commit is contained in:
Maurice Kalinowski 2013-11-05 20:36:01 +01:00 committed by The Qt Project
parent c5eba649b6
commit 88609e6da4
4 changed files with 22 additions and 1 deletions

View File

@ -66,7 +66,6 @@ QMAKE_LFLAGS = /NOLOGO /DYNAMICBASE /NXCOMPAT /NODEFAULTLIB:ole32.lib
QMAKE_LFLAGS_RELEASE = /INCREMENTAL:NO
QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO = /DEBUG /OPT:REF
QMAKE_LFLAGS_DEBUG = /DEBUG
QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:CONSOLE
QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWS
QMAKE_LFLAGS_EXE = /MANIFEST:NO
QMAKE_LFLAGS_DLL = /MANIFEST:NO /DLL

View File

@ -53,6 +53,12 @@ defineTest(qtCompileTest) {
# Disable qmake features which are typically counterproductive for tests
qmake_configs = "\"CONFIG -= qt debug_and_release app_bundle lib_bundle\""
# On WinRT we need to change the entry point as we cannot create windows
# applications
winrt {
qmake_configs += " \"QMAKE_LFLAGS+=/ENTRY:main\""
}
# Clean up after previous run
exists($$test_out_dir/Makefile):qtRunLoggedCommand("$$test_cmd_base $$QMAKE_MAKE distclean")

View File

@ -0,0 +1,5 @@
# This is an empty prf file to overwrite the win32 version.
# On Windows RT all applications need to be windows applications
# and also link to winmain. Inside winmain we create the launch
# arguments and also initialize the UI.

View File

@ -3001,6 +3001,10 @@ void Configure::detectArch()
.arg(QDir::toNativeSeparators(buildPath + "/bin/qmake.exe"),
QDir::toNativeSeparators(qmakespec),
QDir::toNativeSeparators(sourcePath + "/config.tests/arch/arch.pro"));
if (qmakespec.startsWith("winrt") || qmakespec.startsWith("winphone"))
command.append(" QMAKE_LFLAGS+=/ENTRY:main");
int returnValue = 0;
Environment::execute(command, &returnValue);
if (returnValue != 0) {
@ -3101,6 +3105,13 @@ bool Configure::tryCompileProject(const QString &projectPath, const QString &ext
.arg(QDir::toNativeSeparators(buildPath + "/bin/qmake.exe"),
QDir::toNativeSeparators(sourcePath + "/config.tests/" + projectPath),
extraOptions);
if (dictionary.contains("XQMAKESPEC")) {
const QString qmakespec = dictionary["XQMAKESPEC"];
if (qmakespec.startsWith("winrt") || qmakespec.startsWith("winphone"))
command.append(" QMAKE_LFLAGS+=/ENTRY:main");
}
int code = 0;
QString output = Environment::execute(command, &code);
//cout << output << endl;