From 030ea922c0c1b5fb26c63ac8e10c2c81ab485592 Mon Sep 17 00:00:00 2001 From: Yulong Wang Date: Fri, 15 May 2020 09:59:03 -0700 Subject: [PATCH 1/4] add flag 'config' --- README.md | 2 ++ bin/cmake-js | 6 ++++++ lib/cMake.js | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 81940fc6..ea7f51b9 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,8 @@ Options: -d, --directory specify CMake project's directory (where CMakeLists.txt located) [string] -D, --debug build debug configuration [boolean] + -C, --config specify build configuration (Debug, RelWithDebInfo, + Release), will ignore '--debug' if specified [string] -c, --cmake-path path of CMake executable [string] -m, --prefer-make use Unix Makefiles even if Ninja is available (Posix) [boolean] diff --git a/bin/cmake-js b/bin/cmake-js index 8e27ec02..9def4244 100755 --- a/bin/cmake-js +++ b/bin/cmake-js @@ -66,6 +66,12 @@ var yargs = require("yargs") describe: "build debug configuration", type: "boolean" }, + C: { + alias: "config", + demand: false, + describe: "specify build configuration (Debug, RelWithDebInfo, Release), will ignore '--debug' if specified", + type: "string" + }, c: { alias: "cmake-path", demand: false, diff --git a/lib/cMake.js b/lib/cMake.js index f51488e5..63fa01cd 100644 --- a/lib/cMake.js +++ b/lib/cMake.js @@ -20,7 +20,7 @@ function CMake(options) { this.dist = new Dist(this.options); this.projectRoot = path.resolve(this.options.directory || process.cwd()); this.workDir = path.resolve(this.options.out || path.join(this.projectRoot, "build")); - this.config = this.options.debug ? "Debug" : "Release"; + this.config = this.options.config || this.options.debug ? "Debug" : "Release"; this.buildDir = path.join(this.workDir, this.config); this._isAvailable = null; this.targetOptions = new TargetOptions(this.options); From 85e613fa967e74f7e223817eed521b0782fc5b1e Mon Sep 17 00:00:00 2001 From: Nate Brake <33383515+njbrake@users.noreply.github.com> Date: Tue, 10 Aug 2021 11:19:14 -0400 Subject: [PATCH 2/4] add config to options object --- bin/cmake-js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bin/cmake-js b/bin/cmake-js index 9def4244..39a4aadd 100755 --- a/bin/cmake-js +++ b/bin/cmake-js @@ -66,7 +66,7 @@ var yargs = require("yargs") describe: "build debug configuration", type: "boolean" }, - C: { + B: { alias: "config", demand: false, describe: "specify build configuration (Debug, RelWithDebInfo, Release), will ignore '--debug' if specified", @@ -218,7 +218,8 @@ var options = { arch: argv.a, cMakeOptions: customOptions, silent: argv.i, - out: argv.O + out: argv.O, + config: argv.B }; log.verbose("CON", "options:"); From 146fcb8056fd055fe2a514fba374e1aa44754335 Mon Sep 17 00:00:00 2001 From: Nate Brake <33383515+njbrake@users.noreply.github.com> Date: Tue, 10 Aug 2021 11:20:31 -0400 Subject: [PATCH 3/4] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ea7f51b9..74724844 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ Options: -d, --directory specify CMake project's directory (where CMakeLists.txt located) [string] -D, --debug build debug configuration [boolean] - -C, --config specify build configuration (Debug, RelWithDebInfo, + -B, --config specify build configuration (Debug, RelWithDebInfo, Release), will ignore '--debug' if specified [string] -c, --cmake-path path of CMake executable [string] -m, --prefer-make use Unix Makefiles even if Ninja is available (Posix) From 521c0edec87e3a5e47ead0d9a5c029be940ae078 Mon Sep 17 00:00:00 2001 From: Nate Brake Date: Tue, 10 Aug 2021 11:34:15 -0400 Subject: [PATCH 4/4] add paren to fix logic --- lib/cMake.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cMake.js b/lib/cMake.js index 63fa01cd..184a742e 100644 --- a/lib/cMake.js +++ b/lib/cMake.js @@ -20,7 +20,7 @@ function CMake(options) { this.dist = new Dist(this.options); this.projectRoot = path.resolve(this.options.directory || process.cwd()); this.workDir = path.resolve(this.options.out || path.join(this.projectRoot, "build")); - this.config = this.options.config || this.options.debug ? "Debug" : "Release"; + this.config = this.options.config || (this.options.debug ? "Debug" : "Release"); this.buildDir = path.join(this.workDir, this.config); this._isAvailable = null; this.targetOptions = new TargetOptions(this.options);