File tree Expand file tree Collapse file tree
Modules/@babylonjs/react-native Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2626 "readmeFilename" : " README.md" ,
2727 "dependencies" : {
2828 "base-64" : " ^0.1.0" ,
29+ "cmake-runtime" : " 3.31.0" ,
2930 "semver" : " ^7.3.2"
3031 },
3132 "peerDependencies" : {
3536 "react-native-permissions" : " >=3.0.0"
3637 },
3738 "devDependencies" : {
38- "cmake-runtime" : " 3.31.0" ,
3939 "@babel/core" : " ^7.8.4" ,
4040 "@babel/runtime" : " ^7.8.4" ,
4141 "@babylonjs/core" : " >=5.53.1" ,
Original file line number Diff line number Diff line change 11const os = require ( "os" ) ;
2+ const path = require ( "path" ) ;
3+
4+ function getCmakeExecutable ( ) {
5+ try {
6+ // cmake-runtime ships the cmake binary; resolve it directly to avoid
7+ // relying on npx or PATH.
8+ const pkgDir = path . dirname ( require . resolve ( 'cmake-runtime/package.json' ) ) ;
9+ const pkg = require ( 'cmake-runtime/package.json' ) ;
10+ // cmake-runtime exposes the binary path via its "bin" field
11+ const binRelative = typeof pkg . bin === 'string' ? pkg . bin : pkg . bin [ 'cmake' ] ;
12+ return path . join ( pkgDir , binRelative ) ;
13+ } catch ( e ) {
14+ // Fall back to a cmake on PATH (e.g. homebrew or system install)
15+ return 'cmake' ;
16+ }
17+ }
218
319function iosCMake ( ) {
420 const { spawn } = require ( 'child_process' ) ;
521
6- const cmake = spawn ( 'npx' , [
7- 'cmake' ,
8- '-S' , 'ios' ,
9- '-B' , 'Build/iOS' ,
22+ const cmake = spawn ( getCmakeExecutable ( ) , [
23+ '-S' , path . join ( __dirname , 'ios' ) ,
24+ '-B' , path . join ( __dirname , 'Build/iOS' ) ,
1025 '-G' , 'Xcode' ,
11- ] , { stdio : 'inherit' } ) ;
26+ ] , { stdio : 'inherit' , cwd : __dirname } ) ;
1227
1328 cmake . on ( 'exit' , code => {
1429 if ( code !== 0 ) {
You can’t perform that action at this time.
0 commit comments