qt5base-lts/mkspecs/features/wasm/wasm.prf
Eskil Abrahamsen Blomfeldt 79e4fe54bf WebAssembly: Fix compilation of application on Windows host
When running configure on a Windows host, it would fail with the
error that the copy statement was invalid, due to the forward
slashes. This makes configure finish without errors.

Task-number: QTBUG-72000
Change-Id: Id315d7436bbbfd2cd5c5f2dfcfe0c3dc3b9e34c2
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2018-12-03 08:48:28 +00:00

82 lines
3.0 KiB
Plaintext

# DESTDIR will be empty if not set in the app .pro file; make sure it has a value
isEmpty(DESTDIR): DESTDIR = $$OUT_PWD
# Create js and wasm files for applications
contains(TEMPLATE, .*app) {
TARGET_BASE = $${TARGET}
TARGET_HTML = $${TARGET}.html
TARGET_JS = $${TARGET}.js
# Make the emscripten compiler generate a js file
TARGET = $$TARGET_JS
QMAKE_INCDIR += $$(HOME)/.emscripten_ports/openssl/include
CONFIG += static
js_file.files = $$TARGET_JS
js_file.path = $$target.path
isEmpty(js_file.path): \
js_file.path += ./
INSTALLS += js_file
# Copy hosting html and javascript to the application build directory.
exists($$[QT_INSTALL_PLUGINS]/platforms/wasm_shell.html) {
# don't pass this until it's installed somewhere
# otherwise makespec test fails during qt configure
WASM_PLUGIN_PATH = $$[QT_INSTALL_PLUGINS]/platforms
} else {
## internal build. not installed
WASM_PLUGIN_PATH = $$PWD/../../../src/plugins/platforms/wasm
}
# Copy/Generate main .html file (e.g. myapp.html) from the webassembly_shell.html by
# replacing the app name placeholder with the actual app name.
apphtml.name = application main html file
apphtml.output = $$DESTDIR/$$TARGET_HTML
apphtml.commands = sed -e s/APPNAME/$$TARGET_BASE/g $$WASM_PLUGIN_PATH/wasm_shell.html > $$DESTDIR/$$TARGET_HTML
apphtml.input = $$WASM_PLUGIN_PATH/wasm_shell.html
apphtml.depends = $$apphtml.input
QMAKE_EXTRA_COMPILERS += apphtml
appjs.name = application qtloader.js
appjs.output = $$DESTDIR/qtloader.js
appjs.commands = $$QMAKE_COPY $$shell_path($$WASM_PLUGIN_PATH/qtloader.js) $$shell_path($$DESTDIR)
appjs.input = $$WASM_PLUGIN_PATH/qtloader.js
appjs.depends = $$appjs.input
QMAKE_EXTRA_COMPILERS += appjs
appsvg.name = application qtlogo.svg
appsvg.output = $$DESTDIR/qtlogo.svg
appsvg.commands = $$QMAKE_COPY $$shell_path($$WASM_PLUGIN_PATH/qtlogo.svg) $$shell_path($$DESTDIR)
appsvg.input = $$WASM_PLUGIN_PATH/qtlogo.svg
appsvg.depends = $$appsvg.input
QMAKE_EXTRA_COMPILERS += appsvg
QMAKE_EXTRA_TARGETS += apphtml appjs appsvg
POST_TARGETDEPS += apphtml appjs appsvg
# Add manual target to make "make -B shellfiles" work.
shellfiles.target = shellfiles
shellfiles.depends = apphtml appjs appsvg
QMAKE_EXTRA_TARGETS += shellfiles
# emscripten ports are linked into the main module (this app), not the Qt
# libs which reference them
qt {
qt_depends = $$resolve_depends(QT, "QT.")
contains(qt_depends, core(-private)?): QMAKE_LFLAGS += \
$$QMAKE_LIBS_THREAD $$QMAKE_LIBS_ZLIB
contains(qt_depends, gui(-private)?): QMAKE_LFLAGS += \
$$QMAKE_LIBS_FREETYPE $$QMAKE_LIBS_LIBPNG
}
}
# Creates the stand-alone version of the library from bitcode
!static:contains(TEMPLATE, .*lib): {
load(resolve_target)
QMAKE_POST_LINK += $$QMAKE_LINK_SHLIB $$QMAKE_RESOLVED_TARGET -o $${QMAKE_RESOLVED_TARGET}.js
QMAKE_INCDIR += $$(HOME)/.emscripten_ports/openssl/include
}