Skip to content

Commit

Permalink
[qt] Build with WebAssembly (mapbox#256)
Browse files Browse the repository at this point in the history
  • Loading branch information
ntadej authored Mar 15, 2022
1 parent 6db27f5 commit 59fa32e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion platform/default/src/mbgl/storage/mbtiles_file_source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

#include <mbgl/storage/sqlite3.hpp>

#if defined(__QT__) && defined(_WIN32)
#if defined(__QT__) && (defined(_WIN32) || defined(__EMSCRIPTEN__))
#include <QtZlib/zlib.h>
#else
#include <zlib.h>
Expand Down
2 changes: 1 addition & 1 deletion platform/default/src/mbgl/util/compression.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <mbgl/util/compression.hpp>

#if defined(__QT__) && defined(_WIN32)
#if defined(__QT__) && (defined(_WIN32) || defined(__EMSCRIPTEN__))
#include <QtZlib/zlib.h>
#else
#include <zlib.h>
Expand Down
6 changes: 5 additions & 1 deletion platform/qt/qt.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ set_property(TARGET mbgl-core PROPERTY AUTOMOC ON)
target_link_libraries(
mbgl-core
PRIVATE
$<$<NOT:$<PLATFORM_ID:Windows>>:z>
$<$<NOT:$<PLATFORM_ID:Windows,Emscripten>>:z>
Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::Gui
Qt${QT_VERSION_MAJOR}::Network
Expand Down Expand Up @@ -294,6 +294,10 @@ if(NOT MBGL_QT_LIBRARY_ONLY)
${PROJECT_SOURCE_DIR}/platform/qt/resources/common.qrc
)

if(CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
set(CMAKE_EXECUTABLE_SUFFIX ".html")
endif()

# Qt public API should keep compatibility with old compilers for legacy systems
set_property(TARGET mbgl-qt PROPERTY CXX_STANDARD 98)
set_property(TARGET mbgl-qt PROPERTY AUTOMOC ON)
Expand Down

0 comments on commit 59fa32e

Please sign in to comment.