@@ -15,6 +15,14 @@ import type { Platform } from "./types.js";
1515import { toDeclarationArguments } from "../cmake.js" ;
1616import { getNodeApiIncludeDirectories } from "../headers.js" ;
1717
18+ type Architecture = "arm64" | "x86_64" | "arm64;x86_64" ;
19+
20+ const ARCHITECTURES = {
21+ "arm64-apple-darwin" : "arm64" ,
22+ "x86_64-apple-darwin" : "x86_64" ,
23+ "arm64;x86_64-apple-darwin" : "arm64;x86_64" ,
24+ } satisfies Record < NodeTriplet , Architecture > ;
25+
1826type Target = `${NodeTriplet } -node`;
1927
2028type NodeOpts = Record < string , unknown > ;
@@ -51,6 +59,7 @@ export const platform: Platform<Target[], NodeOpts> = {
5159 "x86_64-apple-darwin-node" ,
5260 "arm64;x86_64-apple-darwin-node" ,
5361 ] ,
62+ redundantTargets : [ "arm64-apple-darwin-node" , "x86_64-apple-darwin-node" ] ,
5463 defaultTargets ( ) {
5564 if ( process . platform === "darwin" ) {
5665 if ( process . arch === "arm64" ) {
@@ -64,12 +73,14 @@ export const platform: Platform<Target[], NodeOpts> = {
6473 amendCommand ( command ) {
6574 return command ;
6675 } ,
67- configureArgs ( { target } ) {
76+ configureArgs ( { target } , { configuration } ) {
6877 const triplet = tripletFromTarget ( target ) ;
6978 return [
7079 "-G" ,
7180 "Ninja" ,
7281 ...toDeclarationArguments ( {
82+ CMAKE_BUILD_TYPE : configuration ,
83+ CMAKE_OSX_ARCHITECTURES : ARCHITECTURES [ triplet ] ,
7384 // TODO: Make this names less "cmake-js" specific with an option to use the CMAKE_JS prefix
7485 CMAKE_JS_INC : getNodeApiIncludeDirectories ( ) ,
7586 CMAKE_SHARED_LINKER_FLAGS : getLinkerFlags ( triplet ) ,
0 commit comments