-
-
Notifications
You must be signed in to change notification settings - Fork 133
Expand file tree
/
Copy pathvcpkg-get-info.js
More file actions
70 lines (59 loc) · 1.76 KB
/
vcpkg-get-info.js
File metadata and controls
70 lines (59 loc) · 1.76 KB
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
const fs = require('fs')
const path = require('path')
const { triplet, moduleRoot } = require('./vcpkg-common')
// Exit if not Windows
if (process.platform !== 'win32') {
process.exit(0)
}
const args = process.argv.slice(2)
const installedRoot = path.join(moduleRoot, 'vcpkg_installed', triplet)
// Collect all .lib files
const libDir = path.join(installedRoot, 'lib')
const debugLibDir = path.join(installedRoot, 'debug', 'lib')
const libs = fs
.readdirSync(libDir)
.filter((f) => f.endsWith('.lib'))
.map((f) => path.join(libDir, f))
const debugLibs = fs.existsSync(debugLibDir)
? fs
.readdirSync(debugLibDir)
.filter((f) => f.endsWith('.lib'))
.map((f) => path.join(debugLibDir, f))
: []
// System libraries
const systemLibs = [
'Ws2_32.lib',
// crypto / openssl
'Crypt32.lib',
// ldap
'Wldap32.lib',
// idn
'Normaliz.lib',
// sspi / schannel
'Secur32.lib',
'Advapi32.lib',
'Bcrypt.lib',
'Iphlpapi.lib',
]
// -lwldap32 -lnormaliz -lbcrypt -ladvapi32 -lcrypt32 -lsecur32 -lws2_32 -liphlpapi --lws2_32 -lntdll -lbcrypt
function normalizePath(pathStr) {
return pathStr.split(path.sep).join('/')
}
// Write config for binding.gyp
const config = {
triplet,
installedPath: normalizePath(installedRoot),
includeDir: normalizePath(path.join(installedRoot, 'include')),
libDir: normalizePath(libDir),
debugLibDir: normalizePath(debugLibDir),
libraries: [...libs, ...systemLibs].map(normalizePath),
debugLibraries: [...debugLibs, ...systemLibs].map(normalizePath),
}
if (args.includes('--include-dir')) {
console.log(config.includeDir)
} else if (args.includes('--libs')) {
console.log(config.libraries.join(' '))
} else {
console.log(config)
}
// here -> we need to use openssl, and pick the same version as nodejs :|