Skip to content

Commit dc7d1dd

Browse files
committed
[build] Fix build on macOS 10.15 or earlier
1 parent 3628c70 commit dc7d1dd

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

binding.gyp

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,22 @@
1212
'cflags_cc': ['-std=gnu++11'],
1313
'conditions': [
1414
["OS=='mac'", {
15+
'variables': {
16+
'clang_version':
17+
'<!(cc -v 2>&1 | perl -ne \'print $1 if /clang version ([0-9]+(\.[0-9]+){2,})/\')'
18+
},
1519
'xcode_settings': {
16-
'MACOSX_DEPLOYMENT_TARGET': '10.7',
17-
'OTHER_CFLAGS': ['-arch x86_64', '-arch arm64'],
18-
'OTHER_LDFLAGS': ['-arch x86_64', '-arch arm64']
19-
}
20+
'MACOSX_DEPLOYMENT_TARGET': '10.7'
21+
},
22+
'conditions': [
23+
# Use Perl v-strings to compare versions.
24+
['clang_version and <!(perl -e \'print <(clang_version) cmp 12.0.0\')==1', {
25+
'xcode_settings': {
26+
'OTHER_CFLAGS': ['-arch arm64'],
27+
'OTHER_LDFLAGS': ['-arch arm64']
28+
}
29+
}]
30+
]
2031
}]
2132
]
2233
}

0 commit comments

Comments
 (0)