Skip to content

Commit 7b5b84e

Browse files
committed
Fix build folder
1 parent 72b26aa commit 7b5b84e

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

packages/cmake-rn/src/cli.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import {
1919
findPlatformForTriplet,
2020
platformHasTriplet,
2121
} from "./platforms.js";
22-
import { BaseOpts, Platform } from "./platforms/types.js";
22+
import { Platform } from "./platforms/types.js";
2323

2424
// We're attaching a lot of listeners when spawning in parallel
2525
EventEmitter.defaultMaxListeners = 100;
@@ -70,7 +70,7 @@ const buildPathOption = new Option(
7070
"Specify the build directory to store the configured CMake project",
7171
)
7272
.argParser((input) => path.resolve(process.cwd(), input))
73-
.default(path.resolve(process.cwd(), "build"), "./build");
73+
.default("{source}/build");
7474

7575
const cleanOption = new Option(
7676
"--clean",
@@ -158,12 +158,15 @@ function expandTemplate(
158158

159159
program = program.action(
160160
wrapAction(async ({ triplet: requestedTriplets, ...baseOptions }) => {
161-
const buildPath = getBuildPath(baseOptions);
161+
baseOptions.build = path.resolve(
162+
process.cwd(),
163+
expandTemplate(baseOptions.build, baseOptions),
164+
);
162165
baseOptions.out = path.resolve(
163166
process.cwd(),
164167
expandTemplate(baseOptions.out, baseOptions),
165168
);
166-
const { verbose, clean, source, out } = baseOptions;
169+
const { verbose, clean, source, out, build: buildPath } = baseOptions;
167170

168171
assertFixable(
169172
fs.existsSync(path.join(source, "CMakeLists.txt")),
@@ -313,9 +316,4 @@ function getTripletsSummary(
313316
.join(" / ");
314317
}
315318

316-
function getBuildPath({ build, source }: BaseOpts) {
317-
// TODO: Add configuration (debug vs release)
318-
return path.resolve(process.cwd(), build || path.join(source, "build"));
319-
}
320-
321319
export { program };

0 commit comments

Comments
 (0)