File tree Expand file tree Collapse file tree 1 file changed +21
-3
lines changed Expand file tree Collapse file tree 1 file changed +21
-3
lines changed Original file line number Diff line number Diff line change 5
5
6
6
import logging
7
7
import os
8
+ import platform
9
+ import sys
8
10
from tools .shared import PIPE , run_process , CLANG_CC , CLANG_CXX
9
11
from tools .utils import MACOS , WINDOWS , path_from_root
10
12
11
13
logger = logging .getLogger ('clang_native' )
12
14
13
15
16
+ def get_native_triple ():
17
+ arch = {
18
+ 'aarch64' : 'arm64' ,
19
+ 'arm64' : 'arm64' ,
20
+ 'x86_64' : 'x86_64' ,
21
+ 'AMD64' : 'x86_64' ,
22
+ }[platform .machine ()]
23
+ OS = {
24
+ 'linux' : 'linux' ,
25
+ 'darwin' : 'darwin' ,
26
+ 'win32' : 'windows-msvc' ,
27
+ }[sys .platform ]
28
+ return f'{ arch } -{ OS } '
29
+
30
+
14
31
# These extra args need to be passed to Clang when targeting a native host system executable
15
32
def get_clang_native_args ():
33
+ triple = ['--target=' + get_native_triple ()]
16
34
if MACOS :
17
- return ['-isystem' , path_from_root ('system/include/libcxx' )]
35
+ return triple + ['-isystem' , path_from_root ('system/include/libcxx' )]
18
36
elif os .name == 'nt' :
19
37
# TODO: If Windows.h et al. are needed, will need to add something like '-isystemC:/Program
20
38
# Files (x86)/Microsoft SDKs/Windows/v7.1A/Include'.
21
- return ['-DWIN32' ]
39
+ return triple + ['-DWIN32' ]
22
40
else :
23
- return []
41
+ return triple
24
42
25
43
26
44
# This environment needs to be present when targeting a native host system executable
You can’t perform that action at this time.
0 commit comments