2018-06-01 13:13:30 +00:00
|
|
|
# qmake configuration for building with emscripten
|
|
|
|
MAKEFILE_GENERATOR = UNIX
|
|
|
|
QMAKE_PLATFORM = wasm unix
|
|
|
|
|
|
|
|
include(../common/gcc-base.conf)
|
|
|
|
include(../common/clang.conf)
|
|
|
|
|
2018-12-13 11:15:11 +00:00
|
|
|
load(device_config)
|
2019-12-11 23:38:20 +00:00
|
|
|
load(emcc_ver)
|
2018-12-13 11:15:11 +00:00
|
|
|
|
2020-09-03 08:29:41 +00:00
|
|
|
# Support enabling asyncify by configuring with "-device-option QT_EMSCRIPTEN_ASYNCIFY=1"
|
|
|
|
!isEmpty(QT_EMSCRIPTEN_ASYNCIFY): {
|
|
|
|
!equals(QT_EMSCRIPTEN_ASYNCIFY, 1):!equals(QT_EMSCRIPTEN_ASYNCIFY, 0): \
|
|
|
|
message(Error: The value for QT_EMSCRIPTEN_ASYNCIFY must be 0 or 1)
|
|
|
|
equals(QT_EMSCRIPTEN_ASYNCIFY, 1): {
|
2020-02-13 10:16:36 +00:00
|
|
|
QMAKE_CFLAGS += -DQT_HAVE_EMSCRIPTEN_ASYNCIFY
|
|
|
|
QMAKE_CXXFLAGS += -DQT_HAVE_EMSCRIPTEN_ASYNCIFY
|
|
|
|
QMAKE_LFLAGS += -s ASYNCIFY
|
|
|
|
|
|
|
|
# Emscripten recommends building with optimizations when using asyncify
|
|
|
|
# in order to reduce wasm file size, and may also generate broken wasm
|
|
|
|
# (with "wasm validation error: too many locals" type errors) if optimizations
|
|
|
|
# are omitted. Enable optimizations also for debug builds.
|
|
|
|
QMAKE_LFLAGS_DEBUG += -Os
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-08-08 22:05:33 +00:00
|
|
|
# Declare async functions
|
|
|
|
QMAKE_LFLAGS += -s \'ASYNCIFY_IMPORTS=qt_asyncify_suspend_js,qt_asyncify_resume_js\'
|
|
|
|
|
2019-12-03 00:21:20 +00:00
|
|
|
EMCC_COMMON_LFLAGS += \
|
2018-06-01 13:13:30 +00:00
|
|
|
-s WASM=1 \
|
2022-06-20 06:19:32 +00:00
|
|
|
-s MAX_WEBGL_VERSION=2 \
|
2018-06-01 13:13:30 +00:00
|
|
|
-s ERROR_ON_UNDEFINED_SYMBOLS=1 \
|
2019-09-06 21:06:30 +00:00
|
|
|
--bind \
|
2021-05-21 09:14:34 +00:00
|
|
|
-s FETCH=1 \
|
|
|
|
-s MODULARIZE=1 \
|
2022-05-10 07:09:51 +00:00
|
|
|
-s EXPORT_NAME=createQtAppInstance \
|
|
|
|
-s WASM_BIGINT=1
|
2018-06-01 13:13:30 +00:00
|
|
|
|
2018-10-19 17:23:59 +00:00
|
|
|
# The -s arguments can also be used with release builds,
|
|
|
|
# but are here in debug for clarity.
|
2018-06-01 13:13:30 +00:00
|
|
|
EMCC_COMMON_LFLAGS_DEBUG = \
|
|
|
|
$$EMCC_COMMON_LFLAGS \
|
|
|
|
-s DEMANGLE_SUPPORT=1 \
|
|
|
|
# -s LIBRARY_DEBUG=1 \ #print out library calls, verbose
|
|
|
|
# -s SYSCALL_DEBUG=1 \ #print out sys calls, verbose
|
|
|
|
# -s FS_LOG=1 \ #print out filesystem ops, verbose
|
|
|
|
# -s SOCKET_DEBUG \ #print out socket,network data transfer
|
2022-08-26 10:54:44 +00:00
|
|
|
# -s GL_DEBUG=1 \
|
2020-04-22 00:29:15 +00:00
|
|
|
--profiling-funcs
|
2018-06-01 13:13:30 +00:00
|
|
|
|
2020-09-03 08:29:41 +00:00
|
|
|
QMAKE_LFLAGS_DEBUG += -g2
|
2020-01-27 13:41:23 +00:00
|
|
|
QMAKE_LFLAGS_RELEASE += -O2
|
2018-12-13 11:15:11 +00:00
|
|
|
|
2018-06-01 13:13:30 +00:00
|
|
|
QMAKE_COMPILER += emscripten
|
|
|
|
|
|
|
|
QMAKE_CC = emcc
|
|
|
|
QMAKE_CXX = em++
|
|
|
|
|
|
|
|
QMAKE_LINK = $$QMAKE_CXX
|
|
|
|
QMAKE_LINK_SHLIB = $$QMAKE_CXX
|
|
|
|
QMAKE_LINK_C = $$QMAKE_CC
|
|
|
|
QMAKE_LINK_C_SHLIB = $$QMAKE_CC
|
|
|
|
|
|
|
|
QMAKE_LIBS_THREAD = $$QMAKE_CFLAGS_THREAD
|
|
|
|
|
|
|
|
QMAKE_LFLAGS += $$EMCC_COMMON_LFLAGS
|
|
|
|
QMAKE_LFLAGS_DEBUG += $$EMCC_COMMON_LFLAGS_DEBUG
|
|
|
|
|
|
|
|
QMAKE_PREFIX_SHLIB = lib
|
|
|
|
QMAKE_EXTENSION_SHLIB = so # llvm bitcode, linked to js in post_link
|
|
|
|
QMAKE_PREFIX_STATICLIB = lib
|
|
|
|
QMAKE_EXTENSION_STATICLIB = a # llvm bitcode
|
|
|
|
|
|
|
|
QMAKE_AR = emar cqs
|
2019-04-30 10:01:23 +00:00
|
|
|
equals(QMAKE_HOST.os, Windows) {
|
2022-02-18 08:03:41 +00:00
|
|
|
QMAKE_RESPONSEFILE_THRESHOLD = 1
|
2019-04-30 10:01:23 +00:00
|
|
|
QMAKE_AR_CMD = \
|
2019-05-09 09:58:23 +00:00
|
|
|
"$(file >$(OBJECTS_DIR)/$(TARGET).rsp, $(subst \\,/,$(OBJECTS)))$$escape_expand(\\n\\t)" \
|
2019-04-30 10:01:23 +00:00
|
|
|
"$(AR) $(DESTDIR)$(TARGET) @$(OBJECTS_DIR)/$(TARGET).rsp"
|
|
|
|
}
|
|
|
|
|
2018-06-01 13:13:30 +00:00
|
|
|
QMAKE_DISTCLEAN += *.html *.js *.wasm
|
|
|
|
|
|
|
|
load(qt_config)
|