зеркало из https://github.com/electron/electron.git
chore: fix nan spec runner on macOS (#34447)
This commit is contained in:
Родитель
30d15715a9
Коммит
4ec2de659f
|
@ -18,7 +18,8 @@ const args = require('minimist')(process.argv.slice(2), {
|
|||
});
|
||||
|
||||
async function main () {
|
||||
const nodeDir = path.resolve(BASE, `out/${utils.getOutDir({ shouldLog: true })}/gen/node_headers`);
|
||||
const outDir = utils.getOutDir({ shouldLog: true });
|
||||
const nodeDir = path.resolve(BASE, 'out', outDir, 'gen', 'node_headers');
|
||||
const env = Object.assign({}, process.env, {
|
||||
npm_config_nodedir: nodeDir,
|
||||
npm_config_msvs_version: '2019',
|
||||
|
@ -31,6 +32,25 @@ async function main () {
|
|||
const cxx = path.resolve(clangDir, 'clang++');
|
||||
const ld = path.resolve(clangDir, 'lld');
|
||||
|
||||
const platformFlags = [];
|
||||
if (process.platform === 'darwin') {
|
||||
const sdkPath = path.resolve(BASE, 'out', outDir, 'sdk', 'xcode_links');
|
||||
const sdks = (await fs.promises.readdir(sdkPath)).filter(fileName => fileName.endsWith('.sdk'));
|
||||
const sdkToUse = sdks[0];
|
||||
if (!sdkToUse) {
|
||||
console.error('Could not find an SDK to use for the NAN tests');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
if (sdks.length) {
|
||||
console.warn(`Multiple SDKs found in the xcode_links directory - using ${sdkToUse}`);
|
||||
}
|
||||
|
||||
platformFlags.push(
|
||||
`-isysroot ${path.resolve(sdkPath, sdkToUse)}`
|
||||
);
|
||||
}
|
||||
|
||||
// TODO(ckerr) this is cribbed from read obj/electron/electron_app.ninja.
|
||||
// Maybe it would be better to have this script literally open up that
|
||||
// file and pull cflags_cc from it instead of using bespoke code here?
|
||||
|
@ -41,15 +61,17 @@ async function main () {
|
|||
`-isystem"${path.resolve(BASE, 'buildtools', 'third_party', 'libc++')}"`,
|
||||
`-isystem"${path.resolve(BASE, 'buildtools', 'third_party', 'libc++', 'trunk', 'include')}"`,
|
||||
`-isystem"${path.resolve(BASE, 'buildtools', 'third_party', 'libc++abi', 'trunk', 'include')}"`,
|
||||
'-fPIC'
|
||||
'-fPIC',
|
||||
...platformFlags
|
||||
].join(' ');
|
||||
|
||||
const ldflags = [
|
||||
'-stdlib=libc++',
|
||||
'-fuse-ld=lld',
|
||||
`-L"${path.resolve(BASE, 'out', `${utils.getOutDir({ shouldLog: true })}`, 'obj', 'buildtools', 'third_party', 'libc++abi')}"`,
|
||||
`-L"${path.resolve(BASE, 'out', `${utils.getOutDir({ shouldLog: true })}`, 'obj', 'buildtools', 'third_party', 'libc++')}"`,
|
||||
'-lc++abi'
|
||||
`-L"${path.resolve(BASE, 'out', outDir, 'obj', 'buildtools', 'third_party', 'libc++abi')}"`,
|
||||
`-L"${path.resolve(BASE, 'out', outDir, 'obj', 'buildtools', 'third_party', 'libc++')}"`,
|
||||
'-lc++abi',
|
||||
...platformFlags
|
||||
].join(' ');
|
||||
|
||||
if (process.platform !== 'win32') {
|
||||
|
@ -66,6 +88,7 @@ async function main () {
|
|||
cwd: NAN_DIR,
|
||||
stdio: 'inherit'
|
||||
});
|
||||
|
||||
if (buildStatus !== 0) {
|
||||
console.error('Failed to build nan test modules');
|
||||
return process.exit(buildStatus);
|
||||
|
|
Загрузка…
Ссылка в новой задаче