Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 03b80b1

Browse files
committed
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
1 parent 2940b5d commit 03b80b1

File tree

2 files changed

+27
-20
lines changed

2 files changed

+27
-20
lines changed

src/corefx/System.Globalization.Native/CMakeLists.txt

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,45 +6,49 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
66
add_definitions(-DPIC=1)
77
add_definitions(-DBIT64=1)
88

9-
set(ICU_HOMEBREW_LIB_PATH "/usr/local/opt/icu4c/lib")
109
set(ICU_HOMEBREW_INC_PATH "/usr/local/opt/icu4c/include")
1110

11+
find_path(UTYPES_H "unicode/utypes.h" PATHS ${ICU_HOMEBREW_INC_PATH})
12+
if(UTYPES_H STREQUAL UTYPES_H-NOTFOUND)
13+
message(FATAL_ERROR "Cannont find utypes.h, try installing libicu-dev (or the appropriate package for your platform)")
14+
return()
15+
endif()
16+
1217
if(NOT CLR_CMAKE_PLATFORM_DARWIN)
13-
find_library(ICUUC NAMES icuuc PATHS ${ICU_HOMEBREW_LIB_PATH})
18+
find_library(ICUUC icuuc)
1419
if(ICUUC STREQUAL ICUUC-NOTFOUND)
1520
message(FATAL_ERROR "Cannot find libicuuc, try installing libicu-dev (or the appropriate package for your platform)")
1621
return()
1722
endif()
1823

19-
find_library(ICUI18N NAMES icui18n PATHS ${ICU_HOMEBREW_LIB_PATH})
24+
find_library(ICUI18N icui18n)
2025
if(ICUI18N STREQUAL ICUI18N-NOTFOUND)
2126
message(FATAL_ERROR "Cannot find libicui18n, try installing libicu-dev (or the appropriate package for your platform)")
2227
return()
2328
endif()
2429

30+
set(CMAKE_REQUIRED_INCLUDES ${ICU_HOMEBREW_INC_PATH})
31+
CHECK_CXX_SOURCE_COMPILES("
32+
#include <unicode/udat.h>
33+
int main() { UDateFormatSymbolType e = UDAT_STANDALONE_SHORTER_WEEKDAYS; }
34+
" HAVE_UDAT_STANDALONE_SHORTER_WEEKDAYS)
35+
36+
if(HAVE_UDAT_STANDALONE_SHORTER_WEEKDAYS)
37+
add_definitions(-DHAVE_UDAT_STANDALONE_SHORTER_WEEKDAYS=1)
38+
endif(HAVE_UDAT_STANDALONE_SHORTER_WEEKDAYS)
39+
2540
else()
26-
find_library(ICUCORE NAMES icucore)
41+
42+
find_library(ICUCORE icucore)
2743
if(ICUI18N STREQUAL ICUCORE-NOTFOUND)
2844
message(FATAL_ERROR "Cannot find libicucore, skipping build for System.Globalization.Native. .NET globalization is not expected to function.")
2945
return()
3046
endif()
31-
endif()
32-
33-
find_path(UTYPES_H "unicode/utypes.h" PATHS ${ICU_HOMEBREW_INC_PATH})
34-
if(UTYPES_H STREQUAL UTYPES_H-NOTFOUND)
35-
message(FATAL_ERROR "Cannont find utypes.h, try installing libicu-dev (or the appropriate package for your platform)")
36-
return()
37-
endif()
3847

39-
set(CMAKE_REQUIRED_INCLUDES ${ICU_HOMEBREW_INC_PATH})
40-
CHECK_CXX_SOURCE_COMPILES("
41-
#include <unicode/dtfmtsym.h>
42-
int main() { DateFormatSymbols::DtWidthType e = DateFormatSymbols::DtWidthType::SHORT; }
43-
" HAVE_DTWIDTHTYPE_SHORT)
48+
# libicucore supports UDAT_STANDALONE_SHORTER_WEEKDAYS
49+
add_definitions(-DHAVE_UDAT_STANDALONE_SHORTER_WEEKDAYS=1)
4450

45-
if(HAVE_DTWIDTHTYPE_SHORT)
46-
add_definitions(-DHAVE_DTWIDTHTYPE_SHORT=1)
47-
endif(HAVE_DTWIDTHTYPE_SHORT)
51+
endif()
4852

4953
add_compile_options(-fPIC)
5054

src/corefx/System.Globalization.Native/calendarData.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,10 @@ extern "C" int32_t EnumCalendarInfo(EnumCalendarInfoCallback callback,
576576
case AbbrevMonthNames:
577577
return EnumSymbols(locale, calendarId, UDAT_STANDALONE_SHORT_MONTHS, 0, callback, context);
578578
case SuperShortDayNames:
579-
#ifdef HAVE_DTWIDTHTYPE_SHORT
579+
// UDAT_STANDALONE_SHORTER_WEEKDAYS was added in ICU 51, and CentOS 7 currently uses ICU 50.
580+
// fallback to UDAT_STANDALONE_NARROW_WEEKDAYS in that case.
581+
582+
#ifdef HAVE_UDAT_STANDALONE_SHORTER_WEEKDAYS
580583
return EnumSymbols(locale, calendarId, UDAT_STANDALONE_SHORTER_WEEKDAYS, 1, callback, context);
581584
#else
582585
return EnumSymbols(locale, calendarId, UDAT_STANDALONE_NARROW_WEEKDAYS, 1, callback, context);

0 commit comments

Comments
 (0)