[Qt] Build the Qt port
This commit is contained in:
18
Makefile
18
Makefile
@@ -165,6 +165,24 @@ test-node: node
|
||||
npm test
|
||||
npm run test-suite
|
||||
|
||||
#### Qt targets #####################################################
|
||||
|
||||
.PHONY: qt-lib
|
||||
qt-lib:
|
||||
$(RUN) PLATFORM=qt Makefile/qt-lib
|
||||
|
||||
.PHONY: qt-app
|
||||
qt-app:
|
||||
$(RUN) PLATFORM=qt Makefile/qt-app
|
||||
|
||||
.PHONY: run-qt-app
|
||||
run-qt-app: qt-app
|
||||
$(RUN) PLATFORM=qt run-qt-app
|
||||
|
||||
.PHONY: test-qt
|
||||
test-qt: node_modules/express
|
||||
$(RUN) PLATFORM=qt test-*
|
||||
|
||||
#### Miscellaneous targets #####################################################
|
||||
|
||||
.PHONY: linux
|
||||
|
||||
7
configure
vendored
7
configure
vendored
@@ -60,6 +60,12 @@ function print_opengl_flags {
|
||||
CONFIG+=" 'opengl_ldflags%': [],"$LN
|
||||
}
|
||||
|
||||
function print_qt_flags {
|
||||
CONFIG+=" 'qt_cflags%': [], "$LN
|
||||
CONFIG+=" 'qt_ldflags%': [], "$LN
|
||||
CONFIG+=" 'qt_moc%': [], "$LN
|
||||
}
|
||||
|
||||
# Load dependencies
|
||||
source ${INPUT_FILE}
|
||||
|
||||
@@ -91,6 +97,7 @@ CONFIG+=" },"$LN
|
||||
CONFIG+=" 'variables': {"$LN
|
||||
|
||||
print_opengl_flags
|
||||
print_qt_flags
|
||||
|
||||
print_flags boost cflags
|
||||
print_flags boost_libprogram_options static_libs
|
||||
|
||||
52
platform/qt/app/qmapboxgl.gypi
Normal file
52
platform/qt/app/qmapboxgl.gypi
Normal file
@@ -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)' ],
|
||||
}],
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
152
platform/qt/platform.gyp
Normal file
152
platform/qt/platform.gyp
Normal file
@@ -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',
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
12
platform/qt/qt.gypi
Normal file
12
platform/qt/qt.gypi
Normal file
@@ -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',
|
||||
},
|
||||
],
|
||||
}
|
||||
37
platform/qt/scripts/configure.sh
Normal file
37
platform/qt/scripts/configure.sh
Normal file
@@ -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
|
||||
}
|
||||
@@ -34,6 +34,20 @@ export PLATFORM_OUTPUT = ./build/$(PLATFORM_SLUG)
|
||||
export PLATFORM_CONFIG_INPUT = platform/$(MASON_PLATFORM)/scripts/configure.sh
|
||||
export PLATFORM_CONFIG_OUTPUT = $(PLATFORM_OUTPUT)/config.gypi
|
||||
|
||||
ifeq ($(PLATFORM),qt)
|
||||
ifeq ($(shell uname -s), Darwin)
|
||||
export MASON_PLATFORM = osx
|
||||
export MASON_PLATFORM_VERSION = $(SUBPLATFORM)
|
||||
export PLATFORM_SLUG = qt-osx-$(SUBPLATFORM)
|
||||
export PLATFORM_CONFIG_INPUT = platform/qt/scripts/configure.sh
|
||||
else ifeq ($(shell uname -s), Linux)
|
||||
export MASON_PLATFORM = linux
|
||||
export MASON_PLATFORM_VERSION = $(SUBPLATFORM)
|
||||
export PLATFORM_SLUG = qt-linux-$(SUBPLATFORM)
|
||||
export PLATFORM_CONFIG_INPUT = platform/qt/scripts/configure.sh
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq (,$(findstring clang,$(CXX)))
|
||||
CXX_HOST = "clang"
|
||||
else ifneq (,$(findstring g++,$(CXX)))
|
||||
@@ -124,6 +138,9 @@ tidy: Ninja/compdb
|
||||
run-glfw-app:
|
||||
cd $(PLATFORM_OUTPUT)/$(BUILDTYPE) && ./mapbox-glfw
|
||||
|
||||
run-qt-app:
|
||||
cd $(PLATFORM_OUTPUT)/$(BUILDTYPE) && ./qmapboxgl
|
||||
|
||||
run-valgrind-glfw-app:
|
||||
cd $(PLATFORM_OUTPUT)/$(BUILDTYPE) && valgrind --leak-check=full --suppressions=../../../scripts/valgrind.sup ./mapbox-glfw
|
||||
|
||||
|
||||
Reference in New Issue
Block a user