-
Notifications
You must be signed in to change notification settings - Fork 163
/
global.pri
532 lines (467 loc) · 20 KB
/
global.pri
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
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
# ***** BEGIN LICENSE BLOCK *****
# This file is part of Natron <http://www.natron.fr/>,
# Copyright (C) 2013-2018 INRIA and Alexandre Gauthier
#
# Natron is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# Natron is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Natron. If not, see <http://www.gnu.org/licenses/gpl-2.0.html>
# ***** END LICENSE BLOCK *****
# libs may modify the config (eg openmp), so it must be included before
include(libs.pri)
CONFIG += exceptions warn_on no_keywords
DEFINES += OFX_EXTENSIONS_NUKE OFX_EXTENSIONS_TUTTLE OFX_EXTENSIONS_VEGAS OFX_SUPPORTS_PARAMETRIC OFX_EXTENSIONS_TUTTLE OFX_EXTENSIONS_NATRON OFX_EXTENSIONS_RESOLVE OFX_SUPPORTS_OPENGLRENDER
DEFINES += OFX_SUPPORTS_MULTITHREAD
DEFINES += OFX_SUPPORTS_DIALOG
#Commented-out because many plug-in vendors do not implement it correctly
#DEFINES += OFX_SUPPORTS_DIALOG_V1
#Since in Natron and OpenFX all strings are supposed UTF-8 and that the constructor
#for QString(const char*) assumes ASCII strings, we may run into troubles
DEFINES += QT_NO_CAST_FROM_ASCII
# To run Natron without Python functionnalities (for debug purposes)
run-without-python {
message("Natron will run (not build) without Python")
DEFINES += NATRON_RUN_WITHOUT_PYTHON
} else {
# from <https://docs.python.org/3/c-api/intro.html#include-files>:
# "Since Python may define some pre-processor definitions which affect the standard headers on some systems, you must include Python.h before any standard headers are included."
CONFIG += python
QMAKE_CFLAGS += -include Python.h
QMAKE_CXXFLAGS += -include Python.h
}
*g++* | *clang* | *xcode* {
#See https://bugreports.qt.io/browse/QTBUG-35776 we cannot use
# QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO
# QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO
# QMAKE_OBJECTIVE_CFLAGS_RELEASE_WITH_DEBUGINFO
# QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO
QMAKE_CFLAGS_WARN_ON += -Wall -Wextra -Wmissing-prototypes -Wmissing-declarations -Wno-multichar -Winit-self -Wno-long-long
QMAKE_CXXFLAGS_WARN_ON += -Wall -Wextra -Wno-multichar -Winit-self -Wno-long-long
#QMAKE_CFLAGS_WARN_ON += -pedantic
#QMAKE_CXXFLAGS_WARN_ON += -pedantic
#QMAKE_CXXFLAGS_WARN_ON += -Weffc++
CONFIG(relwithdebinfo) {
CONFIG += release
DEFINES *= NDEBUG
QMAKE_CXXFLAGS += -O2 -g
QMAKE_CXXFLAGS -= -O3
#Remove the -s flag passed in release mode by qmake so binaries don't get stripped
QMAKE_LFLAGS_RELEASE =
}
CONFIG(fast) {
QMAKE_CFLAGS_RELEASE += -Ofast
QMAKE_CFLAGS_RELEASE -= -O -O2 -O3
QMAKE_CXXFLAGS_RELEASE += -Ofast
QMAKE_CXXFLAGS_RELEASE -= -O -O2 -O3
QMAKE_CFLAGS_DEBUG += -Ofast
QMAKE_CFLAGS_DEBUG -= -O -O2 -O3
QMAKE_CXXFLAGS_DEBUG += -Ofast
QMAKE_CXXFLAGS_DEBUG -= -O -O2 -O3
QMAKE_CXXFLAGS -= -O -O2 -O3
QMAKE_CFLAGS -= -O -O2 -O3
}
}
win32-g++ {
# KnobExpression.cpp includes exprtk and the assembler fails with the following:
# as.exe: release/KnobExpression.o: too many sections (68807)
# {standard input}: Assembler messages:
# {standard input}: Fatal error: can't write release/KnobExpression.o: File too big
# Commented out: If defined, ld on mingw never returns.
#QMAKE_CXXFLAGS += -Wa,-mbig-obj
# on Mingw LD is extremely slow in debug mode and can take hours. Optimizing the build seems to make it faster
CONFIG(debug, debug|release){
QMAKE_CXXFLAGS += -O -g
}
}
win32-msvc* {
CONFIG(relwithdebinfo) {
CONFIG += release
DEFINES *= NDEBUG
QMAKE_CXXFLAGS_RELEASE += -Zi
QMAKE_LFLAGS_RELEASE += /DEBUG /OPT:REF
}
}
CONFIG(debug, debug|release){
DEFINES *= DEBUG
} else {
DEFINES *= NDEBUG
}
enable-breakpad {
include(breakpadclient.pri)
}
enable-cairo {
# In Natron 2.2 onwards, roto render code has moved to an OpenGL based implementation and does not require cairo anymore. The cairo-based implementation is still maintained and works.
# If disable-cairo is specified, the CPU render code-path will use OSMesa to do the roto render using the OpenGL implementation.
# If not specified, the CPU reder code-path will use the cairo-based implementation.
# Note that we should avoid mixing the cairo based version and the OpenGL version as the rendering results may slightly differ.
DEFINES += ROTO_SHAPE_RENDER_ENABLE_CAIRO
}
CONFIG(noassertions) {
#See http://doc.qt.io/qt-4.8/debug.html
DEFINES *= NDEBUG QT_NO_DEBUG QT_NO_DEBUG_OUTPUT QT_NO_WARNING_OUTPUT
}
CONFIG(snapshot) {
message("Compiling an official snapshot (should only be done on the Natron build farm).")
DEFINES += NATRON_CONFIG_SNAPSHOT
CONFIG_SET=1
}
CONFIG(alpha) {
message("Compiling Natron in alpha version (should only be done on the Natron build farm).")
DEFINES += NATRON_CONFIG_ALPHA
CONFIG_SET=1
}
CONFIG(beta) {
message("Compiling Natron in beta version (should only be done on the Natron build farm).")
DEFINES += NATRON_CONFIG_BETA
CONFIG_SET=1
}
CONFIG(RC) {
message("Compiling Natron in release candidate version (should only be done on the Natron build farm).")
DEFINES += NATRON_CONFIG_RC
CONFIG_SET=1
}
CONFIG(stable) {
message("Compiling Natron in stable version (should only be done on the Natron build farm).")
DEFINES += NATRON_CONFIG_STABLE
CONFIG_SET=1
}
CONFIG(custombuild) {
message("Compiling Natron with a custom version for $$BUILD_USER_NAME")
#BUILD_USER_NAME should be defined reflecting the user name that should appear in Natron.
DEFINES += NATRON_CUSTOM_BUILD_USER_TOKEN=\"$$BUILD_USER_NAME\"
CONFIG_SET=1
}
isEmpty(BUILD_NUMBER) {
DEFINES += NATRON_BUILD_NUMBER=0
} else {
DEFINES += NATRON_BUILD_NUMBER=$$BUILD_NUMBER
}
CONFIG(enable-osmesa) {
# The following variables must be defined: LLVM_PATH and OSMESA_PATH
isEmpty(LLVM_PATH) {
LLVM_PATH="/opt/llvm"
}
isEmpty(OSMESA_PATH) {
OSMESA_PATH="/opt/osmesa"
}
# When using static Mesa libraries, the LLVM libs (necessary for llvmpipe) are not included
OSMESA_LIBS=$$system(env PKG_CONFIG_PATH=$$OSMESA_PATH/lib/pkgconfig pkg-config --libs --static osmesa) $$system($$LLVM_PATH/bin/llvm-config --ldflags --system-libs --libs engine mcjit mcdisassembler 2>/dev/null || $$LLVM_PATH/bin/llvm-config --ldflags --libs engine mcjit mcdisassembler)
OSMESA_INCLUDES=$$system(env PKG_CONFIG_PATH=$$OSMESA_PATH/lib/pkgconfig pkg-config --variable=includedir osmesa)
osmesa {
DEFINES += HAVE_OSMESA
INCLUDEPATH += $$OSMESA_INCLUDES
LIBS += $$OSMESA_LIBS
}
}
# https://qt.gitorious.org/qt-creator/qt-creator/commit/b48ba2c25da4d785160df4fd0d69420b99b85152
unix:LIBS += $$QMAKE_LIBS_DYNLOAD
*g++* {
QMAKE_CXXFLAGS += -ftemplate-depth-1024
GCCVer = $$system($$QMAKE_CXX --version)
contains(GCCVer,[0-3]\\.[0-9]+.*) {
} else {
contains(GCCVer,4\\.7.*) {
QMAKE_CXXFLAGS += -Wno-c++11-extensions
}
contains(GCCVer,[5-9]\\.[0-9]+.*) {
# Eigen uses std::binder1st which is deprecated in C++11
QMAKE_CXXFLAGS += -Wno-deprecated-declarations
}
contains(GCCVer,[6-9]\\.[0-9]+.*) {
# older versions of boost (at least up to 1.65.1) fail to compile with:
# /usr/include/boost/crc.hpp:350:9: error: right operand of shift expression '(18446744073709551615 << 64)' is >= than the precision of the left operand [-fpermissive]
# see https://github.com/MrKepzie/Natron/issues/1659
# -fpermissive turns it into a warning
QMAKE_CXXFLAGS += -fpermissive
# GCC 6 and later are C++14 by default, but Qt 4 is C++98
# Note: disabled, because qmake should put the right flags anyway
#lessThan(QT_MAJOR_VERSION, 5): QMAKE_CXXFLAGS += -std=gnu++98
# clear some Eigen3 warnings
QMAKE_CFLAGS += -Wno-int-in-bool-context
QMAKE_CXXFLAGS += -Wno-int-in-bool-context
}
contains(GCCVer,[7-9]\\.[0-9]+.*) {
# clear a lot of boost warnings
QMAKE_CFLAGS += -Wno-expansion-to-defined
QMAKE_CXXFLAGS += -Wno-expansion-to-defined
}
}
c++11 {
# check for at least version 4.7
contains(GCCVer,[0-3]\\.[0-9]+.*) {
error("At least GCC 4.6 is required.")
} else {
contains(GCCVer,4\\.[0-5].*) {
error("At least GCC 4.6 is required.")
} else {
contains(GCCVer,4\\.6.*) {
QMAKE_CXXFLAGS += -std=c++0x
} else {
QMAKE_CXXFLAGS += -std=c++11
}
}
}
}
}
openmp {
QMAKE_CXXFLAGS += -fopenmp
QMAKE_CFLAGS += -fopenmp
QMAKE_LFLAGS += -fopenmp
}
macx {
# Set the pbuilder version to 46, which corresponds to Xcode >= 3.x
# (else qmake generates an old pbproj on Snow Leopard)
QMAKE_PBUILDER_VERSION = 46
QMAKE_MACOSX_DEPLOYMENT_VERSION = $$split(QMAKE_MACOSX_DEPLOYMENT_TARGET, ".")
QMAKE_MACOSX_DEPLOYMENT_MAJOR_VERSION = $$first(QMAKE_MACOSX_DEPLOYMENT_VERSION)
QMAKE_MACOSX_DEPLOYMENT_MINOR_VERSION = $$last(QMAKE_MACOSX_DEPLOYMENT_VERSION)
universal {
message("Compiling for universal OSX $${QMAKE_MACOSX_DEPLOYMENT_MAJOR_VERSION}.$$QMAKE_MACOSX_DEPLOYMENT_MINOR_VERSION")
contains(QMAKE_MACOSX_DEPLOYMENT_MAJOR_VERSION, 10) {
contains(QMAKE_MACOSX_DEPLOYMENT_TARGET, 4)|contains(QMAKE_MACOSX_DEPLOYMENT_MINOR_VERSION, 5) {
# OSX 10.4 (Tiger) and 10.5 (Leopard) are x86/ppc
message("Compiling for universal ppc/i386")
CONFIG += x86 ppc
}
contains(QMAKE_MACOSX_DEPLOYMENT_MINOR_VERSION, 6) {
message("Compiling for universal i386/x86_64")
# OSX 10.6 (Snow Leopard) may run on Intel 32 or 64 bits architectures
CONFIG += x86 x86_64
}
# later OSX instances only run on x86_64, universal builds are useless
# (unless a later OSX supports ARM)
}
}
#link against the CoreFoundation framework for the StandardPaths functionnality
LIBS += -framework CoreServices
#// Disable availability macros on macOS
#// because we may be using libc++ on an older macOS,
#// so that std::locale::numeric may be available
#// even on macOS < 10.9.
#// see _LIBCPP_AVAILABILITY_LOCALE_CATEGORY
#// in /opt/local/libexec/llvm-5.0/include/c++/v1/__config
#// and /opt/local/libexec/llvm-5.0/include/c++/v1/__locale
DEFINES += _LIBCPP_DISABLE_AVAILABILITY
}
macx-clang-libc++ {
# in Qt 4.8.7, objective-C misses the stdlib and macos version flags
QMAKE_OBJECTIVE_CFLAGS += -stdlib=libc++ -mmacosx-version-min=$$QMAKE_MACOSX_DEPLOYMENT_TARGET
}
macx-clang {
# in Qt 4.8.7, objective-C misses the stdlib and macos version flags
QMAKE_OBJECTIVE_CFLAGS += -mmacosx-version-min=$$QMAKE_MACOSX_DEPLOYMENT_TARGET
}
CONFIG(debug) {
CONFIG += nopch
}
# CONFIG+=nopch disables precompiled headers
!nopch {
!macx|!universal {
# precompiled headers don't work with multiple archs
CONFIG += precompile_header
}
}
!macx {
# c++11 build fails on Snow Leopard 10.6 (see the macx section below)
#CONFIG += c++11
}
win32 {
#ofx needs WINDOWS def
#microsoft compiler needs _MBCS to compile with the multi-byte character set.
#DEFINES += _MBCS
DEFINES += WINDOWS COMPILED_FROM_DSP XML_STATIC NOMINMAX
DEFINES += _UNICODE UNICODE
DEFINES += QHTTP_SERVER_STATIC
#System library is required on windows to map network share names from drive letters
LIBS += -lmpr
# Natron requires a link to opengl32.dll and Gdi32 for offscreen rendering
osmesa: LIBS += -lopengl32 -lGdi32
}
win32-g++ {
# -municode is needed for linking because it uses wmain() instead of the traditional main()
# https://sourceforge.net/p/mingw-w64/wiki2/Unicode%20apps/
QMAKE_CFLAGS += -municode
QMAKE_CXXFLAGS += -municode
QMAKE_LFLAGS += -municode
}
win32-msvc* {
CONFIG(64bit){
message("Compiling for architecture x86 64 bits")
Release:DESTDIR = x64/release
Release:OBJECTS_DIR = x64/release/.obj
Release:MOC_DIR = x64/release/.moc
Release:RCC_DIR = x64/release/.rcc
Release:UI_DIR = x64/release/.ui
Debug:DESTDIR = x64/debug
Debug:OBJECTS_DIR = x64/debug/.obj
Debug:MOC_DIR = x64/debug/.moc
Debug:RCC_DIR = x64/debug/.rcc
Debug:UI_DIR = x64/debug/.ui
} else {
message("Compiling for architecture x86 32 bits")
Release:DESTDIR = win32/release
Release:OBJECTS_DIR = win32/release/.obj
Release:MOC_DIR = win32/release/.moc
Release:RCC_DIR = win32/release/.rcc
Release:UI_DIR = win32/release/.ui
Debug:DESTDIR = win32/debug
Debug:OBJECTS_DIR = win32/debug/.obj
Debug:MOC_DIR = win32/debug/.moc
Debug:RCC_DIR = win32/debug/.rcc
Debug:UI_DIR = win32/debug/.ui
}
#System library is required on windows to map network share names from drive letters
LIBS += mpr.lib
}
win32-g++ {
# On MingW everything is defined with pkgconfig except boost
QT_CONFIG -= no-pkg-config
CONFIG += link_pkgconfig
PKGCONFIG += freetype2 fontconfig
expat: PKGCONFIG += expat
cairo: PKGCONFIG += cairo
shiboken: PKGCONFIG += shiboken-py2
#PYSIDE_PKG_CONFIG_PATH = $$system($$PYTHON_CONFIG --prefix)/lib/pkgconfig
pyside: PKGCONFIG += pyside-py2
pyside: INCLUDEPATH += $$system(env PKG_CONFIG_PATH=$$PYSIDE_PKG_CONFIG_PATH pkg-config --variable=includedir pyside-py2)/QtCore
pyside: INCLUDEPATH += $$system(env PKG_CONFIG_PATH=$$PYSIDE_PKG_CONFIG_PATH pkg-config --variable=includedir pyside-py2)/QtGui
python: PKGCONFIG += python-2.7
boost-serialization-lib: LIBS += -lboost_serialization-mt
boost: LIBS += -lboost_thread-mt -lboost_system-mt
#See http://stackoverflow.com/questions/16596876/object-file-has-too-many-sections
Debug: QMAKE_CXXFLAGS += -Wa,-mbig-obj
}
unix {
# on Unix systems, only the "boost" option needs to be defined in config.pri
QT_CONFIG -= no-pkg-config
CONFIG += link_pkgconfig
expat: PKGCONFIG += expat
fontconfig: PKGCONFIG += freetype2 fontconfig
linux-* {
osmesa: LIBS += -lGL -lX11
# link with static cairo on linux, to avoid linking to X11 libraries in NatronRenderer
cairo {
PKGCONFIG += pixman-1
LIBS += $$system(pkg-config --variable=libdir cairo)/libcairo.a
}
LIBS += -ldl -lrt
QMAKE_LFLAGS += '-Wl,-rpath,\'\$$ORIGIN/../lib\',-z,origin'
} else {
osmesa: LIBS += -framework OpenGL
cairo: PKGCONFIG += cairo
}
# User may specify an alternate python2-config from the command-line,
# as in "qmake PYTHON_CONFIG=python2.7-config"
isEmpty(PYTHON_CONFIG) {
PYTHON_CONFIG = python2-config
}
python {
#PKGCONFIG += python
LIBS += $$system($$PYTHON_CONFIG --ldflags)
PYTHON_CFLAGS = $$system($$PYTHON_CONFIG --includes)
PYTHON_INCLUDEPATH = $$find(PYTHON_CFLAGS, ^-I.*)
PYTHON_INCLUDEPATH ~= s/^-I(.*)/\\1/g
INCLUDEPATH *= $$PYTHON_INCLUDEPATH
}
# There may be different pyside.pc/shiboken.pc for different versions of python.
# pkg-config will probably give a bad answer, unless python2 is the system default.
# See for example tools/travis/install_dependencies.sh for a solution that works on Linux,
# using a custom config.pri
shiboken: PKGCONFIG += shiboken
pyside: PKGCONFIG += pyside
# The following hack also works with Homebrew if pyside is installed with option --with-python3
macx {
QMAKE_LFLAGS += '-Wl,-rpath,\'@loader_path/../Frameworks\''
shiboken {
PKGCONFIG -= shiboken
PYSIDE_PKG_CONFIG_PATH = $$system($$PYTHON_CONFIG --prefix)/lib/pkgconfig
INCLUDEPATH += $$system(env PKG_CONFIG_PATH=$$PYSIDE_PKG_CONFIG_PATH pkg-config --variable=includedir shiboken)
# the sed stuff is to work around an Xcode generator bug
LIBS += $$system(env PKG_CONFIG_PATH=$$PYSIDE_PKG_CONFIG_PATH pkg-config --libs shiboken | sed -e s/-undefined\\ dynamic_lookup//)
}
pyside {
PKGCONFIG -= pyside
PYSIDE_PKG_CONFIG_PATH = $$system($$PYTHON_CONFIG --prefix)/lib/pkgconfig
INCLUDEPATH += $$system(env PKG_CONFIG_PATH=$$PYSIDE_PKG_CONFIG_PATH pkg-config --variable=includedir pyside)
INCLUDEPATH += $$system(env PKG_CONFIG_PATH=$$PYSIDE_PKG_CONFIG_PATH pkg-config --variable=includedir pyside)/QtCore
# QtGui include are needed because it looks for Qt::convertFromPlainText which is defined in
# qtextdocument.h in the QtGui module.
INCLUDEPATH += $$system(env PKG_CONFIG_PATH=$$PYSIDE_PKG_CONFIG_PATH pkg-config --variable=includedir pyside)/QtGui
INCLUDEPATH += $$system(env PKG_CONFIG_PATH=$${QMAKE_LIBDIR_QT}/pkgconfig pkg-config --variable=includedir QtGui)
LIBS += $$system(env PKG_CONFIG_PATH=$$PYSIDE_PKG_CONFIG_PATH pkg-config --libs pyside)
}
}
} #unix
*-xcode {
# redefine cxx flags as qmake tends to automatically add -O2 to xcode projects
QMAKE_CFLAGS -= -O2
QMAKE_CXXFLAGS -= -O2
QMAKE_CXXFLAGS += -ftemplate-depth-1024
# all libraries in Natron are static, so visibility can be hidden by default.
symbols_hidden_by_default.name = GCC_SYMBOLS_PRIVATE_EXTERN
symbols_hidden_by_default.value = YES
QMAKE_MAC_XCODE_SETTINGS += symbols_hidden_by_default
}
*clang* {
QMAKE_CXXFLAGS += -ftemplate-depth-1024
QMAKE_CXXFLAGS_WARN_ON += -Wno-c++11-extensions
c++11 {
QMAKE_CXXFLAGS += -std=c++11
}
}
# see http://clang.llvm.org/docs/AddressSanitizer.html and http://blog.qt.digia.com/blog/2013/04/17/using-gccs-4-8-0-address-sanitizer-with-qt/
addresssanitizer {
message("Compiling with AddressSanitizer (for gcc >= 4.8 and clang). Set the ASAN_SYMBOLIZER_PATH environment variable to point to the llvm-symbolizer binary, or make sure llvm-symbolizer in in your PATH.")
message("To compile with clang, use a clang-specific spec, such as unsupported/linux-clang, unsupported/macx-clang, linux-clang or macx-clang.")
message("For example, with Qt4 on OS X:")
message(" sudo port install clang-3.4")
message(" sudo port select clang mp-clang-3.4")
message(" export ASAN_SYMBOLIZER_PATH=/opt/local/bin/llvm-symbolizer-mp-3.4")
message(" qmake -spec unsupported/macx-clang CONFIG+=addresssanitizer ...")
message("see http://clang.llvm.org/docs/AddressSanitizer.html")
CONFIG += debug
QMAKE_CFLAGS += -fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls -O1
QMAKE_CFLAGS += -fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls -O1
QMAKE_LFLAGS += -fsanitize=address -g
# QMAKE_LFLAGS += -fsanitize-blacklist=../asan_blacklist.ignore
# QMAKE_CLAGS += -fsanitize-blacklist=../asan_blacklist.ignore
# QMAKE_CFLAGS += -fsanitize-blacklist=../asan_blacklist.ignore
}
# see http://clang.llvm.org/docs/ThreadSanitizer.html
threadsanitizer {
message("Compiling with ThreadSanitizer (for clang).")
message("see http://clang.llvm.org/docs/ThreadSanitizer.html")
CONFIG += debug
QMAKE_CFLAGS += -fsanitize=thread -O1
QMAKE_CFLAGS += -fsanitize=thread -O1
QMAKE_LFLAGS += -fsanitize=thread -g
}
coverage {
QMAKE_CFLAGS += -fprofile-arcs -ftest-coverage -O0
QMAKE_LFLAGS += -fprofile-arcs -ftest-coverage
QMAKE_CLEAN += $(OBJECTS_DIR)/*.gcda $(OBJECTS_DIR)/*.gcno
}
# install targets on unix
unix:!macx {
isEmpty(PREFIX) {
PREFIX = /usr/local
}
target.path = $${PREFIX}/bin
target_icons.path = $${PREFIX}/share/pixmaps
target_icons.files = $PWD/../Gui/Resources/Images/natronIcon256_linux.png $PWD/../Gui/Resources/Images/natronProjectIcon_linux.png
target_mime.path = $${PREFIX}/share/mime/packages
target_mime.files = $PWD/../Gui/Resources/Mime/x-natron.xml
target_desktop.path = $${PREFIX}/share/applications
target_desktop.files = $PWD/../Gui/Resources/Applications/Natron.desktop
INSTALLS += target_icons target_mime target_desktop
}
# and finally...
include(config.pri)