diff options
author | Matt Ellis <matell@microsoft.com> | 2015-10-23 14:24:13 -0700 |
---|---|---|
committer | Matt Ellis <matell@microsoft.com> | 2015-10-23 15:43:21 -0700 |
commit | 392f5f43475843a8dc417ef84b88e855e91f909e (patch) | |
tree | 434e665b8e8388a6e1f558dd5bf45b6257de4327 /src/corefx | |
parent | 398dc12ed5b19cdb116e06c84762ad64ffb88612 (diff) | |
download | coreclr-392f5f43475843a8dc417ef84b88e855e91f909e.tar.gz coreclr-392f5f43475843a8dc417ef84b88e855e91f909e.tar.bz2 coreclr-392f5f43475843a8dc417ef84b88e855e91f909e.zip |
Cleanup CMakeLists.txt
There were a few problems that needed to be addressed:
- Our detection logic around testing if ICU supported a feature was
still checking for C++ stuff instead of the coresponding C
code (which we ended up using).
- There was some cleanup we could do now that the OSX and other Unix
builds were split apart
Diffstat (limited to 'src/corefx')
-rw-r--r-- | src/corefx/System.Globalization.Native/CMakeLists.txt | 42 | ||||
-rw-r--r-- | src/corefx/System.Globalization.Native/calendarData.cpp | 5 |
2 files changed, 27 insertions, 20 deletions
diff --git a/src/corefx/System.Globalization.Native/CMakeLists.txt b/src/corefx/System.Globalization.Native/CMakeLists.txt index a4e232d4b9..08d35a0053 100644 --- a/src/corefx/System.Globalization.Native/CMakeLists.txt +++ b/src/corefx/System.Globalization.Native/CMakeLists.txt @@ -6,45 +6,49 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) add_definitions(-DPIC=1) 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_path(UTYPES_H "unicode/utypes.h" PATHS ${ICU_HOMEBREW_INC_PATH}) +if(UTYPES_H STREQUAL UTYPES_H-NOTFOUND) + message(FATAL_ERROR "Cannont find utypes.h, try installing libicu-dev (or the appropriate package for your platform)") + return() +endif() + if(NOT CLR_CMAKE_PLATFORM_DARWIN) - find_library(ICUUC NAMES icuuc PATHS ${ICU_HOMEBREW_LIB_PATH}) + find_library(ICUUC icuuc) 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}) + find_library(ICUI18N icui18n) if(ICUI18N STREQUAL ICUI18N-NOTFOUND) message(FATAL_ERROR "Cannot find libicui18n, try installing libicu-dev (or the appropriate package for your platform)") return() endif() + set(CMAKE_REQUIRED_INCLUDES ${ICU_HOMEBREW_INC_PATH}) + CHECK_CXX_SOURCE_COMPILES(" + #include <unicode/udat.h> + int main() { UDateFormatSymbolType e = UDAT_STANDALONE_SHORTER_WEEKDAYS; } + " HAVE_UDAT_STANDALONE_SHORTER_WEEKDAYS) + + if(HAVE_UDAT_STANDALONE_SHORTER_WEEKDAYS) + add_definitions(-DHAVE_UDAT_STANDALONE_SHORTER_WEEKDAYS=1) + endif(HAVE_UDAT_STANDALONE_SHORTER_WEEKDAYS) + else() - find_library(ICUCORE NAMES icucore) + + find_library(ICUCORE 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}) -if(UTYPES_H STREQUAL UTYPES_H-NOTFOUND) - message(FATAL_ERROR "Cannont find utypes.h, try installing libicu-dev (or the appropriate package for your platform)") - return() -endif() -set(CMAKE_REQUIRED_INCLUDES ${ICU_HOMEBREW_INC_PATH}) -CHECK_CXX_SOURCE_COMPILES(" - #include <unicode/dtfmtsym.h> - int main() { DateFormatSymbols::DtWidthType e = DateFormatSymbols::DtWidthType::SHORT; } -" HAVE_DTWIDTHTYPE_SHORT) + # libicucore supports UDAT_STANDALONE_SHORTER_WEEKDAYS + add_definitions(-DHAVE_UDAT_STANDALONE_SHORTER_WEEKDAYS=1) -if(HAVE_DTWIDTHTYPE_SHORT) - add_definitions(-DHAVE_DTWIDTHTYPE_SHORT=1) -endif(HAVE_DTWIDTHTYPE_SHORT) +endif() add_compile_options(-fPIC) diff --git a/src/corefx/System.Globalization.Native/calendarData.cpp b/src/corefx/System.Globalization.Native/calendarData.cpp index aba9e7c8fb..c18bc9de8e 100644 --- a/src/corefx/System.Globalization.Native/calendarData.cpp +++ b/src/corefx/System.Globalization.Native/calendarData.cpp @@ -576,7 +576,10 @@ extern "C" int32_t EnumCalendarInfo(EnumCalendarInfoCallback callback, case AbbrevMonthNames: return EnumSymbols(locale, calendarId, UDAT_STANDALONE_SHORT_MONTHS, 0, callback, context); case SuperShortDayNames: -#ifdef HAVE_DTWIDTHTYPE_SHORT + // UDAT_STANDALONE_SHORTER_WEEKDAYS was added in ICU 51, and CentOS 7 currently uses ICU 50. + // fallback to UDAT_STANDALONE_NARROW_WEEKDAYS in that case. + +#ifdef HAVE_UDAT_STANDALONE_SHORTER_WEEKDAYS return EnumSymbols(locale, calendarId, UDAT_STANDALONE_SHORTER_WEEKDAYS, 1, callback, context); #else return EnumSymbols(locale, calendarId, UDAT_STANDALONE_NARROW_WEEKDAYS, 1, callback, context); |