diff options
Diffstat (limited to 'src/tools/nacldeployqt')
-rw-r--r-- | src/tools/nacldeployqt/main.cpp | 16 | ||||
-rw-r--r-- | src/tools/nacldeployqt/template_qtloader.cpp | 25 |
2 files changed, 25 insertions, 16 deletions
diff --git a/src/tools/nacldeployqt/main.cpp b/src/tools/nacldeployqt/main.cpp index cdc982e8f8..418c5fc4e7 100644 --- a/src/tools/nacldeployqt/main.cpp +++ b/src/tools/nacldeployqt/main.cpp @@ -46,7 +46,7 @@ private: QString findPNaClTool(const QString &sdkRoot, const QString &toolName); QList<QByteArray> quote(const QList<QByteArray> &list); void runCommand(const QString &command); - bool copyRecursively(const QString &srcFilePath, const QString &tgtFilePath); + bool copyRecursively(const QString &srcFilePath, const QString &tgtFilePath, bool skipBinaries); QByteArray instantiateTemplate(const QByteArray &tmplate); void instantiateWriteTemplate(const QByteArray &tmplate, const QString &filePath); }; @@ -172,7 +172,11 @@ int QtNaclDeployer::deploy() QString target = targetBase + "/" + import; // TODO: Skip the binaries for static builds; they will be built into the main nexe - copyRecursively(source, target); + bool skipBinaries = false; + if (deploymentType == Emscripten) { + skipBinaries = true; + } + copyRecursively(source, target, skipBinaries); } } @@ -390,7 +394,8 @@ void QtNaclDeployer::runCommand(const QString &command) } bool QtNaclDeployer::copyRecursively(const QString &srcFilePath, - const QString &tgtFilePath) + const QString &tgtFilePath, + bool skipBinaries) { QFileInfo srcFileInfo(srcFilePath); if (srcFileInfo.isDir()) { @@ -402,11 +407,14 @@ bool QtNaclDeployer::copyRecursively(const QString &srcFilePath, QDir sourceDir(srcFilePath); QStringList fileNames = sourceDir.entryList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot | QDir::Hidden | QDir::System); foreach (const QString &fileName, fileNames) { + if (skipBinaries && (fileName.endsWith(".so") || fileName.endsWith(".a"))) { + continue; + } const QString newSrcFilePath = srcFilePath + QLatin1Char('/') + fileName; const QString newTgtFilePath = tgtFilePath + QLatin1Char('/') + fileName; - if (!copyRecursively(newSrcFilePath, newTgtFilePath)) + if (!copyRecursively(newSrcFilePath, newTgtFilePath, skipBinaries)) return false; } } else { diff --git a/src/tools/nacldeployqt/template_qtloader.cpp b/src/tools/nacldeployqt/template_qtloader.cpp index fdf3d313ad..201e387066 100644 --- a/src/tools/nacldeployqt/template_qtloader.cpp +++ b/src/tools/nacldeployqt/template_qtloader.cpp @@ -2,7 +2,7 @@ const char *templateQtLoader = R"STRING_DELIMITER( // This script is generated by nacldeployqt as a part of the standard // Qt deployment. It can be used either as-is or as a basis for a // custom deployment solution. Note that some parts of this script -// (such as onMessage) is required by Qt. +// (such as onMessage) are required by Qt. // // Usage: // @@ -49,6 +49,10 @@ const char *templateQtLoader = R"STRING_DELIMITER( // 1) As argn, argv key/value pairs to Init() of a QPepperInstance subclass. // 2) As environment variables: toUpper(key)=value. +var doCreateInstance = function () { + console.log("Please call QtLoader.load() instead of loading your application script.") +} + function QtLoader(config) { var self = this; self.config = config; @@ -182,14 +186,6 @@ function onLoad(event) self.embed.style.visibility = "visible" } -function loadScript(src, onload) -{ - var script = document.createElement('script') - script.src = src - script.onload = function () { onload() }; - document.head.appendChild(script); -} - // Create Qt container element, possibly re-using existingElement function createElement(existingElement) { @@ -263,15 +259,20 @@ function loadEmscripten() var height = self.listener.offsetHeight var embed = document.createElement("div"); + self.embed = embed embed.setAttribute("class", "qt-embed"); self.listener.appendChild(embed); self.listener.embed = embed; - loadScript(config.src, function(){ + doCreateInstance = function() { CreateInstance(width, height, embed); embed.finishLoading(); - }) -} + }; + + var script = document.createElement('script') + script.src = config.src; + document.head.appendChild(script); +}; function postMessage(message) { self.embed.postMessage(message) |