cmake-js
Advanced tools
Comparing version 7.0.0 to 7.1.0
@@ -0,1 +1,8 @@ | ||
v7.1.0 - 14/12/22 | ||
========== | ||
- add commands for retrieving cmake-js include and lib directories | ||
- fix win delay hook issues with electron | ||
- fix missing js_native_api_symbols in windows node.lib | ||
v7.0.0 - 08/10/22 | ||
@@ -2,0 +9,0 @@ ========== |
@@ -98,2 +98,14 @@ "use strict"; | ||
BuildSystem.prototype.getCmakeJsLibString = function () { | ||
return this._invokeCMake("getCmakeJsLibString"); | ||
}; | ||
BuildSystem.prototype.getCmakeJsIncludeString = function () { | ||
return this._invokeCMake("getCmakeJsIncludeString"); | ||
}; | ||
BuildSystem.prototype.getCmakeJsSrcString = function () { | ||
return this._invokeCMake("getCmakeJsSrcString"); | ||
}; | ||
BuildSystem.prototype.configure = function () { | ||
@@ -100,0 +112,0 @@ return this._invokeCMake("configure"); |
131
lib/cMake.js
@@ -120,3 +120,5 @@ "use strict"; | ||
CMake.prototype.getConfigureCommand = async function (nodeLibDefPath) { | ||
CMake.prototype.getConfigureCommand = async function () { | ||
const nodeLibDefPath = environment.isWin && this.options.isNodeApi ? path.join(this.options.out, 'node-lib.def') : undefined | ||
// Create command: | ||
@@ -143,45 +145,10 @@ let command = [this.path, this.projectRoot, "--no-warn-unused-cli"]; | ||
let incPaths = []; | ||
if (!this.options.isNodeApi) { | ||
// Include and lib: | ||
if (this.dist.headerOnly) { | ||
incPaths = [path.join(this.dist.internalPath, "/include/node")]; | ||
} | ||
else { | ||
const nodeH = path.join(this.dist.internalPath, "/src"); | ||
const v8H = path.join(this.dist.internalPath, "/deps/v8/include"); | ||
const uvH = path.join(this.dist.internalPath, "/deps/uv/include"); | ||
incPaths = [nodeH, v8H, uvH]; | ||
} | ||
// NAN | ||
const nanH = await locateNAN(this.projectRoot); | ||
if (nanH) { | ||
incPaths.push(nanH); | ||
} | ||
} else { | ||
// Base headers | ||
const apiHeaders = require('node-api-headers') | ||
incPaths.push(apiHeaders.include_dir) | ||
// Node-api | ||
const napiH = await locateNodeApi(this.projectRoot) | ||
if (napiH) { | ||
incPaths.push(napiH) | ||
} | ||
} | ||
// Includes: | ||
D.push({"CMAKE_JS_INC": incPaths.join(";")}); | ||
const includesString = await this.getCmakeJsIncludeString(); | ||
D.push({ "CMAKE_JS_INC": includesString }); | ||
// Sources: | ||
const srcPaths = []; | ||
if (environment.isWin) { | ||
const delayHook = path.normalize(path.join(__dirname, 'cpp', 'win_delay_load_hook.cc')); | ||
const srcsString = this.getCmakeJsSrcString(); | ||
D.push({ "CMAKE_JS_SRC": srcsString }); | ||
srcPaths.push(delayHook.replace(/\\/gm, '/')); | ||
} | ||
D.push({"CMAKE_JS_SRC": srcPaths.join(";")}); | ||
// Runtime: | ||
@@ -208,17 +175,4 @@ D.push({"NODE_RUNTIME": this.targetOptions.runtime}); | ||
if (environment.isWin) { | ||
// Win | ||
const libs = [] | ||
if (nodeLibDefPath) { | ||
const nodeLibPath = path.join(this.workDir, 'node.lib') | ||
D.push({ CMAKE_JS_NODELIB_DEF: nodeLibDefPath }) | ||
D.push({ CMAKE_JS_NODELIB_TARGET: nodeLibPath }) | ||
libs.push(nodeLibPath) | ||
} else { | ||
libs.push(...this.dist.winLibs) | ||
} | ||
if (libs.length) { | ||
D.push({"CMAKE_JS_LIB": libs.join(";")}); | ||
} | ||
} | ||
const libsString = this.getCmakeJsLibString() | ||
D.push({ "CMAKE_JS_LIB": libsString }); | ||
@@ -267,2 +221,62 @@ if (this.toolset.generator) { | ||
CMake.prototype.getCmakeJsLibString = function () { | ||
const libs = [] | ||
if (environment.isWin) { | ||
if (nodeLibDefPath) { | ||
const nodeLibPath = path.join(this.workDir, 'node.lib') | ||
D.push({ CMAKE_JS_NODELIB_DEF: nodeLibDefPath }) | ||
D.push({ CMAKE_JS_NODELIB_TARGET: nodeLibPath }) | ||
libs.push(nodeLibPath) | ||
} else { | ||
libs.push(...this.dist.winLibs) | ||
} | ||
} | ||
return libs.join(";"); | ||
}; | ||
CMake.prototype.getCmakeJsIncludeString = async function () { | ||
let incPaths = []; | ||
if (!this.options.isNodeApi) { | ||
// Include and lib: | ||
if (this.dist.headerOnly) { | ||
incPaths = [path.join(this.dist.internalPath, "/include/node")]; | ||
} | ||
else { | ||
const nodeH = path.join(this.dist.internalPath, "/src"); | ||
const v8H = path.join(this.dist.internalPath, "/deps/v8/include"); | ||
const uvH = path.join(this.dist.internalPath, "/deps/uv/include"); | ||
incPaths = [nodeH, v8H, uvH]; | ||
} | ||
// NAN | ||
const nanH = await locateNAN(this.projectRoot); | ||
if (nanH) { | ||
incPaths.push(nanH); | ||
} | ||
} else { | ||
// Base headers | ||
const apiHeaders = require('node-api-headers') | ||
incPaths.push(apiHeaders.include_dir) | ||
// Node-api | ||
const napiH = await locateNodeApi(this.projectRoot) | ||
if (napiH) { | ||
incPaths.push(napiH) | ||
} | ||
} | ||
return incPaths.join(";"); | ||
}; | ||
CMake.prototype.getCmakeJsSrcString = function () { | ||
const srcPaths = []; | ||
if (environment.isWin) { | ||
const delayHook = path.normalize(path.join(__dirname, 'cpp', 'win_delay_load_hook.cc')); | ||
srcPaths.push(delayHook.replace(/\\/gm, '/')); | ||
} | ||
return srcPaths.join(";"); | ||
}; | ||
CMake.prototype._generateNodeLibDef = async function (targetFile) { | ||
@@ -276,2 +290,5 @@ try { | ||
} | ||
for (const sym of ver.js_native_api_symbols) { | ||
allSymbols.add(sym) | ||
} | ||
} | ||
@@ -293,7 +310,5 @@ | ||
const nodeLibDefPath = environment.isWin && this.options.isNodeApi ? path.join(this.options.out, 'node-lib.def') : undefined | ||
this.log.info("CMD", "CONFIGURE"); | ||
const listPath = path.join(this.projectRoot, "CMakeLists.txt"); | ||
const command = await this.getConfigureCommand(nodeLibDefPath); | ||
const command = await this.getConfigureCommand(); | ||
@@ -300,0 +315,0 @@ try { |
@@ -24,3 +24,3 @@ { | ||
"main": "lib", | ||
"version": "7.0.0", | ||
"version": "7.1.0", | ||
"author": "Gábor Mező aka unbornchikken", | ||
@@ -27,0 +27,0 @@ "maintainers": [ |
@@ -31,16 +31,23 @@ # CMake.js (MIT) | ||
Commands: | ||
install Install Node.js distribution files if needed | ||
configure Configure CMake project | ||
print-configure Print the configuration command | ||
build Build the project (will configure first if required) | ||
print-build Print the build command | ||
clean Clean the project directory | ||
print-clean Print the clean command | ||
reconfigure Clean the project directory then configure the project | ||
rebuild Clean the project directory then build the project | ||
compile Build the project, and if build fails, try a full rebuild | ||
cmake-js install Install Node.js distribution files if needed | ||
cmake-js configure Configure CMake project | ||
cmake-js print-configure Print the configuration command | ||
cmake-js print-cmakejs-src Print the value of the CMAKE_JS_SRC variable | ||
cmake-js print-cmakejs-include Print the value of the CMAKE_JS_INC variable | ||
cmake-js print-cmakejs-lib Print the value of the CMAKE_JS_LIB variable | ||
cmake-js build Build the project (will configure first if | ||
required) | ||
cmake-js print-build Print the build command | ||
cmake-js clean Clean the project directory | ||
cmake-js print-clean Print the clean command | ||
cmake-js reconfigure Clean the project directory then configure the | ||
project | ||
cmake-js rebuild Clean the project directory then build the | ||
project | ||
cmake-js compile Build the project, and if build fails, try a | ||
full rebuild | ||
Options: | ||
--version Show version number [boolean] | ||
-h, --help show this screen [boolean] | ||
--version Show version number [boolean] | ||
-h, --help Show help [boolean] | ||
-l, --log-level set log level (silly, verbose, info, http, warn, | ||
@@ -65,4 +72,4 @@ error), default is info [string] | ||
if available (Posix) [boolean] | ||
--cc use the specified C compiler [string] | ||
--cxx use the specified C++ compiler [string] | ||
--cc use the specified C compiler [string] | ||
--cxx use the specified C++ compiler [string] | ||
-r, --runtime the runtime to use [string] | ||
@@ -72,3 +79,3 @@ -v, --runtime-version the runtime version to use [string] | ||
-p, --parallel the number of threads cmake can use [number] | ||
--CD Custom argument passed to CMake in format: | ||
--CD Custom argument passed to CMake in format: | ||
-D<your-arg-here> [string] | ||
@@ -75,0 +82,0 @@ -i, --silent Prevents CMake.js to print to the stdio [boolean] |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
110911
1877
385