summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2017-03-22 15:42:35 +0200
committerBruno de Oliveira Abinader <bruno@mapbox.com>2017-03-23 16:09:07 +0200
commit1c757cce34344dfecc9a724034680225143f92b7 (patch)
tree2115ed73b715f166f219b6a0b306b64d206f81ac
parenta3f40d0c0c906400439eeb25d50f39eac64327ef (diff)
downloadqtlocation-mapboxgl-1c757cce34344dfecc9a724034680225143f92b7.tar.gz
[build] Autodetect Qt{4,5}
-rw-r--r--.travis.yml2
-rw-r--r--Makefile20
-rw-r--r--platform/qt/bitrise-qt4.yml1
-rwxr-xr-xscripts/check-qt.sh9
4 files changed, 22 insertions, 10 deletions
diff --git a/.travis.yml b/.travis.yml
index 256e6a2aaa..cc7f715490 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -166,7 +166,7 @@ matrix:
dist: trusty
language: cpp
compiler: "qt4-gcc5-release"
- env: BUILDTYPE=Release _CXX=g++-5 _CC=gcc-5 WITH_QT_4=1
+ env: BUILDTYPE=Release _CXX=g++-5 _CC=gcc-5
addons: *qt4
before_script:
- mapbox_start_xvfb
diff --git a/Makefile b/Makefile
index 0edfe685a2..2eb2728b8a 100644
--- a/Makefile
+++ b/Makefile
@@ -361,20 +361,23 @@ endif
#### Qt targets #####################################################
-ifeq ($(WITH_QT_4), 1)
-QT_ROOT_PATH = build/qt4-$(BUILD_PLATFORM)-$(BUILD_PLATFORM_VERSION)
-else
-QT_ROOT_PATH = build/qt-$(BUILD_PLATFORM)-$(BUILD_PLATFORM_VERSION)
-endif
-
-ifneq (,$(shell which qmake))
-export QT_INSTALL_DOCS = $(shell qmake -query QT_INSTALL_DOCS)
+QT_QMAKE_FOUND := $(shell command -v qmake 2> /dev/null)
+ifdef QT_QMAKE_FOUND
+ export QT_INSTALL_DOCS = $(shell qmake -query QT_INSTALL_DOCS)
+ ifeq ($(shell qmake -query QT_VERSION | head -c1), 4)
+ QT_ROOT_PATH = build/qt4-$(BUILD_PLATFORM)-$(BUILD_PLATFORM_VERSION)
+ WITH_QT_4=1
+ else
+ QT_ROOT_PATH = build/qt-$(BUILD_PLATFORM)-$(BUILD_PLATFORM_VERSION)
+ WITH_QT_4=0
+ endif
endif
export QT_OUTPUT_PATH = $(QT_ROOT_PATH)/$(BUILDTYPE)
QT_BUILD = $(QT_OUTPUT_PATH)/build.ninja
$(QT_BUILD): $(BUILD_DEPS)
+ @scripts/check-qt.sh
mkdir -p $(QT_OUTPUT_PATH)
(cd $(QT_OUTPUT_PATH) && cmake -G Ninja ../../.. \
-DCMAKE_BUILD_TYPE=$(BUILDTYPE) \
@@ -392,6 +395,7 @@ ifeq ($(HOST_PLATFORM), macos)
MACOS_QT_PROJ_PATH = $(QT_ROOT_PATH)/xcode/mbgl.xcodeproj
$(MACOS_QT_PROJ_PATH): $(BUILD_DEPS)
+ @scripts/check-qt.sh
mkdir -p $(QT_ROOT_PATH)/xcode
(cd $(QT_ROOT_PATH)/xcode && cmake -G Xcode ../../.. \
-DMBGL_PLATFORM=qt \
diff --git a/platform/qt/bitrise-qt4.yml b/platform/qt/bitrise-qt4.yml
index 0a08d684fc..d8c7e0788e 100644
--- a/platform/qt/bitrise-qt4.yml
+++ b/platform/qt/bitrise-qt4.yml
@@ -19,7 +19,6 @@ workflows:
brew link qt
brew linkapps qt
export BUILDTYPE=Debug
- export WITH_QT_4=1
make qt-app
make run-qt-test
- is_debug: 'yes'
diff --git a/scripts/check-qt.sh b/scripts/check-qt.sh
new file mode 100755
index 0000000000..5780038243
--- /dev/null
+++ b/scripts/check-qt.sh
@@ -0,0 +1,9 @@
+#!/usr/bin/env bash
+
+set -e
+set -o pipefail
+
+if [ ! $(command -v qmake 2> /dev/null) ]; then
+ echo "No qmake found - missing Qt development files"
+ exit 1
+fi