Skip to content

Commit 999e421

Browse files
committed
build: allow static linking against ICU data
With the removal of the ICU data dependency in swiftCore, it is now possible to statically link to the ICU, with static linking to the ICU data as well. This would allow us to remove the ICU dependency from leaking into distributions which was previously required due to the oversized cost of the ICU data. With the single use now, it is possible to statically link the data to avoid the distribution and packaging. In order to provide a migration path, this needs to be optionalised, and as such, we only link the data if it is found (and can be controlled through `-D ICU_DATA_LIBRARY_RELEASE=`
1 parent aa44546 commit 999e421

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ if(HAS_LIBDISPATCH_API)
4747
find_package(dispatch CONFIG REQUIRED)
4848
endif()
4949

50-
find_package(ICU COMPONENTS uc i18n REQUIRED)
50+
find_package(ICU COMPONENTS uc i18n REQUIRED OPTIONAL_COMPONENTS data)
5151

5252
include(SwiftSupport)
5353
include(GNUInstallDirs)

CoreFoundation/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,10 @@ if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
397397
target_link_libraries(CoreFoundation PRIVATE
398398
ICU::uc
399399
ICU::i18n)
400+
if(ICU_DATA_FOUND)
401+
target_link_libraries(CoreFoundation PRIVATE
402+
ICU::data)
403+
endif()
400404
endif()
401405

402406
if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)

0 commit comments

Comments
 (0)