summaryrefslogtreecommitdiffstats
path: root/mkspecs
diff options
context:
space:
mode:
authorLorn Potter <lorn.potter@gmail.com>2020-09-03 18:29:41 +1000
committerLorn Potter <lorn.potter@gmail.com>2021-04-01 19:23:42 +1000
commit4972fdb350fe79e18b0413e74028cd9b9803f96b (patch)
tree1db1aed90773da8b543576819ea8a156e3748bb2 /mkspecs
parent5bf4133c1752c8d38afaac0064a0726d6036e52c (diff)
wasm: add cmake build support
A few configure defines get changed: QMAKE_WASM_PTHREAD_POOL_SIZE is now QT_WASM_PTHREAD_POOL_SIZE QMAKE_WASM_TOTAL_MEMORY is now QT_WASM_INITIAL_MEMORY QMAKE_WASM_SOURCE_MAP_BASE is now QT_WASM_SOURCE_MAP_BASE device-option EMSCRIPTEN_ASYNCIFY=1 is QT_EMSCRIPTEN_ASYNCIFY=1 To create source maps for debugging. use device-option QT_WASM_SOURCE_MAP=1 Task-number: QTBUG-78647 Change-Id: If9f30cd7fb408c386d6d69b5f7b1beecf1ab44b5 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'mkspecs')
-rw-r--r--mkspecs/features/wasm/wasm.prf24
-rw-r--r--mkspecs/wasm-emscripten/qmake.conf12
2 files changed, 18 insertions, 18 deletions
diff --git a/mkspecs/features/wasm/wasm.prf b/mkspecs/features/wasm/wasm.prf
index 2e886fc4a5..882d2e49c8 100644
--- a/mkspecs/features/wasm/wasm.prf
+++ b/mkspecs/features/wasm/wasm.prf
@@ -13,8 +13,8 @@ exists($$QMAKE_QT_CONFIG) {
# Create worker threads at startup. This is supposed to be an optimization,
# however exceeding the pool size has been obesverved to hang the application.
POOL_SIZE = 4
- !isEmpty(QMAKE_WASM_PTHREAD_POOL_SIZE) {
- POOL_SIZE = $$QMAKE_WASM_PTHREAD_POOL_SIZE
+ !isEmpty(QT_WASM_PTHREAD_POOL_SIZE) {
+ POOL_SIZE = $$QT_WASM_PTHREAD_POOL_SIZE
}
message("Setting PTHREAD_POOL_SIZE to" $$POOL_SIZE)
@@ -23,18 +23,18 @@ exists($$QMAKE_QT_CONFIG) {
EMCC_THREAD_LFLAGS += -s ALLOW_MEMORY_GROWTH=1
}
- qtConfig(thread) | !isEmpty(QMAKE_WASM_TOTAL_MEMORY) {
+ qtConfig(thread) | !isEmpty(QT_WASM_INITIAL_MEMORY) {
# Hardcode wasm memory size. Emscripten does not currently support memory growth
# (ALLOW_MEMORY_GROWTH) in pthreads mode, and requires specifying the memory size
# at build time. Further, browsers limit the maximum initial memory size to 1GB.
- # QMAKE_WASM_TOTAL_MEMORY must be a multiple of 64KB
- TOTAL_MEMORY = 1GB
- !isEmpty(QMAKE_WASM_TOTAL_MEMORY) {
- TOTAL_MEMORY = $$QMAKE_WASM_TOTAL_MEMORY
+ # QT_WASM_INITIAL_MEMORY must be a multiple of 64KB
+ INITIAL_MEMORY = 1GB
+ !isEmpty(QT_WASM_INITIAL_MEMORY) {
+ INITIAL_MEMORY = $$QT_WASM_INITIAL_MEMORY
}
- message("Setting TOTAL_MEMORY to" $$TOTAL_MEMORY)
- EMCC_THREAD_LFLAGS += -s TOTAL_MEMORY=$$TOTAL_MEMORY
+ message("Setting INITIAL_MEMORY to" $$INITIAL_MEMORY)
+ EMCC_THREAD_LFLAGS += -s INITIAL_MEMORY=$$INITIAL_MEMORY
}
QMAKE_LFLAGS += $$EMCC_THREAD_LFLAGS
QMAKE_LFLAGS_DEBUG += $$EMCC_THREAD_LFLAGS
@@ -117,9 +117,9 @@ qtConfTest_emccVersion()
# Pass --source-map-base on the linker line. This informs the
# browser where to find the source files when debugging.
WASM_SOURCE_MAP_BASE = http://localhost:8000/
-!isEmpty(QMAKE_WASM_SOURCE_MAP_BASE):\
- WASM_SOURCE_MAP_BASE = $$QMAKE_WASM_SOURCE_MAP_BASE
-CONFIG(debug): QMAKE_LFLAGS += --source-map-base $$WASM_SOURCE_MAP_BASE
+!isEmpty(QT_WASM_SOURCE_MAP_BASE):\
+ WASM_SOURCE_MAP_BASE = $$QT_WASM_SOURCE_MAP_BASE
+CONFIG(debug): QMAKE_LFLAGS += -g4 --source-map-base $$WASM_SOURCE_MAP_BASE
# Creates the stand-alone version of the library from bitcode
!static:contains(TEMPLATE, .*lib): {
diff --git a/mkspecs/wasm-emscripten/qmake.conf b/mkspecs/wasm-emscripten/qmake.conf
index 2b108a5e90..2788d925c4 100644
--- a/mkspecs/wasm-emscripten/qmake.conf
+++ b/mkspecs/wasm-emscripten/qmake.conf
@@ -8,11 +8,11 @@ include(../common/clang.conf)
load(device_config)
load(emcc_ver)
-# Support enabling asyncify by configuring with "-device-option EMSCRIPTEN_ASYNCIFY=1"
-!isEmpty(EMSCRIPTEN_ASYNCIFY): {
- !equals(EMSCRIPTEN_ASYNCIFY, 1):!equals(EMSCRIPTEN_ASYNCIFY, 0): \
- message(Error: The value for EMSCRIPTEN_ASYNCIFY must be 0 or 1)
- equals(EMSCRIPTEN_ASYNCIFY, 1): {
+# 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): {
QMAKE_CFLAGS += -DQT_HAVE_EMSCRIPTEN_ASYNCIFY
QMAKE_CXXFLAGS += -DQT_HAVE_EMSCRIPTEN_ASYNCIFY
QMAKE_LFLAGS += -s ASYNCIFY
@@ -56,7 +56,7 @@ EMCC_COMMON_LFLAGS_DEBUG = \
-s GL_DEBUG=1 \
--profiling-funcs
-QMAKE_LFLAGS_DEBUG += -g4
+QMAKE_LFLAGS_DEBUG += -g2
QMAKE_LFLAGS_RELEASE += -O2
QMAKE_COMPILER += emscripten