qt5base-lts/mkspecs/wasm-emscripten/qmake.conf
Morten Johan Sørvig 7d19dd7730 wasm: Change compiler flags to target "upstream" llvm
As of version 1.39, Emscripten now uses upstream llvm instead of
the "fastcomp" fork. As a result of this em++ no longer builds
via the asm.js text format, and the performance issues related
to text parsing are gone.

Reducing the binary size for debug builds is no longer needed,
and we can fall back to using the default build flags.

This effectively makes 1.39.x the minimum Emscripten version for
Qt 5.15. The "-fastcomp" SDK variant is not supported.

Change-Id: Id66ef77294a9accd1b103e34785458d71dc188b1
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2020-02-05 09:59:27 +00:00

87 lines
2.6 KiB
Plaintext

# qmake configuration for building with emscripten
MAKEFILE_GENERATOR = UNIX
QMAKE_PLATFORM = wasm unix
include(../common/gcc-base.conf)
include(../common/clang.conf)
load(device_config)
load(emcc_ver)
# Support setting WASM_OBJECT_FILES with -device-option WASM_OBJECT_FILES=1
!isEmpty(WASM_OBJECT_FILES): {
!equals(WASM_OBJECT_FILES, 1):!equals(WASM_OBJECT_FILES, 0): \
message(Error: The value for WASM_OBJECT_FILES must be 0 or 1)
QMAKE_CFLAGS += -s WASM_OBJECT_FILES=$$WASM_OBJECT_FILES
QMAKE_CXXFLAGS += -s WASM_OBJECT_FILES=$$WASM_OBJECT_FILES
QMAKE_LFLAGS += -s WASM_OBJECT_FILES=$$WASM_OBJECT_FILES
} else {
EMSCRIPTEN_VERSION=$$qtSystemEmccVersion()
lessThan(EMSCRIPTEN_VERSION, 1.39) {
EMCC_COMMON_LFLAGS += -s \"BINARYEN_TRAP_MODE=\'clamp\'\"
}
}
EMTERP_FLAGS = \
-s EMTERPRETIFY=1 \
-s EMTERPRETIFY_ASYNC=1 \
-s \"EMTERPRETIFY_FILE=\'data.binary\'\" \
-s ASSERTIONS=1 \
--profiling-funcs
EMCC_COMMON_LFLAGS += \
-s WASM=1 \
-s FULL_ES2=1 \
-s FULL_ES3=1 \
-s USE_WEBGL2=1 \
-s NO_EXIT_RUNTIME=0 \
-s ERROR_ON_UNDEFINED_SYMBOLS=1 \
-s EXTRA_EXPORTED_RUNTIME_METHODS=[\"UTF16ToString\",\"stringToUTF16\"] \
--bind
# The -s arguments can also be used with release builds,
# but are here in debug for clarity.
EMCC_COMMON_LFLAGS_DEBUG = \
$$EMCC_COMMON_LFLAGS \
-s ASSERTIONS=2 \
-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
-s GL_DEBUG=1
QMAKE_LFLAGS_DEBUG += -g
QMAKE_LFLAGS_RELEASE += -O2
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
equals(QMAKE_HOST.os, Windows) {
QMAKE_AR_CMD = \
"$(file >$(OBJECTS_DIR)/$(TARGET).rsp, $(subst \\,/,$(OBJECTS)))$$escape_expand(\\n\\t)" \
"$(AR) $(DESTDIR)$(TARGET) @$(OBJECTS_DIR)/$(TARGET).rsp"
}
QMAKE_DISTCLEAN += *.html *.js *.wasm
load(qt_config)