Comparing version 1.12.1 to 1.12.2
@@ -5,2 +5,7 @@ cmake_minimum_required(VERSION 3.1) | ||
option(CMAKE_JS_PLATFORM "Target platform. Should match node's os.platform()") | ||
if (NOT CMAKE_JS_PLATFORM) | ||
message(FATAL_ERROR "CMAKE_JS_PLATFORM must be set") | ||
endif() | ||
include(CTest) | ||
@@ -100,11 +105,5 @@ | ||
if (CMAKE_JS_PLATFORM AND CMAKE_JS_ARCH) | ||
# When run from build.ts, these are set | ||
set(destination bin/${CMAKE_JS_PLATFORM}-${CMAKE_JS_ARCH}) | ||
else() | ||
# If not, default to "native" | ||
set(destination bin/native) | ||
endif() | ||
set(destination bin/${CMAKE_JS_PLATFORM}-${NODE_ARCH}) | ||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/aws-crt-nodejs.node" | ||
DESTINATION ${destination}) |
@@ -49,3 +49,2 @@ "use strict"; | ||
const search_paths = [ | ||
path.join(bin_path, 'native', binary_name), | ||
path.join(bin_path, platformDir, binary_name), | ||
@@ -52,0 +51,0 @@ ]; |
{ | ||
"name": "aws-crt", | ||
"version": "1.12.1", | ||
"version": "1.12.2", | ||
"description": "NodeJS/browser bindings to the aws-c-* libraries", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/awslabs/aws-crt-nodejs", |
@@ -102,11 +102,36 @@ /** | ||
function buildLocally() { | ||
const platform = os.platform(); | ||
let arch = os.arch(); | ||
// Allow cross-compile (so OSX can do arm64 or x64 builds) via: | ||
// --target-arch ARCH | ||
if (process.argv.includes('--target-arch')) { | ||
arch = process.argv[process.argv.indexOf('--target-arch') + 1]; | ||
} | ||
// options for cmake.BuildSystem | ||
let options = { | ||
CMAKE_EXPORT_COMPILE_COMMANDS: true, | ||
CMAKE_JS_PLATFORM: os.platform, | ||
CMAKE_JS_ARCH: os.arch, | ||
BUILD_TESTING: 'OFF', | ||
CMAKE_INSTALL_PREFIX: 'crt/install', | ||
CMAKE_PREFIX_PATH: 'crt/install', | ||
target: "install", | ||
debug: process.argv.includes('--debug'), | ||
arch: arch, | ||
out: path.join('build', `${platform}-${arch}`), | ||
cMakeOptions: { | ||
CMAKE_EXPORT_COMPILE_COMMANDS: true, | ||
CMAKE_JS_PLATFORM: platform, | ||
BUILD_TESTING: 'OFF', | ||
CMAKE_INSTALL_PREFIX: 'crt/install', | ||
CMAKE_PREFIX_PATH: 'crt/install', | ||
} | ||
} | ||
// We need to pass some extra flags to pull off cross-compiling | ||
// because cmake-js doesn't set everything we need. | ||
// | ||
// See the docs on `arch`: https://github.com/cmake-js/cmake-js/blob/v6.1.0/README.md?#runtimes | ||
// > Notice: on non-Windows systems the C++ toolset's architecture's gonna be used despite this setting. | ||
if (platform === 'darwin') { | ||
// What Node calls "x64", Apple calls "x86_64". They both agree on the term "arm64" though. | ||
options.cMakeOptions.CMAKE_OSX_ARCHITECTURES = (arch === 'x64') ? 'x86_64' : arch; | ||
} | ||
// Convert any -D arguments to this script to cmake -D arguments | ||
@@ -116,3 +141,3 @@ for (const arg of process.argv) { | ||
const option = arg.substring(2).split('=') | ||
options[option[0]] = option[1] | ||
options.cMakeOptions[option[0]] = option[1] | ||
} | ||
@@ -125,7 +150,3 @@ } | ||
// Run the build | ||
var buildSystem = new cmake.BuildSystem({ | ||
target: "install", | ||
debug: process.argv.includes('--debug'), | ||
cMakeOptions: options, | ||
}); | ||
var buildSystem = new cmake.BuildSystem(options); | ||
return buildSystem.build(); | ||
@@ -132,0 +153,0 @@ } |
@@ -10,3 +10,3 @@ /** | ||
const binaryDir = path.join('dist', 'bin', `${os.platform}-${os.arch}`, 'aws-crt-nodejs.node'); | ||
const binaryDir = path.join('dist', 'bin', `${os.platform()}-${os.arch()}`, 'aws-crt-nodejs.node'); | ||
if (fs.existsSync(binaryDir)) { | ||
@@ -13,0 +13,0 @@ // Don't continue if the binding already exists (unless --rebuild is specified) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13008749
9073