Skip to content

Commit

Permalink
fix: typo
Browse files Browse the repository at this point in the history
  • Loading branch information
Julusian committed Dec 15, 2022
1 parent 42c5f7f commit d2e1c42
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/cMake.js
Expand Up @@ -118,7 +118,6 @@ CMake.prototype.verifyIfAvailable = function () {
};

CMake.prototype.getConfigureCommand = async function () {
const nodeLibDefPath = environment.isWin && this.options.isNodeApi ? path.join(this.options.out, 'node-lib.def') : undefined

// Create command:
let command = [this.path, this.projectRoot, "--no-warn-unused-cli"];
Expand Down Expand Up @@ -216,8 +215,10 @@ CMake.prototype.getConfigureCommand = async function () {
};

CMake.prototype.getCmakeJsLibString = function () {

const libs = []
if (environment.isWin) {
if (environment.isWin) {
const nodeLibDefPath = this.getNodeLibDefPath()
if (nodeLibDefPath) {
const nodeLibPath = path.join(this.workDir, 'node.lib')
D.push({ CMAKE_JS_NODELIB_DEF: nodeLibDefPath })
Expand Down Expand Up @@ -275,6 +276,10 @@ CMake.prototype.getCmakeJsSrcString = function () {
return srcPaths.join(";");
};

CMake.prototype.getNodeLibDefPath = function () {
return environment.isWin && this.options.isNodeApi ? path.join(this.options.out, 'node-lib.def') : undefined
}

CMake.prototype._generateNodeLibDef = async function (targetFile) {
try {
// Compile a Set of all the symbols that could be exported
Expand Down Expand Up @@ -323,6 +328,8 @@ CMake.prototype.configure = async function () {
const cwd = process.cwd();
process.chdir(this.workDir);
try {
const nodeLibDefPath = this.getNodeLibDefPath()

if (environment.isWin && nodeLibDefPath) {
await this._generateNodeLibDef(nodeLibDefPath)
}
Expand Down

0 comments on commit d2e1c42

Please sign in to comment.