@@ -437,17 +437,16 @@ function(_add_host_variant_link_flags target)
437437 "${SWIFT_HOST_VARIANT_SDK} " "" )
438438endfunction ()
439439
440- # Add a single variant of a new Swift library.
440+ # Add a new Swift host library.
441441#
442442# Usage:
443- # _add_swift_host_library_single(
444- # target
443+ # add_swift_host_library(name
445444# [SHARED]
446445# [STATIC]
447446# [LLVM_LINK_COMPONENTS comp1 ...]
448447# source1 [source2 source3 ...])
449448#
450- # target
449+ # name
451450# Name of the library (e.g., swiftParse).
452451#
453452# SHARED
@@ -460,63 +459,63 @@ endfunction()
460459# LLVM components this library depends on.
461460#
462461# source1 ...
463- # Sources to add into this library
464- function (_add_swift_host_library_single target )
462+ # Sources to add into this library.
463+ function (add_swift_host_library name )
465464 set (options
466465 SHARED
467466 STATIC )
468467 set (single_parameter_options)
469468 set (multiple_parameter_options
470469 LLVM_LINK_COMPONENTS)
471470
472- cmake_parse_arguments (ASHLS
471+ cmake_parse_arguments (ASHL
473472 "${options} "
474473 "${single_parameter_options} "
475474 "${multiple_parameter_options} "
476475 ${ARGN} )
477- set (ASHLS_SOURCES ${ASHLS_UNPARSED_ARGUMENTS } )
476+ set (ASHL_SOURCES ${ASHL_UNPARSED_ARGUMENTS } )
478477
479- translate_flags(ASHLS "${options} " )
478+ translate_flags(ASHL "${options} " )
480479
481- if (NOT ASHLS_SHARED AND NOT ASHLS_STATIC )
480+ if (NOT ASHL_SHARED AND NOT ASHL_STATIC )
482481 message (FATAL_ERROR "Either SHARED or STATIC must be specified" )
483482 endif ()
484483
485484 # Include LLVM Bitcode slices for iOS, Watch OS, and Apple TV OS device libraries.
486485 set (embed_bitcode_arg)
487486 if (SWIFT_EMBED_BITCODE_SECTION)
488487 if (SWIFT_HOST_VARIANT_SDK MATCHES "(I|TV|WATCH)OS" )
489- list (APPEND ASHLS_C_COMPILE_FLAGS "-fembed-bitcode" )
488+ list (APPEND ASHL_C_COMPILE_FLAGS "-fembed-bitcode" )
490489 set (embed_bitcode_arg EMBED_BITCODE)
491490 endif ()
492491 endif ()
493492
494493 if (XCODE)
495494 string (REGEX MATCHALL "/[^/]+" split_path ${CMAKE_CURRENT_SOURCE_DIR} )
496495 list (GET split_path -1 dir)
497- file (GLOB_RECURSE ASHLS_HEADERS
496+ file (GLOB_RECURSE ASHL_HEADERS
498497 ${SWIFT_SOURCE_DIR} /include /swift${dir} /*.h
499498 ${SWIFT_SOURCE_DIR} /include /swift${dir} /*.def
500499 ${CMAKE_CURRENT_SOURCE_DIR} /*.def)
501500
502- file (GLOB_RECURSE ASHLS_TDS
501+ file (GLOB_RECURSE ASHL_TDS
503502 ${SWIFT_SOURCE_DIR} /include /swift${dir} /*.td)
504503
505- set_source_files_properties (${ASHLS_HEADERS } ${ASHLS_TDS }
504+ set_source_files_properties (${ASHL_HEADERS } ${ASHL_TDS }
506505 PROPERTIES
507506 HEADER_FILE_ONLY true )
508- source_group ("TableGen descriptions" FILES ${ASHLS_TDS } )
507+ source_group ("TableGen descriptions" FILES ${ASHL_TDS } )
509508
510- set (ASHLS_SOURCES ${ASHLS_SOURCES } ${ASHLS_HEADERS } ${ASHLS_TDS } )
509+ set (ASHL_SOURCES ${ASHL_SOURCES } ${ASHL_HEADERS } ${ASHL_TDS } )
511510 endif ()
512511
513- if (ASHLS_SHARED )
512+ if (ASHL_SHARED )
514513 set (libkind SHARED)
515- elseif (ASHLS_STATIC )
514+ elseif (ASHL_STATIC )
516515 set (libkind STATIC )
517516 endif ()
518517
519- add_library ("${target} " ${libkind} ${ASHLS_SOURCES } )
518+ add_library ("${target} " ${libkind} ${ASHL_SOURCES } )
520519 _set_target_prefix_and_suffix("${target} " "${libkind} " "${SWIFT_HOST_VARIANT_SDK} " )
521520 add_dependencies (${target} ${LLVM_COMMON_DEPENDS} )
522521
@@ -560,10 +559,10 @@ function(_add_swift_host_library_single target)
560559 set_target_properties ("${target} " PROPERTIES FOLDER "Swift libraries" )
561560
562561 # Call llvm_config() only for libraries that are part of the compiler.
563- swift_common_llvm_config("${target} " ${ASHLS_LLVM_LINK_COMPONENTS } )
562+ swift_common_llvm_config("${target} " ${ASHL_LLVM_LINK_COMPONENTS } )
564563
565564 target_compile_options (${target} PRIVATE
566- ${ASHLS_C_COMPILE_FLAGS } )
565+ ${ASHL_C_COMPILE_FLAGS } )
567566 if (SWIFT_HOST_VARIANT_SDK STREQUAL WINDOWS)
568567 if (libkind STREQUAL SHARED)
569568 target_compile_definitions (${target} PRIVATE
@@ -582,9 +581,9 @@ function(_add_swift_host_library_single target)
582581 ${${SWIFT_HOST_VARIANT_ARCH} _INCLUDE})
583582
584583 if (NOT ${CMAKE_C_COMPILER_ID} STREQUAL MSVC )
585- swift_windows_get_sdk_vfs_overlay(ASHLS_VFS_OVERLAY )
584+ swift_windows_get_sdk_vfs_overlay(ASHL_VFS_OVERLAY )
586585 target_compile_options (${target} PRIVATE
587- "SHELL:-Xclang -ivfsoverlay -Xclang ${ASHLS_VFS_OVERLAY } " )
586+ "SHELL:-Xclang -ivfsoverlay -Xclang ${ASHL_VFS_OVERLAY } " )
588587
589588 # MSVC doesn't support -Xclang. We don't need to manually specify
590589 # the dependent libraries as `cl` does so.
@@ -622,61 +621,6 @@ function(_add_swift_host_library_single target)
622621 endif ()
623622 endif ()
624623
625- # Do not add code here.
626- endfunction ()
627-
628- # Add a new Swift host library.
629- #
630- # Usage:
631- # add_swift_host_library(name
632- # [SHARED]
633- # [STATIC]
634- # [LLVM_LINK_COMPONENTS comp1 ...]
635- # source1 [source2 source3 ...])
636- #
637- # name
638- # Name of the library (e.g., swiftParse).
639- #
640- # SHARED
641- # Build a shared library.
642- #
643- # STATIC
644- # Build a static library.
645- #
646- # LLVM_LINK_COMPONENTS
647- # LLVM components this library depends on.
648- #
649- # source1 ...
650- # Sources to add into this library.
651- function (add_swift_host_library name )
652- set (options
653- SHARED
654- STATIC )
655- set (single_parameter_options)
656- set (multiple_parameter_options
657- LLVM_LINK_COMPONENTS)
658-
659- cmake_parse_arguments (ASHL
660- "${options} "
661- "${single_parameter_options} "
662- "${multiple_parameter_options} "
663- ${ARGN} )
664- set (ASHL_SOURCES ${ASHL_UNPARSED_ARGUMENTS} )
665-
666- translate_flags(ASHL "${options} " )
667-
668- if (NOT ASHL_SHARED AND NOT ASHL_STATIC)
669- message (FATAL_ERROR "Either SHARED or STATIC must be specified" )
670- endif ()
671-
672- _add_swift_host_library_single(
673- ${name}
674- ${ASHL_SHARED_keyword}
675- ${ASHL_STATIC_keyword}
676- ${ASHL_SOURCES}
677- LLVM_LINK_COMPONENTS ${ASHL_LLVM_LINK_COMPONENTS}
678- )
679-
680624 add_dependencies (dev ${name} )
681625 if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
682626 swift_install_in_component(TARGETS ${name}
0 commit comments