Skip to content

Commit 3af3375

Browse files
committed
[build] Fix build on macOS 10.15 or earlier
1 parent bdd2b2c commit 3af3375

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

binding.gyp

+15-4
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,22 @@
66
'cflags': ['-std=c99'],
77
'conditions': [
88
["OS=='mac'", {
9+
'variables': {
10+
'clang_version':
11+
'<!(cc -v 2>&1 | perl -ne \'print $1 if /clang version ([0-9]+(\.[0-9]+){2,})/\')'
12+
},
913
'xcode_settings': {
10-
'MACOSX_DEPLOYMENT_TARGET': '10.7',
11-
'OTHER_CFLAGS': ['-arch x86_64', '-arch arm64'],
12-
'OTHER_LDFLAGS': ['-arch x86_64', '-arch arm64']
13-
}
14+
'MACOSX_DEPLOYMENT_TARGET': '10.7'
15+
},
16+
'conditions': [
17+
# Use Perl v-strings to compare versions.
18+
['clang_version and <!(perl -e \'print <(clang_version) cmp 12.0.0\')==1', {
19+
'xcode_settings': {
20+
'OTHER_CFLAGS': ['-arch arm64'],
21+
'OTHER_LDFLAGS': ['-arch arm64']
22+
}
23+
}]
24+
]
1425
}]
1526
]
1627
}

0 commit comments

Comments
 (0)