]> rtime.felk.cvut.cz Git - omk.git/blob - tests/qt
Update wvtool
[omk.git] / tests / qt
1 #!/bin/bash
2
3 [ "$OMK_RULES" -a "$OMK_RULES" != linux ] && exit 0
4
5
6 . ./functions.sh
7
8 touch config.omk-default
9 QTDIR=/usr/share/qt4
10 export QTDIR
11 [ -d $QTDIR ] || canttest "Can't find QT4 instalation"
12
13 # Function to create a QT app using an OMK-built library
14 function create_qt_app() {
15     mkdir 'somelib'
16     cat > 'somelib/somelib.c' <<'EOF'
17 #include <header.h>
18
19 int some_function(int num)
20 {
21     return SOME_CONST - num;
22 }
23 EOF
24     cat > 'somelib/Makefile.omk' <<'EOF'
25 include_HEADERS = header.h
26 shared_LIBRARIES = somelib
27
28
29 somelib_SOURCES = somelib.c
30 EOF
31     cat > 'somelib/header.h' <<'EOF'
32 #ifndef HEADER_H
33 #define HEADER_H
34
35 #define SOME_CONST 123
36
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40
41 int some_function(int);
42
43 #ifdef __cplusplus
44 }
45 #endif
46
47 #endif
48 EOF
49     mkdir 'qtapp'
50     cat > 'qtapp/qtapp.cxx' <<'EOF'
51 #include <QApplication>
52 #include <QPushButton>
53 #include <header.h>
54
55  int main(int argc, char *argv[])
56  {
57      QApplication app(argc, argv);
58
59      some_function(SOME_CONST);
60      QPushButton hello("Hello world!");
61      hello.resize(100, 30);
62
63      hello.show();
64      return app.exec();
65  }
66 EOF
67     cat > 'qtapp/qtapp.pro' <<'EOF'
68 ######################################################################
69 # Automatically generated by qmake (2.01a) po ?rc 16 18:49:31 2007
70 ######################################################################
71
72 TEMPLATE = app
73 TARGET =
74 DEPENDPATH += .
75 INCLUDEPATH += .
76
77 # Input
78 SOURCES += qtapp.cxx
79 LIBS+=-lsomelib
80 EOF
81 }
82
83 ############################
84 # The actual tests
85 ############################
86
87 WVSTART "QT_SUBDIRS in top-level Makefile.omk"
88 create_qt_app
89 cat > 'Makefile.omk' <<'EOF'
90 SUBDIRS = somelib
91 QT_SUBDIRS = qtapp
92 EOF
93 omkize
94 WVPASS make V=1
95 WVPASS test -x _compiled/bin/qtapp
96
97 WVSTART "QT_SUBDIRS in a subdir"
98 create_qt_app
99 echo "SUBDIRS = somelib dir" > Makefile.omk
100 mkdir 'dir'
101 mv qtapp dir
102 echo 'QT_SUBDIRS = qtapp' > 'dir/Makefile.omk'
103 omkize
104 WVPASS make
105 WVPASS test -x _compiled/bin/qtapp
106
107 WVSTART "QT_PROJECTS variable"
108 create_qt_app
109 echo 'QT_PROJECTS=qtapp.pro' > 'qtapp/Makefile.omk'
110 echo "SUBDIRS = somelib qtapp" > Makefile.omk
111 omkize
112 WVPASS make
113 WVPASS test -x _compiled/bin/qtapp
114
115 make clean