Skip to content

Commit 75b4be6

Browse files
authored
Merge pull request #6461 from hughbe/icu-windows
Simplify ICU package resolution not to require PkgConfig and to be more user configurable.
2 parents 7561d5c + c66b72c commit 75b4be6

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -809,6 +809,13 @@ message(STATUS "Building Swift runtime with:")
809809
message(STATUS " Leak Detection Checker Entrypoints: ${SWIFT_RUNTIME_ENABLE_LEAK_CHECKER}")
810810
message(STATUS "")
811811

812+
#
813+
# Find required dependencies.
814+
#
815+
if(NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND "${SWIFT_PATH_TO_LIBICU_BUILD}" STREQUAL "")
816+
find_package(ICU REQUIRED COMPONENTS uc i18n)
817+
endif()
818+
812819
#
813820
# Find optional dependencies.
814821
#

cmake/modules/FindICU.cmake

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,20 @@ foreach(MODULE ${ICU_FIND_COMPONENTS})
1212
ICU_${MODULE}_INCLUDE_DIR ICU_${MODULE}_LIBRARIES)
1313

1414
pkg_check_modules(PC_ICU_${MODULE} QUIET icu-${module})
15-
if(${PC_ICU_${MODULE}_FOUND})
15+
if(NOT ${PKGCONFIG_FOUND})
16+
# PkgConfig doesn't exist on this system, so we manually provide hints via CMake.
17+
set(PC_ICU_${MODULE}_INCLUDE_DIRS "${ICU_${MODULE}_INCLUDE_DIRS}")
18+
set(PC_ICU_${MODULE}_LIBRARY_DIRS "${ICU_${MODULE}_LIBRARY_DIRS}")
19+
endif()
20+
21+
if((${PC_ICU_${MODULE}_FOUND}) OR (NOT ${PKGCONFIG_FOUND}))
1622
set(ICU_${MODULE}_DEFINITIONS ${PC_ICU_${MODULE}_CFLAGS_OTHER})
1723

1824
find_path(ICU_${MODULE}_INCLUDE_DIR unicode
1925
HINTS ${PC_ICU_${MODULE}_INCLUDEDIR} ${PC_ICU_${MODULE}_INCLUDE_DIRS})
2026
set(ICU_${MODULE}_INCLUDE_DIRS ${ICU_${MODULE}_INCLUDE_DIR})
2127

22-
find_library(ICU_${MODULE}_LIBRARY NAMES icu${module}
28+
find_library(ICU_${MODULE}_LIBRARY NAMES icu${module} ${ICU_${MODULE}_LIB_NAME}
2329
HINTS ${PC_ICU_${MODULE}_LIBDIR} ${PC_ICU_${MODULE}_LIBRARY_DIRS})
2430
set(ICU_${MODULE}_LIBRARIES ${ICU_${MODULE}_LIBRARY})
2531
endif()

stdlib/public/core/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,6 @@ else()
178178
#set(LINK_FLAGS
179179
# -Wl,--whole-archive swiftRuntime -Wl,--no-whole-archive)
180180
if("${SWIFT_PATH_TO_LIBICU_BUILD}" STREQUAL "")
181-
find_package(ICU REQUIRED COMPONENTS uc i18n)
182181
list(APPEND swift_core_private_link_libraries
183182
ICU_UC ICU_I18N)
184183
else()

0 commit comments

Comments
 (0)