From 22d0577415ef3e8598d5e145209b14e03c4e144e Mon Sep 17 00:00:00 2001 From: Oliver Hamlet Date: Sun, 7 Aug 2016 20:27:11 +0100 Subject: [PATCH] Include API's .lib file in archive For linking on Windows. --- scripts/archive.js | 23 ++++++++++++++++++----- scripts/helpers.js | 4 +++- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/scripts/archive.js b/scripts/archive.js index 73bd7221..7f4bd0d2 100644 --- a/scripts/archive.js +++ b/scripts/archive.js @@ -168,15 +168,28 @@ function createAppArchive(rootPath, releasePath, tempPath, destPath) { fs.removeSync(tempPath); } -function createApiArchive(rootPath, binaryPath, tempPath, destPath) { +function createApiArchive(rootPath, releasePath, tempPath, destPath) { // Ensure that the output directory is empty. fs.emptyDirSync(tempPath); // API binary/binaries. - fs.copySync( - binaryPath, - path.join(tempPath, path.basename(binaryPath)) - ); + let binaries = []; + if (os.platform() === 'win32') { + binaries = [ + 'loot_api.dll', + 'loot_api.lib', + ]; + } else { + binaries = [ + 'libloot_api.so', + ]; + } + binaries.forEach((file) => { + fs.copySync( + path.join(releasePath, file), + path.join(tempPath, file) + ); + }); // API header file. fs.mkdirsSync(path.join(tempPath, 'include', 'loot')); diff --git a/scripts/helpers.js b/scripts/helpers.js index 2a1bda5c..88428277 100644 --- a/scripts/helpers.js +++ b/scripts/helpers.js @@ -73,7 +73,9 @@ function getApiBinaryPaths(rootPath) { file = `lib${file}.so`; } - return getBinaryPaths(rootPath, file); + return getBinaryParentPaths(rootPath).filter( + parentPath => fileExists(path.join(parentPath.path, file)) + ); } function getMetadataValidatorBinaryPaths(rootPath) {