-
Notifications
You must be signed in to change notification settings - Fork 5
/
hugor.pro
383 lines (339 loc) · 12.5 KB
/
hugor.pro
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
QT += core svg widgets
QT_CONFIG -= no-pkg-config
TEMPLATE = app
CONFIG += silent warn_on link_pkgconfig strict_c++ c++1z gc_binaries
TARGET = hugor
ICON = mac_icon.icns
VERSION_MAJOR = 3
VERSION_MINOR = 0
VERSION_PATCH = 99
VERSION = "$$VERSION_MAJOR"."$$VERSION_MINOR"."$$VERSION_PATCH"
DEFINES += \
HUGOR_VERSION=\\\"$$VERSION\\\" \
HUGOR_VERSION_MAJOR=$$VERSION_MAJOR \
HUGOR_VERSION_MINOR=$$VERSION_MINOR \
HUGOR_VERSION_PATCH=$$VERSION_PATCH
lessThan(QT_MAJOR_VERSION, 5) {
error(Qt 4 is not supported. You need at least Qt 5.5.)
}
equals(QT_MAJOR_VERSION, 5) {
lessThan(QT_MINOR_VERSION, 5) {
error(Qt 5.5 or higher is required. You are using Qt "$$QT_MAJOR_VERSION"."$$QT_MINOR_VERSION")
}
lessThan(QT_MINOR_VERSION, 6) {
QMAKE_CXXFLAGS += -std=c++1z
}
}
#SANITIZER_FLAGS = -fsanitize=undefined,integer -fno-omit-frame-pointer
#QMAKE_CFLAGS += $$SANITIZER_FLAGS
#QMAKE_CXXFLAGS += $$SANITIZER_FLAGS
#QMAKE_LFLAGS += $$SANITIZER_FLAGS
!system-boost {
INCLUDEPATH += boost
}
!disable-audio {
CONFIG(debug, release|debug) {
DEFINES += AULIB_DEBUG
}
INCLUDEPATH += \
SDL_audiolib \
SDL_audiolib/3rdparty/fmt/include \
SDL_audiolib/3rdparty/speex_resampler \
SDL_audiolib/include \
SDL_audiolib/src
PKGCONFIG += sdl2 sndfile libmpg123 fluidsynth
xmp {
PKGCONFIG += libxmp
DEFINES += USE_DEC_XMP=1
SOURCES += SDL_audiolib/src/DecoderXmp.cpp
}
else:modplug {
PKGCONFIG += libmodplug
DEFINES += USE_DEC_MODPLUG=1
SOURCES += SDL_audiolib/src/DecoderModplug.cpp
}
else {
PKGCONFIG += libopenmpt
DEFINES += USE_DEC_OPENMPT=1
SOURCES += SDL_audiolib/src/DecoderOpenmpt.cpp
}
adlmidi {
PKGCONFIG += libADLMIDI
DEFINES += USE_DEC_ADLMIDI=1
SOURCES += SDL_audiolib/src/DecoderAdlmidi.cpp
}
DEFINES += \
AULIB_STATIC_DEFINE \
FMT_HEADER_ONLY \
OUTSIDE_SPEEX \
RANDOM_PREFIX=SDL_audiolib \
SPX_RESAMPLE_EXPORT=
HEADERS += \
$$files(SDL_audiolib/*.h) \
$$files(SDL_audiolib/include/*.h) \
$$files(SDL_audiolib/include/Aulib/*.h) \
$$files(SDL_audiolib/src/*.h) \
$$files(SDL_audiolib/src/missing/*.h) \
src/oplvolumebooster.h \
src/rwopsbundle.h \
src/synthfactory.h
SOURCES += \
src/oplvolumebooster.cc \
src/rwopsbundle.c \
src/soundaulib.cc \
src/synthfactory.cc \
SDL_audiolib/3rdparty/speex_resampler/resample.c \
SDL_audiolib/src/missing/sdl_load_file_rw.c \
SDL_audiolib/src/Decoder.cpp \
SDL_audiolib/src/DecoderFluidsynth.cpp \
SDL_audiolib/src/DecoderMpg123.cpp \
SDL_audiolib/src/DecoderSndfile.cpp \
SDL_audiolib/src/Processor.cpp \
SDL_audiolib/src/Resampler.cpp \
SDL_audiolib/src/ResamplerSpeex.cpp \
SDL_audiolib/src/Stream.cpp \
SDL_audiolib/src/stream_p.cpp \
SDL_audiolib/src/aulib.cpp \
SDL_audiolib/src/sampleconv.cpp
} else {
DEFINES += DISABLE_AUDIO
SOURCES += src/soundnone.cc
}
disable-video {
DEFINES += DISABLE_VIDEO
} else {
disable-audio {
error("Video support needs audio support to be enabled.")
}
PKGCONFIG += libvlc
win32 {
DEFINES += DL_VLC
}
HEADERS += \
src/videoplayer.h \
src/vlcaudiodecoder.h
SOURCES += \
src/videoplayer.cc \
src/vlcaudiodecoder.cc
}
macx {
TARGET = Hugor
QMAKE_INFO_PLIST = Info.plist
HEADERS += src/macos.h
SOURCES += src/macos.mm
LIBS += -framework AppKit
contains(QT_MAJOR_VERSION, 5):lessThan(QT_MINOR_VERSION, 10) {
message("*** You are using Qt < 5.10. You need to manually specify")
message("*** LSMinimumSystemVersion in the generated Info.plist in")
message("*** the app bundle after building.")
}
gc_binaries:contains(QT_MAJOR_VERSION, 5):lessThan(QT_MINOR_VERSION, 12) {
QMAKE_LFLAGS += -Wl,-dead_strip
}
}
win32 {
TARGET = Hugor
RC_ICONS = w32_icon.ico
QMAKE_TARGET_COMPANY = "Nikos Chantziaras"
QMAKE_TARGET_DESCRIPTION = "Hugor - A Hugo Interpreter"
QMAKE_TARGET_COPYRIGHT = "Copyright 2011, Kent Tessman; 2011-2022, Nikos Chantziaras"
!disable-video {
qt5-video {
QTPLUGIN += dsengine
}
}
*-g++* {
QMAKE_CFLAGS += -march=i686 -mtune=generic
QMAKE_CXXFLAGS += -march=i686 -mtune=generic
}
}
# We use warn_off to allow only default warnings, not to supress them all.
QMAKE_CXXFLAGS_WARN_OFF =
QMAKE_CFLAGS_WARN_OFF =
*-g++*|*-clang* {
# Avoid "unused parameter" warnings with C code.
QMAKE_CFLAGS_WARN_ON += -Wno-unused-parameter
}
INCLUDEPATH += src hugo
OBJECTS_DIR = obj
MOC_DIR = tmp
UI_DIR = tmp
DEFINES += HUGOR QT_DEPRECATED_WARNINGS QT_DISABLE_DEPRECATED_BEFORE=0x050600
CONFIG(debug, debug|release) {
DEFINES += BOOST_CB_ENABLE_DEBUG=1
}
RESOURCES += resources.qrc
FORMS += \
src/aboutdialog.ui \
src/confdialog.ui
HEADERS += \
src/aboutdialog.h \
src/confdialog.h \
src/happlication.h \
src/heqtheader.h \
src/hframe.h \
src/hmainwindow.h \
src/hmarginwidget.h \
src/hscrollback.h \
src/hugodefs.h \
src/kcolorbutton.h \
src/settings.h \
src/settingsoverrides.h \
src/enginerunner.h \
src/hugohandlers.h \
src/hugorfile.h \
src/opcodeparser.h \
src/util.h \
src/extcolors.h \
\
hugo/heheader.h \
hugo/htokens.h
SOURCES += \
src/aboutdialog.cc \
src/confdialog.cc \
src/happlication.cc \
src/heqt.cc \
src/hframe.cc \
src/hmainwindow.cc \
src/hmarginwidget.cc \
src/hscrollback.cc \
src/kcolorbutton.cc \
src/main.cc \
src/settings.cc \
src/settingsoverrides.cc \
src/enginerunner.cc \
src/hugohandlers.cc \
src/opcodeparser.cc \
src/extcolors.cc \
src/hugorfile.cc \
src/util.cc \
\
hugo/he.c \
hugo/hebuffer.c \
hugo/heexpr.c \
hugo/hemisc.c \
hugo/heobject.c \
hugo/heparse.c \
hugo/heres.c \
hugo/herun.c \
hugo/heset.c \
hugo/stringfn.c
appdataxml.files = desktop/nikos.chantziaras.hugor.appdata.xml
desktopfile.files = desktop/nikos.chantziaras.hugor.desktop
desktopicon.files = desktop/hugor.png
docs.files = NEWS README
fileicons.files = desktop/hicolor
mimefile.files = desktop/hugor.xml
OTHER_FILES *= \
.github/workflows/main.yml \
.clang-format \
.gitattributes \
.gitignore \
LICENSE \
example.cfg \
hugo/LICENSE.TXT
isEmpty(PREFIX) {
PREFIX = /usr/local
}
isEmpty(BINDIR) {
BINDIR = "$$PREFIX/bin"
}
isEmpty(DATADIR) {
DATADIR = "$$PREFIX/share"
}
isEmpty(DOCDIR) {
DOCDIR = "$$DATADIR/doc/$$TARGET-$$VERSION"
}
appdataxml.path = "$$DATADIR/metainfo"
desktopfile.path = "$$DATADIR/applications"
desktopicon.path = "$$DATADIR/icons/hicolor/256x256/apps"
docs.path = "$$DOCDIR"
fileicons.path = "$$DATADIR/icons"
mimefile.path = "$$DATADIR/mime/packages"
target.path = "$$BINDIR"
INSTALLS += appdataxml desktopfile desktopicon docs fileicons mimefile target
linux {
VLC_PREFIX = $$system(pkg-config libvlc --variable=prefix)
appimage.target = appimage
appimage.commands = \
rm -f Hugor.AppImage \
&& rm -rf AppDir \
&& $$shell_quote($$QMAKE_QMAKE) PREFIX=$$shell_quote($$OUT_PWD/AppDir/usr) -config release -config adlmidi $$shell_quote($$_PRO_FILE_) \
&& make -j"$$QMAKE_HOST.cpu_count" \
&& make install \
&& mkdir -p $$shell_quote($$OUT_PWD/AppDir/usr/lib/vlc) \
&& cp -a $$shell_quote($$VLC_PREFIX/lib)/libvlc* $$shell_quote($$VLC_PREFIX/lib/vlc)/libvlc* $$shell_quote($$OUT_PWD/AppDir/usr/lib/) \
&& cp -a $$shell_quote($$VLC_PREFIX/lib/vlc/plugins) $$shell_quote($$OUT_PWD/AppDir/usr/lib/vlc/) \
&& rm -f $$shell_quote($$OUT_PWD/AppDir/usr/lib/vlc/plugins/plugins.dat) \
&& find $$shell_quote($$OUT_PWD/AppDir/usr/lib) -type f \\( -name $$shell_quote(*.la) -o -name $$shell_quote(*.a) \\) -exec rm $$shell_quote({}) \; \
&& patchelf --set-rpath $$shell_quote(\$$ORIGIN/../../../) $$shell_quote($$OUT_PWD/AppDir/usr/lib/vlc/plugins)/*/* \
&& rm -rf AppDir/usr/share/metainfo \
&& linuxdeployqt \
$$shell_quote($$OUT_PWD/AppDir/usr/share/applications/nikos.chantziaras.hugor.desktop) \
-no-copy-copyright-files \
-no-translations \
-qmake=$$shell_quote($$QMAKE_QMAKE) \
-extra-plugins=iconengines,platformthemes \
-bundle-non-qt-libs \
-exclude-libs=libglib-2.0.so.0 \
&& rm -f AppDir/usr/lib/libglib-* \
&& VERSION="$$VERSION" appimagetool AppDir
QMAKE_EXTRA_TARGETS += appimage
}
macx {
VLC_LIBDIR = $$system(pkg-config libvlc --variable=libdir)
macdist.target = macdist
macdist.commands = \
rm -rf Hugor.app \
&& rm -f Hugor.zip \
&& $$shell_quote($$QMAKE_QMAKE) -config release -config adlmidi $$shell_quote($$_PRO_FILE_) \
&& make -j"$$QMAKE_HOST.cpu_count" \
&& mkdir -p Hugor.app/Contents/Frameworks/vlc \
&& cp -a $$shell_quote($$VLC_LIBDIR)/libvlc*.dylib Hugor.app/Contents/Frameworks/ \
&& cp -a $$shell_quote($$VLC_LIBDIR/vlc/plugins) Hugor.app/Contents/Frameworks/vlc/ \
&& rm -f Hugor.app/Contents/Frameworks/vlc/plugins/plugins.dat \
&& find Hugor.app/Contents/Frameworks/ -type f \\( -name $$shell_quote(*.la) -o -name $$shell_quote(*.a) \\) -exec rm $$shell_quote({}) \; \
&& $$shell_quote($$dirname(QMAKE_QMAKE)/macdeployqt) Hugor.app -verbose=2 \
&& ditto -v -c -k --sequesterRsrc --keepParent --zlibCompressionLevel 9 Hugor.app Hugor.zip
legacymacdist.target = legacymacdist
legacymacdist.commands = \
rm -rf Hugor.app \
&& rm -f Hugor.zip \
&& $$shell_quote($$QMAKE_QMAKE) -config release -config adlmidi $$shell_quote($$_PRO_FILE_) \
&& make -j"$$QMAKE_HOST.cpu_count" \
&& sed -i \'\' \'s/\$${MACOSX_DEPLOYMENT_TARGET}/10.9/g\' Hugor.app/Contents/Info.plist \
&& dylibbundler -x Hugor.app/Contents/MacOS/Hugor -b -cd -d Hugor.app/Contents/Frameworks -p '@rpath' -s $$shell_quote($$VLC_LIBDIR) \
&& install_name_tool -add_rpath '@executable_path/../Frameworks/' Hugor.app/Contents/MacOS/Hugor \
&& rm -f Hugor.app/Contents/Frameworks/libvlc.* Hugor.app/Contents/Frameworks/libvlccore.* \
&& mkdir -p Hugor.app/Contents/Frameworks/vlc \
&& cp -a $$shell_quote($$VLC_LIBDIR)/libvlc*.dylib Hugor.app/Contents/Frameworks/ \
&& cp -a $$shell_quote($$VLC_LIBDIR/vlc/plugins) Hugor.app/Contents/Frameworks/vlc/ \
&& rm -f Hugor.app/Contents/Frameworks/vlc/plugins/plugins.dat \
&& find Hugor.app/Contents/Frameworks/ -type f \\( -name $$shell_quote(*.la) -o -name $$shell_quote(*.a) \\) -exec rm $$shell_quote({}) \; \
&& strip Hugor.app/Contents/MacOS/Hugor \
&& find Hugor.app/Contents/Frameworks/ -type f -name $$shell_quote(*.dylib) -exec strip -x $$shell_quote({}) \; \
&& ditto -v -c -k --sequesterRsrc --keepParent --zlibCompressionLevel 9 Hugor.app Hugor.zip
QMAKE_EXTRA_TARGETS += macdist legacymacdist
}
win32 {
VLC_LIBDIR = $$(VLC_LIBDIR)
isEmpty(VLC_LIBDIR) {
message("VLC_LIBDIR environment variable not set or is empty, will use /opt/vlc")
VLC_LIBDIR = /opt/vlc
}
windist.target = windist
windist.commands = \
rm -rf release \
&& rm -f $$shell_quote(Hugor-$${VERSION_MAJOR}.$${VERSION_MINOR}.zip) \
&& $$shell_quote($$QMAKE_QMAKE) -config release -config adlmidi $$shell_quote($$_PRO_FILE_) \
&& make -j"$$QMAKE_HOST.cpu_count" \
&& mkdir -p $$shell_quote(release/Hugor-$${VERSION_MAJOR}.$${VERSION_MINOR}/plugins) \
&& cd release \
&& cp -a $$shell_quote($${VLC_LIBDIR})/*.dll $$shell_quote(Hugor-$${VERSION_MAJOR}.$${VERSION_MINOR}/) \
&& cp -a $$shell_quote($${VLC_LIBDIR}/plugins) $$shell_quote(Hugor-$${VERSION_MAJOR}.$${VERSION_MINOR}/) \
&& rm -f $$shell_quote(Hugor-$${VERSION_MAJOR}.$${VERSION_MINOR}/plugins/plugins.dat) \
&& find $$shell_quote(Hugor-$${VERSION_MAJOR}.$${VERSION_MINOR}/) -type f \\( -name $$shell_quote(*.la) -o -name $$shell_quote(*.a) \\) -exec rm $$shell_quote({}) \; \
&& cp -a Hugor.exe $$shell_quote(Hugor-$${VERSION_MAJOR}.$${VERSION_MINOR}/) \
&& zip -r -9 $$shell_quote(../Hugor-$${VERSION_MAJOR}.$${VERSION_MINOR}.zip) $$shell_quote(Hugor-$${VERSION_MAJOR}.$${VERSION_MINOR})
QMAKE_EXTRA_TARGETS += windist
}