From f6c8798001bbf647ccd4b52d9d520f117615be23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20S=C3=B8rvig?= Date: Mon, 26 Apr 2021 11:00:39 +0200 Subject: [PATCH] =?UTF-8?q?WASM:=20Don=E2=80=99t=20set=20=E2=80=9C-g4?= =?UTF-8?q?=E2=80=9D=20by=20default=20for=20qmake=20builds?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This increases link time significantly; instead set "-g4" or the new "-gsource-map" only if source maps are enabled. Change-Id: Ibe2d438d48e9ae2fce5f79d4e8a9f17c01cf2485 Reviewed-by: Morten Johan Sørvig --- mkspecs/features/wasm/wasm.prf | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/mkspecs/features/wasm/wasm.prf b/mkspecs/features/wasm/wasm.prf index 882d2e49c8..5ffc647135 100644 --- a/mkspecs/features/wasm/wasm.prf +++ b/mkspecs/features/wasm/wasm.prf @@ -114,12 +114,24 @@ contains(TEMPLATE, .*app) { 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(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 +CONFIG(debug):!isEmpty(QT_WASM_SOURCE_MAP) { + + EMCC_VERSION = $$qtSystemEmccVersion() + + greaterThan(EMCC_VERSION, 2.0.16) { + # emsdk 2.0.17 depreciates use of -g4 + QMAKE_LFLAGS += -gsource-map + } else { + QMAKE_LFLAGS += -g4 + } + # 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(QT_WASM_SOURCE_MAP_BASE):\ + WASM_SOURCE_MAP_BASE = $$QT_WASM_SOURCE_MAP_BASE + QMAKE_LFLAGS += --source-map-base $$WASM_SOURCE_MAP_BASE +} + # Creates the stand-alone version of the library from bitcode !static:contains(TEMPLATE, .*lib): {