@@ -171,12 +171,20 @@ if(compiler_rt_path)
171
171
endif ()
172
172
endif ()
173
173
174
+ function (_get_runtime_name name out_var)
175
+ string (FIND ${name} "lib" idx)
176
+ if (idx EQUAL 0 AND NOT ${name} STREQUAL "libc" )
177
+ string (SUBSTRING ${name} 3 -1 entry)
178
+ endif ()
179
+ set (${out_var} ${name} PARENT_SCOPE)
180
+ endfunction ()
181
+
174
182
# Create a list with the names of all the runtime projects in all uppercase and
175
183
# with dashes turned to underscores. This gives us the CMake variable `prefixes`
176
184
# for all variables that will apply to runtimes.
177
185
foreach (entry ${runtimes} )
178
- get_filename_component (projName ${entry} NAME )
179
- string (REPLACE "-" "_" canon_name ${projName } )
186
+ get_filename_component (name ${entry} NAME )
187
+ string (REPLACE "-" "_" canon_name ${name } )
180
188
string (TOUPPER ${canon_name} canon_name)
181
189
list (APPEND prefixes ${canon_name} )
182
190
if (${canon_name} STREQUAL "OPENMP" )
@@ -196,11 +204,8 @@ foreach(entry ${runtimes})
196
204
endif ()
197
205
endif ()
198
206
199
- string (FIND ${projName} "lib" LIB_IDX)
200
- if (LIB_IDX EQUAL 0 AND NOT projName STREQUAL "libc" )
201
- string (SUBSTRING ${projName} 3 -1 projName)
202
- endif ()
203
- list (APPEND runtime_names ${projName} )
207
+ _get_runtime_name(${name} name )
208
+ list (APPEND RUNTIME_NAMES ${name} )
204
209
endforeach ()
205
210
206
211
function (runtime_default_target)
@@ -210,7 +215,7 @@ function(runtime_default_target)
210
215
set (SUB_CHECK_TARGETS ${SUB_CHECK_TARGETS} PARENT_SCOPE)
211
216
set_property (DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${LLVM_BINARY_DIR} /runtimes/Components.cmake)
212
217
213
- foreach (runtime_name ${runtime_names } )
218
+ foreach (runtime_name ${RUNTIME_NAMES } )
214
219
list (APPEND extra_targets
215
220
${runtime_name}
216
221
install -${runtime_name}
@@ -268,6 +273,17 @@ function(runtime_register_target name)
268
273
include (${LLVM_BINARY_DIR} /runtimes/${name} /Components.cmake OPTIONAL )
269
274
set_property (DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${LLVM_BINARY_DIR} /runtimes/${name} /Components.cmake)
270
275
276
+ set (runtime_names ${RUNTIME_NAMES} )
277
+ foreach (_name IN ITEMS ${ARG_BASE_NAME} ${name} )
278
+ if (RUNTIMES_${_name} _LLVM_ENABLE_RUNTIMES)
279
+ set (runtime_names)
280
+ foreach (entry ${RUNTIMES_${_name} _LLVM_ENABLE_RUNTIMES})
281
+ _get_runtime_name(${entry} runtime_name)
282
+ list (APPEND runtime_names ${runtime_name} )
283
+ endforeach ()
284
+ endif ()
285
+ endforeach ()
286
+
271
287
foreach (runtime_name ${runtime_names} )
272
288
set (${runtime_name} -${name} ${runtime_name} )
273
289
set (install -${runtime_name} -${name} install -${runtime_name} )
@@ -365,6 +381,25 @@ function(runtime_register_target name)
365
381
${${name} _test_targets}
366
382
USE_TOOLCHAIN
367
383
${EXTRA_ARGS} ${ARG_EXTRA_ARGS} )
384
+
385
+ add_dependencies (runtimes runtimes-${name} )
386
+ add_dependencies (runtimes-configure runtimes-${name} -configure)
387
+ add_dependencies (install -runtimes install -runtimes-${name} )
388
+ add_dependencies (install -runtimes-stripped install -runtimes-${name} -stripped)
389
+ if (LLVM_INCLUDE_TESTS)
390
+ add_dependencies (check-runtimes check-runtimes-${name} )
391
+ add_dependencies (runtimes-test -depends runtimes-test -depends -${name} )
392
+ endif ()
393
+ foreach (runtime_name ${runtime_names} )
394
+ add_dependencies (${runtime_name} ${runtime_name} -${name} )
395
+ add_dependencies (install -${runtime_name} install -${runtime_name} -${name} )
396
+ add_dependencies (install -${runtime_name} -stripped install -${runtime_name} -${name} -stripped)
397
+ endforeach ()
398
+ foreach (component ${LLVM_RUNTIME_DISTRIBUTION_COMPONENTS} )
399
+ add_dependencies (${component} ${component} -${name} )
400
+ add_dependencies (install -${component} install -${component} -${name} )
401
+ add_dependencies (install -${component} -stripped install -${component} -${name} -stripped)
402
+ endforeach ()
368
403
endfunction ()
369
404
370
405
if (runtimes)
@@ -424,7 +459,7 @@ if(runtimes)
424
459
add_custom_target (runtimes-test -depends )
425
460
set (test_targets "" )
426
461
endif ()
427
- foreach (runtime_name ${runtime_names } )
462
+ foreach (runtime_name ${RUNTIME_NAMES } )
428
463
add_custom_target (${runtime_name} )
429
464
add_custom_target (install -${runtime_name} )
430
465
add_custom_target (install -${runtime_name} -stripped)
@@ -453,25 +488,6 @@ if(runtimes)
453
488
DEPENDS ${builtins_dep_name} ${libc_tools}
454
489
CMAKE_ARGS -DLLVM_DEFAULT_TARGET_TRIPLE=${name} ${libc_cmake_args}
455
490
EXTRA_ARGS TARGET_TRIPLE ${name} )
456
-
457
- add_dependencies (runtimes runtimes-${name} )
458
- add_dependencies (runtimes-configure runtimes-${name} -configure)
459
- add_dependencies (install -runtimes install -runtimes-${name} )
460
- add_dependencies (install -runtimes-stripped install -runtimes-${name} -stripped)
461
- if (LLVM_INCLUDE_TESTS)
462
- add_dependencies (check-runtimes check-runtimes-${name} )
463
- add_dependencies (runtimes-test -depends runtimes-test -depends -${name} )
464
- endif ()
465
- foreach (runtime_name ${runtime_names} )
466
- add_dependencies (${runtime_name} ${runtime_name} -${name} )
467
- add_dependencies (install -${runtime_name} install -${runtime_name} -${name} )
468
- add_dependencies (install -${runtime_name} -stripped install -${runtime_name} -${name} -stripped)
469
- endforeach ()
470
- foreach (component ${LLVM_RUNTIME_DISTRIBUTION_COMPONENTS} )
471
- add_dependencies (${component} ${component} -${name} )
472
- add_dependencies (install -${component} install -${component} -${name} )
473
- add_dependencies (install -${component} -stripped install -${component} -${name} -stripped)
474
- endforeach ()
475
491
endforeach ()
476
492
477
493
foreach (multilib ${LLVM_RUNTIME_MULTILIBS} )
@@ -483,21 +499,6 @@ if(runtimes)
483
499
-DLLVM_RUNTIMES_LIBDIR_SUBDIR=${multilib}
484
500
BASE_NAME ${name}
485
501
EXTRA_ARGS TARGET_TRIPLE ${name} )
486
-
487
- add_dependencies (runtimes runtimes-${name} +${multilib} )
488
- add_dependencies (runtimes-configure runtimes-${name} +${multilib} -configure)
489
- add_dependencies (install -runtimes install -runtimes-${name} +${multilib} )
490
- add_dependencies (install -runtimes-stripped install -runtimes-${name} +${multilib} -stripped)
491
- foreach (runtime_name ${runtime_names} )
492
- add_dependencies (${runtime_name} ${runtime_name} -${name} +${multilib} )
493
- add_dependencies (install -${runtime_name} install -${runtime_name} -${name} +${multilib} )
494
- add_dependencies (install -${runtime_name} -stripped install -${runtime_name} -${name} +${multilib} -stripped)
495
- endforeach ()
496
- foreach (component ${LLVM_RUNTIME_DISTRIBUTION_COMPONENTS} )
497
- add_dependencies (${component} ${component} -${name} +${multilib} )
498
- add_dependencies (install -${component} install -${component} -${name} +${multilib} )
499
- add_dependencies (install -${component} -stripped install -${component} -${name} +${multilib} -stripped)
500
- endforeach ()
501
502
endforeach ()
502
503
endforeach ()
503
504
endif ()
0 commit comments