@@ -15,6 +15,14 @@ import type { Platform } from "./types.js";
15
15
import { toDeclarationArguments } from "../cmake.js" ;
16
16
import { getNodeApiIncludeDirectories } from "../headers.js" ;
17
17
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
+
18
26
type Target = `${NodeTriplet } -node`;
19
27
20
28
type NodeOpts = Record < string , unknown > ;
@@ -51,6 +59,7 @@ export const platform: Platform<Target[], NodeOpts> = {
51
59
"x86_64-apple-darwin-node" ,
52
60
"arm64;x86_64-apple-darwin-node" ,
53
61
] ,
62
+ redundantTargets : [ "arm64-apple-darwin-node" , "x86_64-apple-darwin-node" ] ,
54
63
defaultTargets ( ) {
55
64
if ( process . platform === "darwin" ) {
56
65
if ( process . arch === "arm64" ) {
@@ -64,12 +73,14 @@ export const platform: Platform<Target[], NodeOpts> = {
64
73
amendCommand ( command ) {
65
74
return command ;
66
75
} ,
67
- configureArgs ( { target } ) {
76
+ configureArgs ( { target } , { configuration } ) {
68
77
const triplet = tripletFromTarget ( target ) ;
69
78
return [
70
79
"-G" ,
71
80
"Ninja" ,
72
81
...toDeclarationArguments ( {
82
+ CMAKE_BUILD_TYPE : configuration ,
83
+ CMAKE_OSX_ARCHITECTURES : ARCHITECTURES [ triplet ] ,
73
84
// TODO: Make this names less "cmake-js" specific with an option to use the CMAKE_JS prefix
74
85
CMAKE_JS_INC : getNodeApiIncludeDirectories ( ) ,
75
86
CMAKE_SHARED_LINKER_FLAGS : getLinkerFlags ( triplet ) ,
0 commit comments