Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,13 @@ message(STATUS "Building Swift runtime with:")
message(STATUS " Leak Detection Checker Entrypoints: ${SWIFT_RUNTIME_ENABLE_LEAK_CHECKER}")
message(STATUS "")

#
# Find required dependencies.
#
if(NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND "${SWIFT_PATH_TO_LIBICU_BUILD}" STREQUAL "")
find_package(ICU REQUIRED COMPONENTS uc i18n)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically, this won't work with a Darwin + cross compile scenario.

endif()

#
# Find optional dependencies.
#
Expand Down
10 changes: 8 additions & 2 deletions cmake/modules/FindICU.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,20 @@ foreach(MODULE ${ICU_FIND_COMPONENTS})
ICU_${MODULE}_INCLUDE_DIR ICU_${MODULE}_LIBRARIES)

pkg_check_modules(PC_ICU_${MODULE} QUIET icu-${module})
if(${PC_ICU_${MODULE}_FOUND})
if(NOT ${PKGCONFIG_FOUND})
# PkgConfig doesn't exist on this system, so we manually provide hints via CMake.
set(PC_ICU_${MODULE}_INCLUDE_DIRS "${ICU_${MODULE}_INCLUDE_DIRS}")
set(PC_ICU_${MODULE}_LIBRARY_DIRS "${ICU_${MODULE}_LIBRARY_DIRS}")
endif()

if((${PC_ICU_${MODULE}_FOUND}) OR (NOT ${PKGCONFIG_FOUND}))
set(ICU_${MODULE}_DEFINITIONS ${PC_ICU_${MODULE}_CFLAGS_OTHER})

find_path(ICU_${MODULE}_INCLUDE_DIR unicode
HINTS ${PC_ICU_${MODULE}_INCLUDEDIR} ${PC_ICU_${MODULE}_INCLUDE_DIRS})
set(ICU_${MODULE}_INCLUDE_DIRS ${ICU_${MODULE}_INCLUDE_DIR})

find_library(ICU_${MODULE}_LIBRARY NAMES icu${module}
find_library(ICU_${MODULE}_LIBRARY NAMES icu${module} ${ICU_${MODULE}_LIB_NAME}
HINTS ${PC_ICU_${MODULE}_LIBDIR} ${PC_ICU_${MODULE}_LIBRARY_DIRS})
set(ICU_${MODULE}_LIBRARIES ${ICU_${MODULE}_LIBRARY})
endif()
Expand Down
1 change: 0 additions & 1 deletion stdlib/public/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ else()
#set(LINK_FLAGS
# -Wl,--whole-archive swiftRuntime -Wl,--no-whole-archive)
if("${SWIFT_PATH_TO_LIBICU_BUILD}" STREQUAL "")
find_package(ICU REQUIRED COMPONENTS uc i18n)
list(APPEND swift_core_private_link_libraries
ICU_UC ICU_I18N)
else()
Expand Down