Skip to content

Commit e79f34c

Browse files
build: use libc++ for nan tests
1 parent 3b79999 commit e79f34c

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

.circleci/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -680,6 +680,7 @@ step-persist-data-for-tests: &step-persist-data-for-tests
680680
- src/third_party/electron_node
681681
- src/third_party/nan
682682
- src/third_party/llvm-build
683+
- src/build/linux
683684

684685
step-electron-dist-unzip: &step-electron-dist-unzip
685686
run:

script/nan-spec-runner.js

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,28 @@ const args = require('minimist')(process.argv.slice(2), {
1717
string: ['only']
1818
});
1919

20+
function getSDKRoot () {
21+
if (process.env.SDKROOT) return process.env.SDKROOT;
22+
const output = cp.execFileSync('xcrun', ['--sdk', 'macosx', '--show-sdk-path']);
23+
return output.toString().trim();
24+
}
25+
2026
async function main () {
2127
const nodeDir = path.resolve(BASE, `out/${utils.getOutDir({ shouldLog: true })}/gen/node_headers`);
2228
const env = Object.assign({}, process.env, {
2329
npm_config_nodedir: nodeDir,
2430
npm_config_msvs_version: '2019',
2531
npm_config_arch: process.env.NPM_CONFIG_ARCH
2632
});
27-
if (process.platform === 'linux') {
28-
env.CC = `"${path.resolve(__dirname, '..', '../third_party/llvm-build/Release+Asserts/bin/clang')}"`;
29-
env.CXX = `"${path.resolve(__dirname, '..', '../third_party/llvm-build/Release+Asserts/bin/clang++')}"`;
33+
const clangArgs = [];
34+
if (process.platform === 'darwin') {
35+
clangArgs.push('-isysroot', getSDKRoot());
36+
}
37+
clangArgs.push('-std=c++14', '-stdlib=libc++');
38+
39+
if (process.platform !== 'win32') {
40+
env.CC = `"${path.resolve(__dirname, '..', '../third_party/llvm-build/Release+Asserts/bin/clang')}" ${clangArgs.join(' ')}`;
41+
env.CXX = `"${path.resolve(__dirname, '..', '../third_party/llvm-build/Release+Asserts/bin/clang++')}" ${clangArgs.join(' ')}`;
3042
}
3143
const { status: buildStatus } = cp.spawnSync(NPX_CMD, ['node-gyp', 'rebuild', '--directory', 'test', '-j', 'max'], {
3244
env,

0 commit comments

Comments
 (0)