diff options
author | Milian Wolff <milian.wolff@kdab.com> | 2014-08-04 16:16:22 +0200 |
---|---|---|
committer | Milian Wolff <milian.wolff@kdab.com> | 2014-08-07 13:32:41 +0200 |
commit | 4ce1fd950d8c20d21c851340350fb2b1dc920ce4 (patch) | |
tree | 6913a5e690354884884865ae1dc192a411a3aca4 /examples/qwebchannel/exampleassets.pri | |
parent | c18879b89f770ea8964828587e3ab19c32393720 (diff) | |
download | qtwebchannel-4ce1fd950d8c20d21c851340350fb2b1dc920ce4.tar.gz |
Make standalone example mostly self-contained.
Install qwebchannel.js file and also copy it to the build dir.
This makes the examples subdirectory self-contained and useable when
compiling it from the install directory. Making individual examples
self-contained would cause too much code duplication, so it was not
done.
Change-Id: Ifeb5eac7d05b92779d24cb4da413f3fb173f992d
Reviewed-by: Sumedha Widyadharma <sumedha.widyadharma@basyskom.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Diffstat (limited to 'examples/qwebchannel/exampleassets.pri')
-rw-r--r-- | examples/qwebchannel/exampleassets.pri | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/examples/qwebchannel/exampleassets.pri b/examples/qwebchannel/exampleassets.pri new file mode 100644 index 0000000..035ca12 --- /dev/null +++ b/examples/qwebchannel/exampleassets.pri @@ -0,0 +1,31 @@ +# This adds the qwebchannel js library to an example, creating a self-contained bundle +QTDIR_build { + # Build from within Qt. Copy and install the reference lib. + jslib = $$dirname(_QMAKE_CONF_)/src/webchannel/qwebchannel.js + copyfiles = $$jslib +} else { + # This is what an actual 3rd party project would do. + jslib = qwebchannel.js +} + +# This installs all assets including qwebchannel.js, regardless of the source. +exampleassets.files += $$jslib +INSTALLS += exampleassets + +# This code ensures that all assets are present in the build directory. + +!equals(_PRO_FILE_PWD_, $$OUT_PWD) { + # Shadow build, copy all example assets. + copyfiles = $$exampleassets.files +} + +defineReplace(stripSrcDir) { + return($$basename(1)) +} + +assetcopy.input = copyfiles +assetcopy.output = $$OUT_PWD/${QMAKE_FUNC_FILE_IN_stripSrcDir} +assetcopy.commands = $$QMAKE_COPY ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT} +assetcopy.name = COPY ${QMAKE_FILE_IN} +assetcopy.CONFIG = no_link target_predeps +QMAKE_EXTRA_COMPILERS += assetcopy |