summaryrefslogtreecommitdiffstats
path: root/subsurface-configure.pri
blob: 903d6a84d49b06b270edfe03f60d18ef5cc5635e (plain) (blame)
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
#
# Global settings
#
# Set some C constructs to be diagnosed as errors:
#  - calling implicit functions
#  - casting from integers to pointers or vice-versa without an explicit cast
# Also turn on C99 mode with GNU extensions
*-g++*: QMAKE_CFLAGS += -Werror=int-to-pointer-cast -Werror=pointer-to-int-cast -Werror=implicit-int 

# these warnings are in general just wrong and annoying - but should be
# turned on every once in a while in case they do show the occasional
# actual bug
*-g++* | *-clang*: QMAKE_CFLAGS += -Wno-unused-result -Wno-pointer-sign -fno-strict-overflow
*-g++*: QMAKE_CFLAGS += -Wno-maybe-uninitialized
*-clang*: QMAKE_CFLAGS += -Wno-format-security
*-g++*: QMAKE_CXXFLAGS += -Wno-maybe-uninitialized -fno-strict-overflow


!win32-msvc*: QMAKE_CFLAGS += -std=gnu99

# Don't turn warnings on (but don't suppress them either)
CONFIG -= warn_on warn_off

# Turn exceptions off
!win32-msvc*: QMAKE_CXXFLAGS += -fno-exceptions
CONFIG += exceptions_off

# Check if we have pkg-config
equals($$QMAKE_HOST.os, "Windows"):NUL=NUL
else:NUL=/dev/null
PKG_CONFIG_OUT = $$system(pkg-config --version 2> $$NUL)
!isEmpty(PKG_CONFIG_OUT) {
    CONFIG += link_pkgconfig
} else {
    message("pkg-config not found, no detection performed. See README for details")
}

#
# Find libdivecomputer
#
!isEmpty(LIBDCDEVEL) {
    # find it next to our sources
    INCLUDEPATH += ../libdivecomputer/include
    LIBS += ../libdivecomputer/src/.libs/libdivecomputer.a
    # Libusb-1.0 is only required if libdivecomputer was built with it.
    # And libdivecomputer is only built with it if libusb-1.0 is
    # installed. So get libusb if it exists, but don't complain
    # about it if it doesn't.
    LIBS += $$system(pkg-config --libs libusb-1.0 2> /dev/null)
} else:exists(/usr/local/lib/libdivecomputer.a) {
    LIBS += -L/usr/local/lib -ldivecomputer
} else:exists(/usr/local/lib64/libdivecomputer.a) {
    LIBS += -L/usr/local/lib64 -ldivecomputer
} else:link_pkgconfig {
    # find it via pkg-config
    PKGCONFIG += libdivecomputer
}

# Libusb-1.0 is only required if libdivecomputer was built with it.
# And libdivecomputer is only built with it if libusb-1.0 is
# installed. So get libusb if it exists, but don't complain
# about it if it doesn't.
#link_pkgconfig: packagesExist(libusb-1.0): PKGCONFIG += libusb-1.0

#
# Find libxml2 and libxslt
#
# They come with shell scripts that contain the information we need, so we just
# run them. They also come with pkg-config files, but those are missing on
# Mac (where they are part of the XCode-supplied tools).
#
XML2_CFLAGS = $$system(xml2-config --cflags 2>$$NUL)
XSLT_CFLAGS = $$system(xslt-config --cflags 2>$$NUL)
XML2_LIBS = $$system(xml2-config --libs 2>$$NUL)
XSLT_LIBS = $$system(xslt-config --libs 2>$$NUL)
link_pkgconfig {
    isEmpty(XML2_CFLAGS)|isEmpty(XML2_LIBS): \
        error("Could not find libxml2. Did you forget to install it?")
    isEmpty(XSLT_CFLAGS)|isEmpty(XSLT_LIBS): \
        error("Could not find libxslt. Did you forget to install it?")
}

QMAKE_CFLAGS *= $$XML2_CFLAGS $$XSLT_CFLAGS
QMAKE_CXXFLAGS *= $$XML2_CFLAGS $$XSLT_CFLAGS
LIBS *= $$XML2_LIBS $$XSLT_LIBS

#
# Find other pkg-config-based projects
# We're searching for:
#  libzip
#  sqlite3
link_pkgconfig: PKGCONFIG += libzip sqlite3

#
# Find libmarble
#
# Before Marble 4.9, the GeoDataTreeModel.h header wasn't installed
# Check if it's present by trying to compile
# ### FIXME: implement that
win32: CONFIG(debug, debug|release): LIBS += -lmarblewidgetd
else: LIBS += -lmarblewidget

#
# Platform-specific changes
#
win32 {
    LIBS += -lwsock32
    DEFINES -= UNICODE
}

#
# misc
#
!equals(V, 1): CONFIG += silent
MOC_DIR = .moc
UI_DIR = .uic
RCC_DIR = .rcc
OBJECTS_DIR = .obj