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