]> rtime.felk.cvut.cz Git - omk.git/blob - tests/qt
Fix qt-qmake test that failed
[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 cat > 'Makefile.omk' <<'EOF'
14 SUBDIRS = somelib
15 QT_SUBDIRS = qtapp
16 EOF
17 mkdir 'somelib'
18 cat > 'somelib/somelib.c' <<'EOF'
19 #include <header.h>
20
21 int some_function(int num)
22 {
23     return SOME_CONST - num;
24 }
25 EOF
26 cat > 'somelib/Makefile.omk' <<'EOF'
27 include_HEADERS = header.h
28 shared_LIBRARIES = somelib
29
30
31 somelib_SOURCES = somelib.c
32 EOF
33 cat > 'somelib/header.h' <<'EOF'
34 #ifndef HEADER_H
35 #define HEADER_H
36
37 #define SOME_CONST 123
38
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42
43 int some_function(int);
44
45 #ifdef __cplusplus
46 }
47 #endif
48
49 #endif
50 EOF
51 mkdir 'qtapp'
52 cat > 'qtapp/qtapp.cxx' <<'EOF'
53 #include <QApplication>
54 #include <QPushButton>
55 #include <header.h>
56
57  int main(int argc, char *argv[])
58  {
59      QApplication app(argc, argv);
60
61      some_function(SOME_CONST);
62      QPushButton hello("Hello world!");
63      hello.resize(100, 30);
64
65      hello.show();
66      return app.exec();
67  }
68 EOF
69 echo 'QT_PROJECTS=qtapp.pro' > 'qtapp/Makefile.omk'
70 cat > 'qtapp/qtapp.pro' <<'EOF'
71 ######################################################################
72 # Automatically generated by qmake (2.01a) po ?rc 16 18:49:31 2007
73 ######################################################################
74
75 TEMPLATE = app
76 TARGET =
77 DEPENDPATH += .
78 INCLUDEPATH += .
79
80 # Input
81 SOURCES += qtapp.cxx
82 LIBS+=-lsomelib
83 EOF
84 omkize
85 WVPASS make
86 WVPASS test -x _compiled/bin/qtapp
87 make clean
88
89 ############################
90 # QT Compilation in subdir #
91 ############################
92
93 cat > Makefile.omk <<'EOF'
94 SUBDIRS = somelib dir
95 EOF
96 mkdir 'dir'
97 echo 'QT_SUBDIRS = ../qtapp' > 'dir/Makefile.omk'
98 omkize
99 WVPASS make
100 WVPASS test -x _compiled/bin/qtapp
101 make clean
102
103 cat <<EOF > Makefile.omk
104 SUBDIRS = somelib qtapp
105 EOF
106 WVPASS make
107 WVPASS test -x _compiled/bin/qtapp
108
109 make clean