Skip to content

Commit 69abd27

Browse files
committed
Pass configuration at the correct time (config vs build)
1 parent e125330 commit 69abd27

File tree

3 files changed

+13
-15
lines changed

3 files changed

+13
-15
lines changed

packages/cmake-rn/src/cli.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,6 @@ function getTargetsSummary(
241241
}
242242

243243
function getBuildPath({ build, source }: BaseOpts) {
244-
// TODO: Add configuration (debug vs release)
245244
return path.resolve(process.cwd(), build || path.join(source, "build"));
246245
}
247246

@@ -250,6 +249,7 @@ function getBuildPath({ build, source }: BaseOpts) {
250249
*/
251250
function getTargetBuildPath(buildPath: string, target: unknown) {
252251
assert(typeof target === "string", "Expected target to be a string");
252+
// TODO: Add configuration (debug vs release) for platforms using single-config CMake generators
253253
return path.join(buildPath, target.replace(/;/g, "_"));
254254
}
255255

@@ -286,17 +286,10 @@ async function buildProject<T extends string>(
286286
options: BaseOpts,
287287
) {
288288
const { target, buildPath } = context;
289-
const { verbose, configuration } = options;
289+
const { verbose } = options;
290290
await spawn(
291291
"cmake",
292-
[
293-
"--build",
294-
buildPath,
295-
"--config",
296-
configuration,
297-
"--",
298-
...platform.buildArgs(context, options),
299-
],
292+
["--build", buildPath, ...platform.buildArgs(context, options)],
300293
{
301294
outputMode: verbose ? "inherit" : "buffered",
302295
outputPrefix: verbose ? chalk.dim(`[${target}] `) : undefined,

packages/cmake-rn/src/platforms/android.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export const platform: Platform<Target[], AndroidOpts> = {
7474
},
7575
configureArgs(
7676
{ target },
77-
{ ndkVersion, androidSdkVersion, weakNodeApiLinkage },
77+
{ configuration, ndkVersion, androidSdkVersion, weakNodeApiLinkage },
7878
) {
7979
const { ANDROID_HOME } = process.env;
8080
assert(
@@ -107,7 +107,7 @@ export const platform: Platform<Target[], AndroidOpts> = {
107107
...toDeclarationArguments({
108108
CMAKE_SYSTEM_NAME: "Android",
109109
CMAKE_MAKE_PROGRAM: "ninja",
110-
// "CMAKE_BUILD_TYPE": configuration,
110+
CMAKE_BUILD_TYPE: configuration,
111111
// "CMAKE_C_COMPILER_LAUNCHER": "ccache",
112112
// "CMAKE_CXX_COMPILER_LAUNCHER": "ccache",
113113
ANDROID_NDK: ndkPath,

packages/cmake-rn/src/platforms/apple.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,14 @@ export const platform: Platform<Target[], AppleOpts> = {
138138
}),
139139
];
140140
},
141-
buildArgs() {
142-
// We expect the final application to sign these binaries
143-
return ["CODE_SIGNING_ALLOWED=NO"];
141+
buildArgs(context, { configuration }) {
142+
return [
143+
"--config",
144+
configuration,
145+
"--",
146+
// We expect the final application to sign these binaries
147+
"CODE_SIGNING_ALLOWED=NO",
148+
];
144149
},
145150
isSupportedByHost: function (): boolean | Promise<boolean> {
146151
return process.platform === "darwin";

0 commit comments

Comments
 (0)