From f17e90cb25573fbc7894725ccd008a2fb116236f Mon Sep 17 00:00:00 2001 From: Matt Ellis Date: Wed, 21 Oct 2015 13:48:37 -0700 Subject: Link against libicucore on OSX OSX ships with a copy of ICU (their globalization APIs are built on top of it). Since we only use stable c based APIs, we can link against it using the methods described in using a System ICU in the ICU User's Guide (basically we disable function renaming, don't use C++ and only use stable APIs). The ICU headers are not part of the SDK, so we continue to need ICU installed via Homebrew as a build time dependency. Fixes dotnet/corefx#3849 --- .../System.Globalization.Native/CMakeLists.txt | 45 +++++++++++++++------- 1 file changed, 31 insertions(+), 14 deletions(-) (limited to 'src/corefx') diff --git a/src/corefx/System.Globalization.Native/CMakeLists.txt b/src/corefx/System.Globalization.Native/CMakeLists.txt index 04f29fced7..a4e232d4b9 100644 --- a/src/corefx/System.Globalization.Native/CMakeLists.txt +++ b/src/corefx/System.Globalization.Native/CMakeLists.txt @@ -9,16 +9,25 @@ add_definitions(-DBIT64=1) set(ICU_HOMEBREW_LIB_PATH "/usr/local/opt/icu4c/lib") set(ICU_HOMEBREW_INC_PATH "/usr/local/opt/icu4c/include") -find_library(ICUUC NAMES icuuc PATHS ${ICU_HOMEBREW_LIB_PATH}) -if(ICUUC STREQUAL ICUUC-NOTFOUND) - message(FATAL_ERROR "Cannot find libicuuc, try installing libicu-dev (or the appropriate package for your platform)") - return() -endif() - -find_library(ICUI18N NAMES icui18n PATHS ${ICU_HOMEBREW_LIB_PATH}) -if(ICUI18N STREQUAL ICUI18N-NOTFOUND) - message(FATAL_ERROR "Cannot find libicui18n, try installing libicu-dev (or the appropriate package for your platform)") - return() +if(NOT CLR_CMAKE_PLATFORM_DARWIN) + find_library(ICUUC NAMES icuuc PATHS ${ICU_HOMEBREW_LIB_PATH}) + if(ICUUC STREQUAL ICUUC-NOTFOUND) + message(FATAL_ERROR "Cannot find libicuuc, try installing libicu-dev (or the appropriate package for your platform)") + return() + endif() + + find_library(ICUI18N NAMES icui18n PATHS ${ICU_HOMEBREW_LIB_PATH}) + if(ICUI18N STREQUAL ICUI18N-NOTFOUND) + message(FATAL_ERROR "Cannot find libicui18n, try installing libicu-dev (or the appropriate package for your platform)") + return() + endif() + +else() + find_library(ICUCORE NAMES icucore) + if(ICUI18N STREQUAL ICUCORE-NOTFOUND) + message(FATAL_ERROR "Cannot find libicucore, skipping build for System.Globalization.Native. .NET globalization is not expected to function.") + return() + endif() endif() find_path(UTYPES_H "unicode/utypes.h" PATHS ${ICU_HOMEBREW_INC_PATH}) @@ -61,9 +70,17 @@ add_library(System.Globalization.Native # Disable the "lib" prefix. set_target_properties(System.Globalization.Native PROPERTIES PREFIX "") -target_link_libraries(System.Globalization.Native - ${ICUUC} - ${ICUI18N} -) +if(NOT CLR_CMAKE_PLATFORM_DARWIN) + target_link_libraries(System.Globalization.Native + ${ICUUC} + ${ICUI18N} + ) +else() + target_link_libraries(System.Globalization.Native + ${ICUCORE} + ) + + add_definitions(-DU_DISABLE_RENAMING=1) +endif() install (TARGETS System.Globalization.Native DESTINATION .) -- cgit v1.2.3