summaryrefslogtreecommitdiffstats
path: root/mkspecs/features/qttest_p4.prf
blob: 3e1c9182e922210cb4d821e522e840b4547e4270 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
isEmpty(TEMPLATE):TEMPLATE=app
CONFIG          += qt warn_on console depend_includepath

wince*:{
LIBS += corelibc.lib ole32.lib oleaut32.lib uuid.lib commctrl.lib coredll.lib winsock.lib
CONFIG(debug, debug|release) {
   LIBS += $$[QT_INSTALL_LIBS]/qtmaind.lib
} else {
   LIBS += $$[QT_INSTALL_LIBS]/qtmain.lib
}
}

# find testlib's prl file and extract the librarie's name
QTEST_LIB =
mac:exists($$[QT_INSTALL_LIBS]/QtTest.framework):QTEST_LIB = QtTest.framework
CONFIG(debug, debug|release) {
    isEmpty(QTEST_LIB) {
       win32 {
          QTEST_LIB = $$fromfile($$[QT_INSTALL_LIBS]/QtTest$${QT_LIBINFIX}d.prl, QMAKE_PRL_TARGET)4.dll
       }
       mac {
          QTEST_LIB = $$fromfile($$[QT_INSTALL_LIBS]/libQtTest$${QT_LIBINFIX}_debug.prl, QMAKE_PRL_TARGET)
       }
       unix:!mac {
          QTEST_LIB = $$fromfile($$[QT_INSTALL_LIBS]/libQtTest$${QT_LIBINFIX}.prl, QMAKE_PRL_TARGET)
       }
    }
    OBJECTS_DIR     = tmp/debug
    MOC_DIR         = tmp/debug
} else {
    isEmpty(QTEST_LIB) {
       win32 {
          QTEST_LIB = $$fromfile($$[QT_INSTALL_LIBS]/QtTest$${QT_LIBINFIX}.prl, QMAKE_PRL_TARGET)4.dll
       } else {
          QTEST_LIB = $$fromfile($$[QT_INSTALL_LIBS]/libQtTest$${QT_LIBINFIX}.prl, QMAKE_PRL_TARGET)
       }
    }
    OBJECTS_DIR     = tmp/release
    MOC_DIR         = tmp/release
}
isEmpty(QTEST_LIB) {
    warning("Cannot find testlib's prl file, run qmake in $QTDIR/src/testlib")
    CONFIG += embed_testlib
} else {
    !exists($$[QT_INSTALL_LIBS]/$$QTEST_LIB):CONFIG += embed_testlib
}

# make sure the test is build according to your Qt configuration
contains(QT_CONFIG, embedded):CONFIG += embedded

embed_testlib {
    QTESTDIR = $${QT_SOURCE_TREE}
    isEmpty(QTESTDIR):QTESTDIR = $$(QTSRCDIR)
    isEmpty(QTESTDIR):QTESTDIR = $$(QTDIR)
    isEmpty(QTESTDIR):warning("Cannot find QTestLib sources, set QTDIR or QTSRCDIR")
    QTESTDIR = $${QTESTDIR}/src/testlib
    HEADERS += $${QTESTDIR}/qtesteventloop.h
    SOURCES += $${QTESTDIR}/qasciikey.cpp \
               $${QTESTDIR}/qabstracttestlogger.cpp \
               $${QTESTDIR}/qsignaldumper.cpp \
               $${QTESTDIR}/qtestdata.cpp \
               $${QTESTDIR}/qtestresult.cpp \
               $${QTESTDIR}/qxmltestlogger.cpp \
               $${QTESTDIR}/qplaintestlogger.cpp \
               $${QTESTDIR}/qtestcase.cpp \
               $${QTESTDIR}/qbenchmark.cpp \
               $${QTESTDIR}/qbenchmarkevent.cpp \
               $${QTESTDIR}/qbenchmarkmeasurement.cpp \
               $${QTESTDIR}/qbenchmarkvalgrind.cpp \
               $${QTESTDIR}/qtestlog.cpp \
               $${QTESTDIR}/qtesttable.cpp
    DEFINES += QTEST_EMBED QTEST_LIGHT
} else {
    CONFIG += qtestlib
}

embedded:QMAKE_CXXFLAGS+=-fno-rtti

# prefix test binary with tst_
!contains(TARGET, ^tst_.*):TARGET = $$join(TARGET,,"tst_")

########################################################################
# Use install rule to run test application.
# This lets you do 'make install' on a test to both build and run it,
# and lets you easily build and run all tests from the parent directory.
# ----------------------------------------------------------------------

runme.files                =
runme.path                 = .
!isEmpty(DESTDIR): runme.commands = cd ./$(DESTDIR) &&
macx:      runme.commands += ./$(QMAKE_TARGET).app/Contents/MacOS/$(QMAKE_TARGET)
else:unix: runme.commands += ./$(QMAKE_TARGET)
else:win32: {
    CONFIG(debug, debug|release):runme.commands += debug\\$(QMAKE_TARGET)
    else:runme.commands += release\\$(QMAKE_TARGET)
}
embedded:  runme.commands += -qws
INSTALLS += runme


########################################################################