-
Notifications
You must be signed in to change notification settings - Fork 146
/
Copy pathenvironment.js
97 lines (95 loc) · 1.89 KB
/
environment.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
'use strict'
const os = require('os')
const which = require('which')
const environment = (module.exports = {
cmakeJsVersion: require('../package.json').version,
platform: os.platform(),
isWin: os.platform() === 'win32',
isLinux: os.platform() === 'linux',
isOSX: os.platform() === 'darwin',
arch: os.arch(),
isX86: os.arch() === 'ia32' || os.arch() === 'x86',
isX64: os.arch() === 'x64',
isArm: os.arch() === 'arm',
isArm64: os.arch() === 'arm64',
runtime: 'node',
runtimeVersion: process.versions.node,
})
Object.defineProperties(environment, {
_isNinjaAvailable: {
value: null,
writable: true,
},
isNinjaAvailable: {
get: function () {
if (this._isNinjaAvailable === null) {
this._isNinjaAvailable = false
try {
if (which.sync('ninja')) {
this._isNinjaAvailable = true
}
} catch (e) {
// Ignore
}
}
return this._isNinjaAvailable
},
},
_isMakeAvailable: {
value: null,
writable: true,
},
isMakeAvailable: {
get: function () {
if (this._isMakeAvailable === null) {
this._isMakeAvailable = false
try {
if (which.sync('make')) {
this._isMakeAvailable = true
}
} catch (e) {
// Ignore
}
}
return this._isMakeAvailable
},
},
_isGPPAvailable: {
value: null,
writable: true,
},
isGPPAvailable: {
get: function () {
if (this._isGPPAvailable === null) {
this._isGPPAvailable = false
try {
if (which.sync('g++')) {
this._isGPPAvailable = true
}
} catch (e) {
// Ignore
}
}
return this._isGPPAvailable
},
},
_isClangAvailable: {
value: null,
writable: true,
},
isClangAvailable: {
get: function () {
if (this._isClangAvailable === null) {
this._isClangAvailable = false
try {
if (which.sync('clang++')) {
this._isClangAvailable = true
}
} catch (e) {
// Ignore
}
}
return this._isClangAvailable
},
},
})