@@ -17,7 +17,11 @@ foreach(proj ${LLVM_ENABLE_RUNTIMES})
17
17
endforeach ()
18
18
19
19
function (get_compiler_rt_path path )
20
- foreach (entry ${runtimes} )
20
+ set (all_runtimes ${runtimes} )
21
+ foreach (name ${LLVM_RUNTIME_TARGETS} )
22
+ list (APPEND all_runtimes RUNTIMES_${name}_LLVM_ENABLE_RUNTIMES )
23
+ endforeach ()
24
+ foreach (entry ${all_runtimes} )
21
25
get_filename_component (projName ${entry} NAME )
22
26
if ("${projName} " MATCHES "compiler-rt" )
23
27
set (${path} ${entry} PARENT_SCOPE )
@@ -138,37 +142,44 @@ endfunction()
138
142
# before the just-built compiler can pass the configuration tests.
139
143
get_compiler_rt_path (compiler_rt_path )
140
144
if (compiler_rt_path )
141
- if (NOT LLVM_BUILTIN_TARGETS )
145
+ # If the user did not specify the targets infer them from the runtimes.
146
+ set (builtin_targets ${LLVM_BUILTIN_TARGETS} )
147
+ if (NOT builtin_targets )
148
+ if ("compiler-rt" IN_LIST LLVM_ENABLE_RUNTIMES )
149
+ list (APPEND builtin_targets "default" )
150
+ endif ()
151
+ foreach (name ${LLVM_RUNTIME_TARGETS} )
152
+ if ("compiler-rt" IN_LIST RUNTIMES_${name}_LLVM_ENABLE_RUNTIMES )
153
+ list (APPEND builtin_targets ${name} )
154
+ endif ()
155
+ endforeach ()
156
+ endif ()
157
+ if ("default" IN_LIST builtin_targets )
142
158
builtin_default_target (${compiler_rt_path}
143
159
DEPENDS clang-resource-headers )
160
+ list (REMOVE_ITEM builtin_targets "default" )
144
161
else ()
145
- if ("default" IN_LIST LLVM_BUILTIN_TARGETS )
146
- builtin_default_target (${compiler_rt_path}
147
- DEPENDS clang-resource-headers )
148
- list (REMOVE_ITEM LLVM_BUILTIN_TARGETS "default" )
149
- else ()
150
- add_custom_target (builtins )
151
- add_custom_target (install -builtins )
152
- add_custom_target (install -builtins-stripped )
153
- set_target_properties (
154
- builtins install -builtins install -builtins-stripped
155
- PROPERTIES FOLDER "Compiler-RT"
156
- )
157
- endif ()
162
+ add_custom_target (builtins )
163
+ add_custom_target (install -builtins )
164
+ add_custom_target (install -builtins-stripped )
165
+ set_target_properties (
166
+ builtins install -builtins install -builtins-stripped
167
+ PROPERTIES FOLDER "Compiler-RT"
168
+ )
169
+ endif ()
158
170
159
- foreach (target ${LLVM_BUILTIN_TARGETS } )
160
- check_apple_target (${target} builtin )
171
+ foreach (target ${builtin_targets } )
172
+ check_apple_target (${target} builtin )
161
173
162
- builtin_register_target (${compiler_rt_path} ${target}
163
- DEPENDS clang-resource-headers
164
- CMAKE_ARGS -DLLVM_DEFAULT_TARGET_TRIPLE=${target}
165
- EXTRA_ARGS TARGET_TRIPLE ${target} )
174
+ builtin_register_target (${compiler_rt_path} ${target}
175
+ DEPENDS clang-resource-headers
176
+ CMAKE_ARGS -DLLVM_DEFAULT_TARGET_TRIPLE=${target}
177
+ EXTRA_ARGS TARGET_TRIPLE ${target} )
166
178
167
- add_dependencies (builtins builtins-${target} )
168
- add_dependencies (install -builtins install -builtins-${target} )
169
- add_dependencies (install -builtins-stripped install -builtins-${target}-stripped )
170
- endforeach ()
171
- endif ()
179
+ add_dependencies (builtins builtins-${target} )
180
+ add_dependencies (install -builtins install -builtins-${target} )
181
+ add_dependencies (install -builtins-stripped install -builtins-${target}-stripped )
182
+ endforeach ()
172
183
set (builtins_dep builtins )
173
184
# We don't need to depend on the builtins if we're building instrumented
174
185
# because the next stage will use the same compiler used to build this stage.
0 commit comments