aboutsummaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
Diffstat (limited to 'share')
-rw-r--r--share/include/qt5.bld165
1 files changed, 165 insertions, 0 deletions
diff --git a/share/include/qt5.bld b/share/include/qt5.bld
new file mode 100644
index 0000000..d75fbdd
--- /dev/null
+++ b/share/include/qt5.bld
@@ -0,0 +1,165 @@
1
2function qt_getCXXFLAGS()
3{
4 if QTDIR == null then
5 {
6 error "QTDIR is not set, cannot find QT tools.";
7 }
8
9 ret = "-D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LI "
10 "-DQT_SHARED -I${QTDIR}/mkspecs/linux-g++ "
11 "$(PKG_CONFIG_PATH=PKG_CONFIG_PATH:${QTDIR}/lib/pkgconfig "
12 "pkg-config --cflags Qt5Core Qt5Gui Qt5Widgets ice glu x11 xext libpng freetype2 "
13 "gobject-2.0 sm xrender fontconfig gthread-2.0 glib-2.0)";
14 if UI_DIR != null then
15 {
16 ret += "-I${UI_DIR}";
17 }
18 if RCC_DIR != null then
19 {
20 ret += "-I${RCC_DIR}";
21 }
22 if MOC_DIR != null then
23 {
24 ret += "-I${MOC_DIR}";
25 }
26 return ret;
27}
28
29function qt_getLDFLAGS()
30{
31 if QTDIR == null then
32 {
33 error "QTDIR is not set, cannot find QT tools.";
34 }
35
36 return "-Wl,-rpath,${QTDIR}/lib $(PKG_CONFIG_PATH="
37 "PKG_CONFIG_PATH:${QTDIR}/lib/pkgconfig "
38 "pkg-config --libs Qt5Core Qt5Gui Qt5Widgets ice glu x11 xext libpng freetype2 "
39 "gobject-2.0 sm xrender fontconfig gthread-2.0 glib-2.0) -lz "
40 "-lm -ldl";
41}
42
43function qt_getToolPath( TOOL, DEFAULT )
44{
45 if QTDIR == null then
46 {
47 error "QTDIR is not set, cannot find QT tools.";
48 }
49 if TOOL == null then
50 {
51 return "${QTDIR}/bin/${DEFAULT}";
52 }
53 return TOOL;
54}
55
56function qt_uiToH()
57{
58 if "${UI_DIR}" == "" then
59 {
60 DIR = INPUT.dirName();
61 }
62 else
63 {
64 DIR = UI_DIR;
65 }
66 FILE = INPUT.fileName();
67 OUTFILE = FILE.replace(".ui",".h");
68 return "${DIR}/ui_${OUTFILE}";
69}
70
71rule "qt_ui"
72{
73 display "ui";
74 input "*.ui";
75 output INPUT.qt_uiToH();
76 tag "headers";
77 profile "build"
78 {
79 UIC = qt_getToolPath( UIC, "uic" );
80 execute("${UIC} -o ${OUTPUT} ${INPUT}");
81 }
82}
83
84function qt_qrcToCpp()
85{
86 if "${RCC_DIR}" == "" then
87 {
88 DIR = INPUT.dirName();
89 }
90 else
91 {
92 DIR = RCC_DIR;
93 }
94 FILE = INPUT.fileName();
95 OUTFILE = FILE.replace(".qrc",".cpp");
96 return "${DIR}/qrc_${OUTFILE}";
97}
98
99rule "qt_rcc"
100{
101 display "rcc";
102 input "*.qrc";
103 output INPUT.qt_qrcToCpp();
104 profile "build"
105 {
106 RCC = qt_getToolPath( RCC, "rcc" );
107 NAME = INPUT.fileName().replace(".qrc","");
108 execute("${RCC} -name ${NAME} -o ${OUTPUT} ${INPUT}");
109 }
110}
111
112function qt_isMocable()
113{
114 if INPUT.matches("*.h") then
115 {
116 if exists( INPUT ) then
117 {
118 if "$(grep Q_OBJECT ${INPUT})" != "" then
119 {
120 return true;
121 }
122 }
123 }
124 return false;
125}
126
127function qt_hToMocCpp()
128{
129 if "${MOC_DIR}" == "" then
130 {
131 DIR = INPUT.dirName();
132 }
133 else
134 {
135 DIR = MOC_DIR;
136 }
137 FILE = INPUT.fileName();
138 OUTFILE = FILE.replace(".h",".cpp");
139 return "${DIR}/moc_${OUTFILE}";
140}
141
142rule "qt_moc"
143{
144 display "moc";
145 input qt_isMocable();
146 output INPUT.qt_hToMocCpp();
147 profile "build"
148 {
149 MOC = qt_getToolPath( MOC, "moc" );
150 execute("${MOC} -o${OUTPUT} ${INPUT}");
151 }
152}
153
154rule "exe"
155{
156 input regex(".*\\.(h|o)");
157 profile "build"
158 {
159 INPUT = [INPUT].matches("*.o");
160// execute("echo ${INPUT}");
161// execute("echo ${MYIN}");
162 execute("${CXX} -o ${OUTPUT} ${INPUT} ${LDFLAGS}");
163 }
164}
165