@@ -40,12 +40,18 @@ endfunction()
40
40
41
41
42
42
function (_add_variant_c_compile_link_flags
43
- sdk arch build_type enable_assertions result_var_name )
44
- set (result ${${result_var_name}} )
43
+ sdk arch build_type enable_assertions use_internal_sdk result_var_name )
44
+ set (result
45
+ ${${result_var_name}}
46
+ "-target" "${SWIFT_SDK_${sdk} _ARCH_${arch} _TRIPLE}" )
45
47
46
- list (APPEND result
47
- "-isysroot" "${SWIFT_SDK_${sdk} _PATH}"
48
- "-target" "${SWIFT_SDK_${sdk} _ARCH_${arch} _TRIPLE}" )
48
+ if (use_internal_sdk )
49
+ list (APPEND result
50
+ "-isysroot" "${SWIFT_SDK_${sdk} _INTERNAL_PATH}" )
51
+ else ()
52
+ list (APPEND result
53
+ "-isysroot" "${SWIFT_SDK_${sdk} _PATH}" )
54
+ endif ()
49
55
50
56
if ("${CMAKE_SYSTEM_NAME} " STREQUAL "Darwin" )
51
57
list (APPEND result
@@ -59,14 +65,15 @@ function(_add_variant_c_compile_link_flags
59
65
endfunction ()
60
66
61
67
function (_add_variant_c_compile_flags
62
- sdk arch build_type enable_assertions result_var_name )
68
+ sdk arch build_type enable_assertions use_internal_sdk result_var_name )
63
69
set (result ${${result_var_name}} )
64
70
65
71
_add_variant_c_compile_link_flags (
66
72
"${sdk} "
67
73
"${arch} "
68
74
"${build_type} "
69
75
"${enable_assertions} "
76
+ ${use_internal_sdk}
70
77
result )
71
78
72
79
is_build_type_optimized ("${build_type} " optimized )
@@ -135,7 +142,7 @@ function(_add_variant_swift_compile_flags
135
142
endfunction ()
136
143
137
144
function (_add_variant_link_flags
138
- sdk arch build_type enable_assertions result_var_name )
145
+ sdk arch build_type enable_assertions use_internal_sdk result_var_name )
139
146
140
147
if ("${sdk} " STREQUAL "" )
141
148
message (FATAL_ERROR "Should specify an SDK" )
@@ -152,6 +159,7 @@ function(_add_variant_link_flags
152
159
"${arch} "
153
160
"${build_type} "
154
161
"${enable_assertions} "
162
+ ${use_internal_sdk}
155
163
result )
156
164
157
165
if ("${sdk} " STREQUAL "LINUX" )
@@ -626,6 +634,7 @@ endfunction()
626
634
# _add_swift_library_single(
627
635
# target
628
636
# name
637
+ # [USE_INTERNAL_SDK]
629
638
# [SHARED]
630
639
# [SDK sdk]
631
640
# [ARCHITECTURE architecture]
@@ -706,12 +715,15 @@ endfunction()
706
715
# INSTALL_IN_COMPONENT comp
707
716
# The Swift installation component that this library belongs to.
708
717
#
718
+ # USE_INTERNAL_SDK
719
+ # Use the 'internal' sdk variant.
720
+ #
709
721
# source1 ...
710
722
# Sources to add into this library
711
723
function (_add_swift_library_single target name )
712
724
set (SWIFTLIB_SINGLE_options
713
725
SHARED IS_STDLIB IS_STDLIB_CORE IS_SDK_OVERLAY
714
- API_NOTES_NON_OVERLAY DONT_EMBED_BITCODE )
726
+ API_NOTES_NON_OVERLAY DONT_EMBED_BITCODE USE_INTERNAL_SDK )
715
727
cmake_parse_arguments (SWIFTLIB_SINGLE
716
728
"${SWIFTLIB_SINGLE_options} "
717
729
"SDK;ARCHITECTURE;INSTALL_IN_COMPONENT"
@@ -963,9 +975,17 @@ function(_add_swift_library_single target name)
963
975
target_link_libraries ("${target} " INTERFACE ${SWIFTLIB_SINGLE_LINK_LIBRARIES} )
964
976
endif ()
965
977
978
+ # Don't add the icucore target.
979
+ set (SWIFTLIB_SINGLE_LINK_LIBRARIES_WITHOUT_ICU )
980
+ foreach (item ${SWIFTLIB_SINGLE_LINK_LIBRARIES} )
981
+ if (NOT "${item} " STREQUAL "icucore" )
982
+ list (APPEND SWIFTLIB_SINGLE_LINK_LIBRARIES_WITHOUT_ICU "{$item}" )
983
+ endif ()
984
+ endforeach ()
985
+
966
986
if (target_static )
967
987
_list_add_string_suffix (
968
- "${SWIFTLIB_SINGLE_LINK_LIBRARIES } "
988
+ "${SWIFTLIB_SINGLE_LINK_LIBRARIES_WITHOUT_ICU } "
969
989
"-static"
970
990
target_static_depends )
971
991
# FIXME: should this be target_link_libraries?
@@ -1006,12 +1026,14 @@ function(_add_swift_library_single target name)
1006
1026
"${SWIFTLIB_SINGLE_ARCHITECTURE} "
1007
1027
"${build_type} "
1008
1028
"${enable_assertions} "
1029
+ ${SWIFTLIB_SINGLE_USE_INTERNAL_SDK}
1009
1030
c_compile_flags )
1010
1031
_add_variant_link_flags (
1011
1032
"${SWIFTLIB_SINGLE_SDK} "
1012
1033
"${SWIFTLIB_SINGLE_ARCHITECTURE} "
1013
1034
"${build_type} "
1014
1035
"${enable_assertions} "
1036
+ ${SWIFTLIB_SINGLE_USE_INTERNAL_SDK}
1015
1037
link_flags )
1016
1038
1017
1039
# Configure plist creation for OS X.
@@ -1187,12 +1209,15 @@ endfunction()
1187
1209
# INSTALL_IN_COMPONENT comp
1188
1210
# The Swift installation component that this library belongs to.
1189
1211
#
1212
+ # USE_INTERNAL_SDK
1213
+ # Use the 'internal' sdk variant.
1214
+ #
1190
1215
# source1 ...
1191
1216
# Sources to add into this library.
1192
1217
function (add_swift_library name )
1193
1218
set (SWIFTLIB_options
1194
1219
SHARED IS_STDLIB IS_STDLIB_CORE IS_SDK_OVERLAY TARGET_LIBRARY
1195
- API_NOTES_NON_OVERLAY DONT_EMBED_BITCODE )
1220
+ API_NOTES_NON_OVERLAY DONT_EMBED_BITCODE USE_INTERNAL_SDK )
1196
1221
cmake_parse_arguments (SWIFTLIB
1197
1222
"${SWIFTLIB_options} "
1198
1223
"INSTALL_IN_COMPONENT"
@@ -1328,6 +1353,7 @@ function(add_swift_library name)
1328
1353
_add_swift_library_single (
1329
1354
${VARIANT_NAME}
1330
1355
${name}
1356
+ ${SWIFTLIB_USE_INTERNAL_SDK_keyword}
1331
1357
${SWIFTLIB_SHARED_keyword}
1332
1358
${SWIFTLIB_SOURCES}
1333
1359
SDK ${sdk}
@@ -1351,15 +1377,19 @@ function(add_swift_library name)
1351
1377
1352
1378
# Add dependencies on the (not-yet-created) custom lipo target.
1353
1379
foreach (DEP ${SWIFTLIB_LINK_LIBRARIES} )
1354
- add_dependencies (${VARIANT_NAME}
1380
+ if (NOT "${DEP} " STREQUAL "icucore" )
1381
+ add_dependencies (${VARIANT_NAME}
1355
1382
"${DEP} -${SWIFT_SDK_${sdk} _LIB_SUBDIR}" )
1383
+ endif ()
1356
1384
endforeach ()
1357
1385
1358
1386
if (SWIFT_BUILD_STATIC_STDLIB AND SWIFTLIB_IS_STDLIB )
1359
1387
# Add dependencies on the (not-yet-created) custom lipo target.
1360
1388
foreach (DEP ${SWIFTLIB_LINK_LIBRARIES} )
1361
- add_dependencies ("${VARIANT_NAME} -static"
1389
+ if (NOT "${DEP} " STREQUAL "icucore" )
1390
+ add_dependencies ("${VARIANT_NAME} -static"
1362
1391
"${DEP} -${SWIFT_SDK_${sdk} _LIB_SUBDIR}-static" )
1392
+ endif ()
1363
1393
endforeach ()
1364
1394
endif ()
1365
1395
@@ -1490,6 +1520,7 @@ function(add_swift_library name)
1490
1520
_add_swift_library_single (
1491
1521
${name}
1492
1522
${name}
1523
+ ${SWIFTLIB_USE_INTERNAL_SDK_keyword}
1493
1524
${SWIFTLIB_SHARED_keyword}
1494
1525
${SWIFTLIB_SOURCES}
1495
1526
SDK ${sdk}
@@ -1563,12 +1594,14 @@ function(_add_swift_executable_single name)
1563
1594
"${SWIFTEXE_SINGLE_ARCHITECTURE} "
1564
1595
"${CMAKE_BUILD_TYPE} "
1565
1596
"${LLVM_ENABLE_ASSERTIONS} "
1597
+ FALSE
1566
1598
c_compile_flags )
1567
1599
_add_variant_link_flags (
1568
1600
"${SWIFTEXE_SINGLE_SDK} "
1569
1601
"${SWIFTEXE_SINGLE_ARCHITECTURE} "
1570
1602
"${CMAKE_BUILD_TYPE} "
1571
1603
"${LLVM_ENABLE_ASSERTIONS} "
1604
+ FALSE
1572
1605
link_flags )
1573
1606
1574
1607
list (APPEND link_flags
@@ -1801,6 +1834,7 @@ function(add_swift_llvm_loadable_module name)
1801
1834
"${arch} "
1802
1835
"${CMAKE_BUILD_TYPE} "
1803
1836
"${LLVM_ENABLE_ASSERTIONS} "
1837
+ FALSE
1804
1838
c_compile_flags )
1805
1839
1806
1840
set (link_flags )
@@ -1809,6 +1843,7 @@ function(add_swift_llvm_loadable_module name)
1809
1843
"${arch} "
1810
1844
"${CMAKE_BUILD_TYPE} "
1811
1845
"${LLVM_ENABLE_ASSERTIONS} "
1846
+ FALSE
1812
1847
link_flags )
1813
1848
1814
1849
# Convert variables to space-separated strings.
0 commit comments