Skip to content

Commit 23080f4

Browse files
committed
Add --out-to-build option
1 parent f2e47cc commit 23080f4

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

packages/cmake-rn/src/cli.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,16 @@ const cleanOption = new Option(
7979
"Delete the build directory before configuring the project"
8080
);
8181

82-
const outPathOption = new Option(
82+
const outOption = new Option(
8383
"--out <path>",
8484
"Specify the output directory to store the final build artifacts"
8585
);
8686

87+
const outToBuildOption = new Option(
88+
"--out-to-build",
89+
"Use `./build/${configuration}` directory as output (like `node-gyp` and `cmake-js`)"
90+
);
91+
8792
const ndkVersionOption = new Option(
8893
"--ndk-version <version>",
8994
"The NDK version to use for Android builds"
@@ -118,7 +123,8 @@ export const program = new Command("cmake-rn")
118123
.addOption(androidOption)
119124
.addOption(appleOption)
120125
.addOption(buildPathOption)
121-
.addOption(outPathOption)
126+
.addOption(outOption)
127+
.addOption(outToBuildOption)
122128
.addOption(cleanOption)
123129
.addOption(ndkVersionOption)
124130
.addOption(androidSdkVersionOption)
@@ -169,6 +175,14 @@ export const program = new Command("cmake-rn")
169175
}
170176
}
171177

178+
if (globalContext.outToBuild) {
179+
assert(
180+
globalContext.out === undefined,
181+
"Cannot use --out with --out-to-build"
182+
);
183+
globalContext.out = path.join(buildPath, globalContext.configuration);
184+
}
185+
172186
const tripletContext = [...triplets].map((triplet) => {
173187
const tripletBuildPath = getTripletBuildPath(buildPath, triplet);
174188
return {

0 commit comments

Comments
 (0)