@@ -45,7 +45,10 @@ def should_install(self, host_target):
45
45
46
46
def build (self , host_target ):
47
47
build_root = os .path .dirname (self .build_dir )
48
- llvm_build_dir = os .path .join ('..' , build_root , '%s-%s' % ('llvm' , host_target ))
48
+ llvm_build_bin_dir = os .path .join (
49
+ '..' , build_root , '%s-%s' % ('llvm' , host_target ), 'bin' )
50
+ llvm_tools_path = self .args .native_llvm_tools_path or llvm_build_bin_dir
51
+ clang_tools_path = self .args .native_clang_tools_path or llvm_build_bin_dir
49
52
build_jobs = self .args .build_jobs or multiprocessing .cpu_count ()
50
53
51
54
sysroot_build_dir = WASILibc .sysroot_build_path (build_root , host_target )
@@ -66,9 +69,9 @@ def build(self, host_target):
66
69
'OBJDIR=' + os .path .join (self .build_dir , 'obj' ),
67
70
'SYSROOT=' + sysroot_build_dir ,
68
71
'INSTALL_DIR=' + WASILibc .sysroot_install_path (build_root ),
69
- 'CC=' + os .path .join (llvm_build_dir , 'bin' , 'clang' ),
70
- 'AR=' + os .path .join (llvm_build_dir , 'bin' , 'llvm-ar' ),
71
- 'NM=' + os .path .join (llvm_build_dir , 'bin' , 'llvm-nm' ),
72
+ 'CC=' + os .path .join (clang_tools_path , 'clang' ),
73
+ 'AR=' + os .path .join (llvm_tools_path , 'llvm-ar' ),
74
+ 'NM=' + os .path .join (llvm_tools_path , 'llvm-nm' ),
72
75
])
73
76
74
77
@classmethod
@@ -119,7 +122,10 @@ def should_install(self, host_target):
119
122
120
123
def build (self , host_target ):
121
124
build_root = os .path .dirname (self .build_dir )
122
- llvm_build_dir = os .path .join ('..' , build_root , '%s-%s' % ('llvm' , host_target ))
125
+ llvm_build_bin_dir = os .path .join (
126
+ '..' , build_root , '%s-%s' % ('llvm' , host_target ), 'bin' )
127
+ llvm_tools_path = self .args .native_llvm_tools_path or llvm_build_bin_dir
128
+ clang_tools_path = self .args .native_clang_tools_path or llvm_build_bin_dir
123
129
124
130
self .cmake_options .define ('CMAKE_SYSROOT:PATH' ,
125
131
WASILibc .sysroot_build_path (build_root , host_target ))
@@ -144,13 +150,13 @@ def build(self, host_target):
144
150
self .cmake_options .define ('CMAKE_SYSTEM_NAME:STRING' , 'WASI' )
145
151
self .cmake_options .define ('CMAKE_SYSTEM_PROCESSOR:STRING' , 'wasm32' )
146
152
self .cmake_options .define ('CMAKE_AR:FILEPATH' ,
147
- os .path .join (llvm_build_dir , 'bin' , 'llvm-ar' ))
153
+ os .path .join (llvm_tools_path , 'llvm-ar' ))
148
154
self .cmake_options .define ('CMAKE_RANLIB:FILEPATH' ,
149
- os .path .join (llvm_build_dir , 'bin' , 'llvm-ranlib' ))
155
+ os .path .join (llvm_tools_path , 'llvm-ranlib' ))
150
156
self .cmake_options .define ('CMAKE_C_COMPILER:FILEPATH' ,
151
- os .path .join (llvm_build_dir , 'bin' , 'clang' ))
157
+ os .path .join (clang_tools_path , 'clang' ))
152
158
self .cmake_options .define ('CMAKE_CXX_COMPILER:STRING' ,
153
- os .path .join (llvm_build_dir , 'bin' , 'clang++' ))
159
+ os .path .join (clang_tools_path , 'clang++' ))
154
160
# Explicitly disable exceptions even though it's usually implicitly disabled by
155
161
# LIBCXX_ENABLE_EXCEPTIONS because the CMake feature check fails to detect
156
162
# -fno-exceptions support in clang due to missing compiler-rt while configuring
@@ -188,7 +194,7 @@ def build(self, host_target):
188
194
self .cmake_options .define ('UNIX:BOOL' , 'TRUE' )
189
195
190
196
self .build_with_cmake ([], self .args .build_variant , [],
191
- prefer_just_built_toolchain = True )
197
+ prefer_native_toolchain = True )
192
198
self .install_with_cmake (
193
199
["install" ], WASILibc .sysroot_install_path (build_root ))
194
200
0 commit comments