summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorThiago Marcos P. Santos <thiago@mapbox.com>2016-04-19 17:51:36 +0300
committerThiago Marcos P. Santos <thiago@mapbox.com>2016-04-20 20:55:51 +0300
commitc8c69f1d2a968dfc2556c3612e96ddba848ee885 (patch)
treea515b9e17ea8809b18c96c2e1808174b2ef57bbc /platform
parent029f9f088331fa0d04a9b75a7dbdae773f749f47 (diff)
downloadqtlocation-mapboxgl-c8c69f1d2a968dfc2556c3612e96ddba848ee885.tar.gz
[Qt] Build the Qt port
Diffstat (limited to 'platform')
-rw-r--r--platform/qt/app/qmapboxgl.gypi52
-rw-r--r--platform/qt/platform.gyp152
-rw-r--r--platform/qt/qt.gypi12
-rw-r--r--platform/qt/scripts/configure.sh37
4 files changed, 253 insertions, 0 deletions
diff --git a/platform/qt/app/qmapboxgl.gypi b/platform/qt/app/qmapboxgl.gypi
new file mode 100644
index 0000000000..c864d7d19e
--- /dev/null
+++ b/platform/qt/app/qmapboxgl.gypi
@@ -0,0 +1,52 @@
+{
+ 'targets': [
+ {
+ 'target_name': 'qt-app',
+ 'product_name': 'qmapboxgl',
+ 'type': 'executable',
+
+ 'includes': [
+ '../qt.gypi',
+ ],
+
+ 'dependencies': [
+ 'platform-lib',
+ ],
+
+ 'sources': [
+ 'main.cpp',
+ 'mapwindow.cpp',
+ 'mapwindow.hpp',
+ ],
+
+ 'include_dirs': [
+ '../include',
+ '../../../include',
+ ],
+
+ 'variables': {
+ 'cflags': [
+ '<@(opengl_cflags)',
+ '<@(qt_cflags)',
+ '-Wno-error', # TODO: eliminate
+ ],
+ 'ldflags': [
+ '<@(opengl_ldflags)',
+ '<@(qt_ldflags)'
+ ],
+ },
+
+ 'conditions': [
+ ['OS == "mac"', {
+ 'xcode_settings': {
+ 'OTHER_CPLUSPLUSFLAGS': [ '<@(cflags)' ],
+ 'OTHER_LDFLAGS': [ '<@(ldflags)', '-framework OpenGL' ],
+ },
+ }, {
+ 'cflags_cc': [ '<@(cflags)' ],
+ 'libraries': [ '<@(ldflags)' ],
+ }],
+ ],
+ },
+ ],
+}
diff --git a/platform/qt/platform.gyp b/platform/qt/platform.gyp
new file mode 100644
index 0000000000..1135ec4a6a
--- /dev/null
+++ b/platform/qt/platform.gyp
@@ -0,0 +1,152 @@
+{
+ 'variables': {
+ 'loop_lib': 'qt',
+ 'conditions': [
+ ['OS == "mac"', {
+ 'headless_lib': 'cgl',
+ }, {
+ 'headless_lib': 'glx',
+ }]
+ ],
+ 'qtlibversion': '1.0.0',
+ },
+ 'includes': [
+ 'app/qmapboxgl.gypi',
+ '../../mbgl.gypi',
+ '../../test/test.gypi',
+ ],
+ 'targets': [
+ {
+ 'target_name': 'platform-lib',
+ 'product_name': 'mbgl-platform-qt',
+ 'type': 'static_library',
+ 'standalone_static_library': 1,
+ 'hard_dependency': 1,
+
+ 'dependencies': [
+ 'core',
+ ],
+
+ 'includes': [
+ '../../platform/qt/qt.gypi',
+ ],
+
+ 'sources': [
+ '../default/asset_file_source.cpp',
+ '../default/default_file_source.cpp',
+ '../default/log_stderr.cpp',
+ '../default/mbgl/storage/offline.cpp',
+ '../default/mbgl/storage/offline_database.cpp',
+ '../default/mbgl/storage/offline_download.cpp',
+ '../default/online_file_source.cpp',
+ '../default/sqlite3.cpp',
+ '../default/string_stdlib.cpp',
+ '../default/thread.cpp',
+ 'include/qmapboxgl.hpp',
+ 'src/async_task.cpp',
+ 'src/async_task_impl.hpp',
+ 'src/http_file_source.cpp',
+ 'src/http_file_source.hpp',
+ 'src/http_request.cpp',
+ 'src/http_request.hpp',
+ 'src/image.cpp',
+ 'src/qmapboxgl.cpp',
+ 'src/qmapboxgl_p.hpp',
+ 'src/run_loop.cpp',
+ 'src/run_loop_impl.hpp',
+ 'src/timer.cpp',
+ 'src/timer_impl.hpp',
+ ],
+
+ 'variables': {
+ 'cflags': [
+ '<@(boost_cflags)',
+ '<@(nunicode_cflags)',
+ '<@(opengl_cflags)',
+ '<@(qt_cflags)',
+ '<@(rapidjson_cflags)',
+ '<@(sqlite_cflags)',
+ '<@(variant_cflags)',
+ '-Wno-error', # TODO: eliminate
+ '-fPIC',
+ ],
+ 'ldflags': [
+ '<@(nunicode_ldflags)',
+ '<@(opengl_ldflags)',
+ '<@(qt_ldflags)',
+ '<@(sqlite_ldflags)',
+ '<@(zlib_ldflags)',
+ ],
+ 'libraries': [
+ '<@(nunicode_static_libs)',
+ '<@(sqlite_static_libs)',
+ '<@(zlib_static_libs)',
+ ],
+ },
+
+ 'include_dirs': [
+ 'include',
+ '../default',
+ '../../include',
+ '../../src', # TODO: eliminate
+ ],
+
+ 'conditions': [
+ ['OS == "mac"', {
+ 'xcode_settings': {
+ 'OTHER_CPLUSPLUSFLAGS': [ '<@(cflags)' ],
+ }
+ }, {
+ 'cflags_cc': [ '<@(cflags)' ],
+ }]
+ ],
+
+ 'link_settings': {
+ 'conditions': [
+ ['OS == "mac"', {
+ 'libraries': [ '<@(libraries)' ],
+ 'xcode_settings': { 'OTHER_LDFLAGS': [ '<@(ldflags)' ] }
+ }, {
+ 'libraries': [ '<@(libraries)', '<@(ldflags)' ],
+ }]
+ ],
+ },
+ },
+ {
+ 'target_name': 'qt-lib',
+ 'product_name': 'qmapboxgl',
+ 'type': 'shared_library',
+ 'product_extension': 'so.<(qtlibversion)',
+
+ 'includes': [
+ 'qt.gypi',
+ ],
+
+ 'dependencies': [
+ 'platform-lib',
+ ],
+
+ 'link_settings': {
+ 'conditions': [
+ ['OS == "mac"', {
+ 'libraries': [ '-framework OpenGL' ],
+ 'xcode_settings': { 'OTHER_LDFLAGS': [ '-all_load' ] }
+ }]
+ ],
+ },
+ },
+ {
+ 'target_name': 'test',
+ 'type': 'executable',
+
+ 'dependencies': [
+ 'test-lib',
+ 'platform-lib',
+ ],
+
+ 'sources': [
+ '../../test/src/main.cpp',
+ ],
+ },
+ ],
+}
diff --git a/platform/qt/qt.gypi b/platform/qt/qt.gypi
new file mode 100644
index 0000000000..4bec63cd89
--- /dev/null
+++ b/platform/qt/qt.gypi
@@ -0,0 +1,12 @@
+{
+ 'rules': [
+ {
+ 'rule_name': 'MOC files',
+ 'extension': 'hpp',
+ 'process_outputs_as_sources': 1,
+ 'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/<(RULE_INPUT_DIRNAME)/moc_<(RULE_INPUT_ROOT).cpp' ],
+ 'action': [ '<(qt_moc)', '<(RULE_INPUT_PATH)', '-o', '<(SHARED_INTERMEDIATE_DIR)/<(RULE_INPUT_DIRNAME)/moc_<(RULE_INPUT_ROOT).cpp' ],
+ 'message': 'Generating MOC <(RULE_INPUT_ROOT).cpp',
+ },
+ ],
+}
diff --git a/platform/qt/scripts/configure.sh b/platform/qt/scripts/configure.sh
new file mode 100644
index 0000000000..5be71e27b8
--- /dev/null
+++ b/platform/qt/scripts/configure.sh
@@ -0,0 +1,37 @@
+#!/usr/bin/env bash
+
+BOOST_VERSION=1.59.0
+GEOJSONVT_VERSION=4.1.2
+GTEST_VERSION=1.7.0
+NUNICODE_VERSION=1.6
+PIXELMATCH_VERSION=0.9.0
+RAPIDJSON_VERSION=1.0.2
+SQLITE_VERSION=3.9.1
+VARIANT_VERSION=1.1.0
+ZLIB_VERSION=system
+
+if [ "$MASON_PLATFORM" == "osx" ]; then
+ function print_opengl_flags {
+ CONFIG+=" 'opengl_cflags%': [],"$LN
+ CONFIG+=" 'opengl_ldflags%': ['-framework OpenGL', '-framework CoreFoundation'],"$LN
+ }
+else
+ function print_opengl_flags {
+ CONFIG+=" 'opengl_cflags%': $(quote_flags $(pkg-config gl x11 --cflags)),"$LN
+ CONFIG+=" 'opengl_ldflags%': $(quote_flags $(pkg-config gl x11 --libs)),"$LN
+ }
+fi
+
+function print_qt_flags {
+ mason install Qt system
+
+ CONFIG+=" 'qt_cflags%': $(quote_flags $(mason cflags Qt system "QtCore QtGui QtOpenGL QtNetwork")),"$LN
+ CONFIG+=" 'qt_ldflags%': $(quote_flags $(mason ldflags Qt system "QtCore QtGui QtOpenGL QtNetwork")),"$LN
+
+ QT_VERSION_MAJOR=$(qmake -query QT_VERSION | cut -d. -f1)
+ if [ ${QT_VERSION_MAJOR} -gt 4 ] ; then
+ CONFIG+=" 'qt_moc%': '$(pkg-config Qt${QT_VERSION_MAJOR}Core --variable=host_bins)/moc',"$LN
+ else
+ CONFIG+=" 'qt_moc%': '$(pkg-config QtCore --variable=moc_location)',"$LN
+ fi
+}