diff options
Diffstat (limited to 'utils/rbutilqt/rbutilqt.pro')
-rw-r--r-- | utils/rbutilqt/rbutilqt.pro | 248 |
1 files changed, 248 insertions, 0 deletions
diff --git a/utils/rbutilqt/rbutilqt.pro b/utils/rbutilqt/rbutilqt.pro new file mode 100644 index 0000000000..f172e231bf --- /dev/null +++ b/utils/rbutilqt/rbutilqt.pro | |||
@@ -0,0 +1,248 @@ | |||
1 | # | ||
2 | # __________ __ ___. | ||
3 | # Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | # \/ \/ \/ \/ \/ | ||
8 | # | ||
9 | # All files in this archive are subject to the GNU General Public License. | ||
10 | # See the file COPYING in the source tree root for full license agreement. | ||
11 | # | ||
12 | # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
13 | # KIND, either express or implied. | ||
14 | # | ||
15 | |||
16 | # The external Makefiles use ar to create libs. To allow cross-compiling pass | ||
17 | # the ar that matches the current gcc. Since qmake doesn't provide a variable | ||
18 | # holding the correct ar without any additions we need to figure it ourselves | ||
19 | # here. | ||
20 | # Only do this if CC is gcc. Also, do this before ccache support is enabled. | ||
21 | contains(QMAKE_CC,($$find(QMAKE_CC,.*gcc.*))) { | ||
22 | EXTRALIBS_OPTS = "EXTRALIBS_AR=\""$$replace(QMAKE_CC,gcc.*,ar)\" | ||
23 | } | ||
24 | # ccache | ||
25 | unix:!mac:!noccache { | ||
26 | CCACHE = $$system(which ccache) | ||
27 | !isEmpty(CCACHE) { | ||
28 | message("using ccache at $$CCACHE") | ||
29 | QMAKE_CXX = ccache $$QMAKE_CXX | ||
30 | QMAKE_CC = ccache $$QMAKE_CC | ||
31 | } | ||
32 | } | ||
33 | MACHINEFLAGS = $$find(QMAKE_CFLAGS, -m[63][42]) | ||
34 | EXTRALIBS_OPTS += EXTRALIBS_CC=\"$$QMAKE_CC\" | ||
35 | EXTRALIBS_OPTS += EXTRALIBS_CXX=\"$$QMAKE_CXX\" | ||
36 | EXTRALIBS_OPTS += EXTRALIB_CFLAGS=\"$$MACHINEFLAGS\" | ||
37 | EXTRALIBS_OPTS += EXTRALIB_CXXFLAGS=\"$$MACHINEFLAGS\" | ||
38 | macx { | ||
39 | # on recent macOS we need to pass isysroot to the libs, otherwise it won't find | ||
40 | # the standard libaries. This is caused by the passed compiler (doesn't rely on | ||
41 | # default compiler but passed full path) | ||
42 | EXTRALIBS_OPTS += EXTRALIB_ISYSROOT=\"$$QMAKE_MAC_SDK.macosx.Path\" | ||
43 | } | ||
44 | |||
45 | MYBUILDDIR = $$OUT_PWD/build/ | ||
46 | MYLIBBUILDDIR = $$MYBUILDDIR/libs/ | ||
47 | OBJECTS_DIR = $$MYBUILDDIR/o | ||
48 | UI_DIR = $$MYBUILDDIR/ui | ||
49 | MOC_DIR = $$MYBUILDDIR/moc | ||
50 | RCC_DIR = $$MYBUILDDIR/rcc | ||
51 | |||
52 | !silent { | ||
53 | VERBOSE = "V=1" | ||
54 | } else { | ||
55 | VERBOSE = | ||
56 | } | ||
57 | |||
58 | # check version of Qt installation | ||
59 | contains(QT_MAJOR_VERSION, 4) { | ||
60 | error("Qt 4 is not supported anymore.") | ||
61 | } | ||
62 | |||
63 | RBBASE_DIR = $$_PRO_FILE_PWD_ | ||
64 | RBBASE_DIR = $$replace(RBBASE_DIR,/utils/rbutilqt,) | ||
65 | |||
66 | message("using Rockbox basedir $$RBBASE_DIR") | ||
67 | |||
68 | # check for system speex. Add a custom rule for pre-building librbspeex if not | ||
69 | # found. Newer versions of speex are split up into libspeex and libspeexdsp, | ||
70 | # and some distributions package them separately. Check for both and fall back | ||
71 | # to librbspeex if not found. | ||
72 | # NOTE: keep adding the linker option after -lrbspeex, otherwise linker errors | ||
73 | # occur if the linker defaults to --as-needed | ||
74 | # (see http://www.gentoo.org/proj/en/qa/asneeded.xml) | ||
75 | # | ||
76 | # Always use our own copy when building statically. Don't search for libspeex | ||
77 | # on Mac, since we don't deploy statically there. | ||
78 | !static:unix:!mac { | ||
79 | LIBSPEEX = $$system(pkg-config --silence-errors --libs speex speexdsp) | ||
80 | } | ||
81 | |||
82 | extralibs.commands = $$SILENT \ | ||
83 | $(MAKE) -f $$RBBASE_DIR/utils/rbutilqt/Makefile.libs \ | ||
84 | $$VERBOSE \ | ||
85 | SYS_SPEEX=\"$$LIBSPEEX\" \ | ||
86 | BUILD_DIR=$$MYLIBBUILDDIR/ \ | ||
87 | TARGET_DIR=$$MYLIBBUILDDIR \ | ||
88 | RBBASE_DIR=$$RBBASE_DIR \ | ||
89 | $$EXTRALIBS_OPTS \ | ||
90 | libs | ||
91 | # Note: order is important for RBLIBS! The libs are appended to the linker | ||
92 | # flags in this order, put libucl at the end. | ||
93 | RBLIBS = rbspeex ipodpatcher sansapatcher mkamsboot mktccboot \ | ||
94 | mkmpioboot chinachippatcher mkimxboot mks5lboot bspatch ucl \ | ||
95 | rbtomcrypt | ||
96 | # NOTE: Our copy of libbzip2 has to use the name "bz2" to match up with the | ||
97 | # distro name. Otherwise cross compiling would end up linking two copies of | ||
98 | # bzip2 using different names, causing symbol clashes. Using the same name | ||
99 | # makes the compiler pick the one he likes. | ||
100 | RBLIBS += bz2 | ||
101 | !win32-msvc* { | ||
102 | QMAKE_EXTRA_TARGETS += extralibs | ||
103 | PRE_TARGETDEPS += extralibs | ||
104 | } | ||
105 | win32-msvc* { | ||
106 | INCLUDEPATH += msvc | ||
107 | LIBS += -L$$_PRO_FILE_PWD_/msvc | ||
108 | LIBS += -ladvapi32 # required for MSVC / Qt Creator combination | ||
109 | } | ||
110 | |||
111 | # rule for creating ctags file | ||
112 | tags.commands = ctags -R --c++-kinds=+p --fields=+iaS --extra=+q $(SOURCES) | ||
113 | tags.depends = $(SOURCES) | ||
114 | QMAKE_EXTRA_TARGETS += tags | ||
115 | |||
116 | # add a custom rule for making the translations | ||
117 | LRELEASE = $$[QT_INSTALL_BINS]/lrelease | ||
118 | |||
119 | win32:!cross:!exists($$LRELEASE) { | ||
120 | LRELEASE = $$[QT_INSTALL_BINS]/lrelease.exe | ||
121 | } | ||
122 | lrelease.commands = $$LRELEASE -silent $$_PRO_FILE_ | ||
123 | QMAKE_EXTRA_TARGETS += lrelease | ||
124 | exists($$LRELEASE) { | ||
125 | message("using lrelease at $$LRELEASE") | ||
126 | PRE_TARGETDEPS += lrelease | ||
127 | } | ||
128 | !exists($$LRELEASE) { | ||
129 | warning("could not find lrelease. Skipping translations.") | ||
130 | } | ||
131 | |||
132 | # Needed by QT on Win | ||
133 | INCLUDEPATH += $$_PRO_FILE_PWD_ $$_PRO_FILE_PWD_/irivertools \ | ||
134 | $$_PRO_FILE_PWD_/zlib $$_PRO_FILE_PWD_/base \ | ||
135 | $$_PRO_FILE_PWD_/zlib $$_PRO_FILE_PWD_/gui | ||
136 | INCLUDEPATH += $$RBBASE_DIR/utils/ipodpatcher $$RBBASE_DIR/utils/sansapatcher \ | ||
137 | $$RBBASE_DIR/tools/rbspeex $$RBBASE_DIR/tools | ||
138 | INCLUDEPATH += logger | ||
139 | |||
140 | DEPENDPATH = $$INCLUDEPATH | ||
141 | |||
142 | LIBS += -L$$OUT_PWD -L$$MYLIBBUILDDIR | ||
143 | # append all RBLIBS to LIBS | ||
144 | for(rblib, RBLIBS) { | ||
145 | LIBS += -l$$rblib | ||
146 | } | ||
147 | |||
148 | LIBS += -lz | ||
149 | |||
150 | # Add a (possibly found) libspeex now, don't do this before -lrbspeex! | ||
151 | !static:!isEmpty(LIBSPEEX) { | ||
152 | LIBS += $$LIBSPEEX | ||
153 | } | ||
154 | |||
155 | TEMPLATE = app | ||
156 | TARGET = RockboxUtility | ||
157 | QT += network widgets svg | ||
158 | |||
159 | message("Qt$$QT_MAJOR_VERSION found") | ||
160 | lessThan(QT_MAJOR_VERSION, 6) { | ||
161 | QT += multimedia | ||
162 | } | ||
163 | if (greaterThan(QT_MAJOR_VERSION, 5)) { | ||
164 | QT += core5compat | ||
165 | } | ||
166 | |||
167 | CONFIG += c++11 | ||
168 | |||
169 | dbg { | ||
170 | CONFIG += debug thread qt warn_on | ||
171 | DEFINES += DBG | ||
172 | message("creating debug version") | ||
173 | } | ||
174 | !dbg { | ||
175 | CONFIG += release thread qt | ||
176 | DEFINES += NODEBUG | ||
177 | message("creating release version") | ||
178 | } | ||
179 | |||
180 | DEFINES += RBUTIL _LARGEFILE64_SOURCE | ||
181 | DEFINES += QT_DEPRECATED_WARNINGS | ||
182 | |||
183 | # platform specific | ||
184 | win32 { | ||
185 | # use MinGW's implementation of stdio functions for extended format string | ||
186 | # support. | ||
187 | DEFINES += __USE_MINGW_ANSI_STDIO=1 | ||
188 | DEFINES += _CRT_SECURE_NO_WARNINGS | ||
189 | DEFINES += UNICODE | ||
190 | LIBS += -lsetupapi -lnetapi32 | ||
191 | } | ||
192 | win32:static { | ||
193 | QMAKE_LFLAGS += -static-libgcc -static-libstdc++ | ||
194 | } | ||
195 | unix:!static:!macx { | ||
196 | LIBS += -lusb-1.0 | ||
197 | } | ||
198 | |||
199 | unix:!macx:static { | ||
200 | # force statically linking of libusb. Libraries that are appended | ||
201 | # later will get linked dynamically again. | ||
202 | LIBS += -Wl,-Bstatic -lusb-1.0 -Wl,-Bdynamic | ||
203 | } | ||
204 | |||
205 | macx { | ||
206 | QMAKE_MAC_SDK=macosx | ||
207 | contains(QT_MAJOR_VERSION, 5) { | ||
208 | greaterThan(QT_MINOR_VERSION, 5) { | ||
209 | QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.7 | ||
210 | message("Qt 5.6+ detected: setting deploy target to 10.7") | ||
211 | } | ||
212 | !greaterThan(QT_MINOR_VERSION, 5) { | ||
213 | QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6 | ||
214 | message("Qt up to 5.5 detected: setting deploy target to 10.6") | ||
215 | } | ||
216 | } | ||
217 | |||
218 | CONFIG += x86 | ||
219 | LIBS += -L/usr/local/lib \ | ||
220 | -framework IOKit -framework CoreFoundation -framework Carbon \ | ||
221 | -framework SystemConfiguration -framework CoreServices | ||
222 | INCLUDEPATH += /usr/local/include | ||
223 | |||
224 | # rule for creating a dmg file | ||
225 | dmg.commands = hdiutil create -ov -srcfolder RockboxUtility.app/ RockboxUtility.dmg | ||
226 | QMAKE_EXTRA_TARGETS += dmg | ||
227 | } | ||
228 | |||
229 | static { | ||
230 | if(equals(QT_MAJOR_VERSION, 5) : lessThan(QT_MINOR_VERSION, 4)) { | ||
231 | QTPLUGIN += qtaccessiblewidgets | ||
232 | LIBS += -L$$(QT_BUILD_TREE)/plugins/accessible -lqtaccessiblewidgets | ||
233 | } | ||
234 | LIBS += -L. | ||
235 | DEFINES += STATIC | ||
236 | message("using static plugin") | ||
237 | } | ||
238 | |||
239 | unix { | ||
240 | target.path = /usr/local/bin | ||
241 | INSTALLS += target | ||
242 | } | ||
243 | |||
244 | |||
245 | # source files are separate. | ||
246 | include(rbutilqt.pri) | ||
247 | include(quazip/quazip.pri) | ||
248 | include(logger/logger.pri) | ||