@@ -13,7 +13,7 @@ import {
1313} from "react-native-node-api" ;
1414import * as cmakeFileApi from "cmake-file-api" ;
1515
16- import type { Platform } from "./types.js" ;
16+ import type { BaseOpts , Platform } from "./types.js" ;
1717import { toDefineArguments } from "../helpers.js" ;
1818import {
1919 getCmakeJSVariables ,
@@ -45,8 +45,12 @@ const androidSdkVersionOption = new Option(
4545
4646type AndroidOpts = { ndkVersion : string ; androidSdkVersion : string } ;
4747
48- function getBuildPath ( baseBuildPath : string , triplet : Triplet ) {
49- return path . join ( baseBuildPath , triplet ) ;
48+ function getBuildPath (
49+ baseBuildPath : string ,
50+ triplet : Triplet ,
51+ configuration : BaseOpts [ "configuration" ] ,
52+ ) {
53+ return path . join ( baseBuildPath , triplet + "-" + configuration ) ;
5054}
5155
5256function getNdkPath ( ndkVersion : string ) {
@@ -147,7 +151,7 @@ export const platform: Platform<Triplet[], AndroidOpts> = {
147151
148152 await Promise . all (
149153 triplets . map ( async ( { triplet, spawn } ) => {
150- const buildPath = getBuildPath ( build , triplet ) ;
154+ const buildPath = getBuildPath ( build , triplet , configuration ) ;
151155 const outputPath = path . join ( buildPath , "out" ) ;
152156 // We want to use the CMake File API to query information later
153157 await cmakeFileApi . createSharedStatelessQuery (
@@ -161,6 +165,8 @@ export const platform: Platform<Triplet[], AndroidOpts> = {
161165 source ,
162166 "-B" ,
163167 buildPath ,
168+ // Ideally, we would use the "Ninja Multi-Config" generator here,
169+ // but it doesn't support the "RelWithDebInfo" configuration on Android.
164170 "-G" ,
165171 "Ninja" ,
166172 "--toolchain" ,
@@ -179,8 +185,8 @@ export const platform: Platform<Triplet[], AndroidOpts> = {
179185 } ) ,
180186 ) ;
181187 } ,
182- async build ( { triplet, spawn } , { target, build } ) {
183- const buildPath = getBuildPath ( build , triplet ) ;
188+ async build ( { triplet, spawn } , { target, build, configuration } ) {
189+ const buildPath = getBuildPath ( build , triplet , configuration ) ;
184190 await spawn ( "cmake" , [
185191 "--build" ,
186192 buildPath ,
@@ -201,8 +207,8 @@ export const platform: Platform<Triplet[], AndroidOpts> = {
201207 { triplet : Triplet ; libraryPath : string } [ ]
202208 > = { } ;
203209
204- for ( const { spawn , triplet } of triplets ) {
205- const buildPath = getBuildPath ( build , triplet ) ;
210+ for ( const { triplet , spawn } of triplets ) {
211+ const buildPath = getBuildPath ( build , triplet , configuration ) ;
206212 assert ( fs . existsSync ( buildPath ) , `Expected a directory at ${ buildPath } ` ) ;
207213 const targets = await cmakeFileApi . readCurrentTargetsDeep (
208214 buildPath ,
0 commit comments