summaryrefslogtreecommitdiff
path: root/src/corefx
diff options
context:
space:
mode:
authorMatt Ellis <matell@microsoft.com>2015-10-21 13:48:37 -0700
committerMatt Ellis <matell@microsoft.com>2015-10-22 16:12:53 -0700
commitf17e90cb25573fbc7894725ccd008a2fb116236f (patch)
treed543eedc86f8c6deeecd2a252f61bfd66f0a8f6c /src/corefx
parent806dea821e3f02f7e3da9f0d9a9f6aaf4929cef8 (diff)
downloadcoreclr-f17e90cb25573fbc7894725ccd008a2fb116236f.tar.gz
coreclr-f17e90cb25573fbc7894725ccd008a2fb116236f.tar.bz2
coreclr-f17e90cb25573fbc7894725ccd008a2fb116236f.zip
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
Diffstat (limited to 'src/corefx')
-rw-r--r--src/corefx/System.Globalization.Native/CMakeLists.txt45
1 files changed, 31 insertions, 14 deletions
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 .)