@@ -437,17 +437,16 @@ function(_add_host_variant_link_flags target)
437
437
"${SWIFT_HOST_VARIANT_SDK} " "" )
438
438
endfunction ()
439
439
440
- # Add a single variant of a new Swift library.
440
+ # Add a new Swift host library.
441
441
#
442
442
# Usage:
443
- # _add_swift_host_library_single(
444
- # target
443
+ # add_swift_host_library(name
445
444
# [SHARED]
446
445
# [STATIC]
447
446
# [LLVM_LINK_COMPONENTS comp1 ...]
448
447
# source1 [source2 source3 ...])
449
448
#
450
- # target
449
+ # name
451
450
# Name of the library (e.g., swiftParse).
452
451
#
453
452
# SHARED
@@ -460,63 +459,63 @@ endfunction()
460
459
# LLVM components this library depends on.
461
460
#
462
461
# 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 )
465
464
set (options
466
465
SHARED
467
466
STATIC )
468
467
set (single_parameter_options )
469
468
set (multiple_parameter_options
470
469
LLVM_LINK_COMPONENTS )
471
470
472
- cmake_parse_arguments (ASHLS
471
+ cmake_parse_arguments (ASHL
473
472
"${options} "
474
473
"${single_parameter_options} "
475
474
"${multiple_parameter_options} "
476
475
${ARGN} )
477
- set (ASHLS_SOURCES ${ASHLS_UNPARSED_ARGUMENTS } )
476
+ set (ASHL_SOURCES ${ASHL_UNPARSED_ARGUMENTS } )
478
477
479
- translate_flags (ASHLS "${options} " )
478
+ translate_flags (ASHL "${options} " )
480
479
481
- if (NOT ASHLS_SHARED AND NOT ASHLS_STATIC )
480
+ if (NOT ASHL_SHARED AND NOT ASHL_STATIC )
482
481
message (FATAL_ERROR "Either SHARED or STATIC must be specified" )
483
482
endif ()
484
483
485
484
# Include LLVM Bitcode slices for iOS, Watch OS, and Apple TV OS device libraries.
486
485
set (embed_bitcode_arg )
487
486
if (SWIFT_EMBED_BITCODE_SECTION )
488
487
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" )
490
489
set (embed_bitcode_arg EMBED_BITCODE )
491
490
endif ()
492
491
endif ()
493
492
494
493
if (XCODE )
495
494
string (REGEX MATCHALL "/[^/]+" split_path ${CMAKE_CURRENT_SOURCE_DIR} )
496
495
list (GET split_path -1 dir )
497
- file (GLOB_RECURSE ASHLS_HEADERS
496
+ file (GLOB_RECURSE ASHL_HEADERS
498
497
${SWIFT_SOURCE_DIR} /include/swift${dir}/*.h
499
498
${SWIFT_SOURCE_DIR} /include/swift${dir}/*.def
500
499
${CMAKE_CURRENT_SOURCE_DIR} /*.def )
501
500
502
- file (GLOB_RECURSE ASHLS_TDS
501
+ file (GLOB_RECURSE ASHL_TDS
503
502
${SWIFT_SOURCE_DIR} /include/swift${dir}/*.td )
504
503
505
- set_source_files_properties (${ASHLS_HEADERS } ${ASHLS_TDS }
504
+ set_source_files_properties (${ASHL_HEADERS } ${ASHL_TDS }
506
505
PROPERTIES
507
506
HEADER_FILE_ONLY true )
508
- source_group ("TableGen descriptions" FILES ${ASHLS_TDS } )
507
+ source_group ("TableGen descriptions" FILES ${ASHL_TDS } )
509
508
510
- set (ASHLS_SOURCES ${ASHLS_SOURCES } ${ASHLS_HEADERS } ${ASHLS_TDS } )
509
+ set (ASHL_SOURCES ${ASHL_SOURCES } ${ASHL_HEADERS } ${ASHL_TDS } )
511
510
endif ()
512
511
513
- if (ASHLS_SHARED )
512
+ if (ASHL_SHARED )
514
513
set (libkind SHARED )
515
- elseif (ASHLS_STATIC )
514
+ elseif (ASHL_STATIC )
516
515
set (libkind STATIC )
517
516
endif ()
518
517
519
- add_library ("${target} " ${libkind} ${ASHLS_SOURCES } )
518
+ add_library ("${target} " ${libkind} ${ASHL_SOURCES } )
520
519
_set_target_prefix_and_suffix ("${target} " "${libkind} " "${SWIFT_HOST_VARIANT_SDK} " )
521
520
add_dependencies (${target} ${LLVM_COMMON_DEPENDS} )
522
521
@@ -560,10 +559,10 @@ function(_add_swift_host_library_single target)
560
559
set_target_properties ("${target} " PROPERTIES FOLDER "Swift libraries" )
561
560
562
561
# 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 } )
564
563
565
564
target_compile_options (${target} PRIVATE
566
- ${ASHLS_C_COMPILE_FLAGS } )
565
+ ${ASHL_C_COMPILE_FLAGS } )
567
566
if (SWIFT_HOST_VARIANT_SDK STREQUAL WINDOWS )
568
567
if (libkind STREQUAL SHARED )
569
568
target_compile_definitions (${target} PRIVATE
@@ -582,9 +581,9 @@ function(_add_swift_host_library_single target)
582
581
${${SWIFT_HOST_VARIANT_ARCH}_INCLUDE} )
583
582
584
583
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 )
586
585
target_compile_options (${target} PRIVATE
587
- "SHELL:-Xclang -ivfsoverlay -Xclang ${ASHLS_VFS_OVERLAY } " )
586
+ "SHELL:-Xclang -ivfsoverlay -Xclang ${ASHL_VFS_OVERLAY } " )
588
587
589
588
# MSVC doesn't support -Xclang. We don't need to manually specify
590
589
# the dependent libraries as `cl` does so.
@@ -622,61 +621,6 @@ function(_add_swift_host_library_single target)
622
621
endif ()
623
622
endif ()
624
623
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
-
680
624
add_dependencies (dev ${name} )
681
625
if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY )
682
626
swift_install_in_component (TARGETS ${name}
0 commit comments