summaryrefslogtreecommitdiffstats
path: root/subsurface-configure.pri
diff options
context:
space:
mode:
authorGravatar Thiago Macieira <thiago@macieira.org>2013-10-06 17:52:34 -0700
committerGravatar Thiago Macieira <thiago@macieira.org>2013-10-08 23:29:33 -0700
commit67e49d6480126968a1d87a12ae6e967b861e8909 (patch)
tree4be495009e2eb716076bdb18389f683470f0f072 /subsurface-configure.pri
parent2e43769108d4023c215451fa8116abdc991e0f19 (diff)
downloadsubsurface-67e49d6480126968a1d87a12ae6e967b861e8909.tar.gz
Implement a qmake-based build for Subsurface
This is working for me, but requires a bit more testing. To build, run: qmake [options] Where options might be: V=1 disable "silent" build LIBDCDEVEL=1 use side-by-side libdivecomputer INCLUDEPATH+=xxx add -Ixxx (e.g., INCLUDEPATH+=/usr/local/marble/include) LIBS+=xxx add xxx to the linker flags (e.g. LIBS+=-L/usr/local/marble/lib) or any other qmake option, including debug and release options If your distribution is already using qtchooser in place of qmake, you may need to pass an extra option to qmake to select the a cross-build. For example: qmake -qt=i686-w64-mingw32-qt4 If your distribution is not yet using qtchooser, then you need to file a bug report requesting it and you need to run the full path to qmake. Note: - there are some ### left in the buildsystem Signed-off-by: Thiago Macieira <thiago@macieira.org>
Diffstat (limited to 'subsurface-configure.pri')
-rw-r--r--subsurface-configure.pri95
1 files changed, 95 insertions, 0 deletions
diff --git a/subsurface-configure.pri b/subsurface-configure.pri
new file mode 100644
index 000000000..93f14003c
--- /dev/null
+++ b/subsurface-configure.pri
@@ -0,0 +1,95 @@
+#
+# 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
+!win32-msvc*: QMAKE_CFLAGS += -std=gnu99
+
+# Check if we have pkg-config
+equals($$QMAKE_HOST.os, "Windows"):NUL=NUL
+else:NUL=/dev/null
+system(pkg-config --version 2>$$NUL >$$NUL) {
+ 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 += -L../libdivecomputer/src/.libs -ldivecomputer
+} 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