@@ -6,36 +6,49 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
6
6
add_definitions (-DPIC=1 )
7
7
add_definitions (-DBIT64=1 )
8
8
9
- set (ICU_HOMEBREW_LIB_PATH "/usr/local/opt/icu4c/lib" )
10
9
set (ICU_HOMEBREW_INC_PATH "/usr/local/opt/icu4c/include" )
11
10
12
- find_library (ICUUC NAMES icuuc PATHS ${ICU_HOMEBREW_LIB_PATH} )
13
- if (ICUUC STREQUAL ICUUC-NOTFOUND )
14
- message (FATAL_ERROR "Cannot find libicuuc, try installing libicu-dev (or the appropriate package for your platform)" )
15
- return ()
16
- endif ()
17
-
18
- find_library (ICUI18N NAMES icui18n PATHS ${ICU_HOMEBREW_LIB_PATH} )
19
- if (ICUI18N STREQUAL ICUI18N-NOTFOUND )
20
- message (FATAL_ERROR "Cannot find libicui18n, try installing libicu-dev (or the appropriate package for your platform)" )
21
- return ()
22
- endif ()
23
-
24
11
find_path (UTYPES_H "unicode/utypes.h" PATHS ${ICU_HOMEBREW_INC_PATH} )
25
12
if (UTYPES_H STREQUAL UTYPES_H-NOTFOUND )
26
13
message (FATAL_ERROR "Cannont find utypes.h, try installing libicu-dev (or the appropriate package for your platform)" )
27
14
return ()
28
15
endif ()
29
16
30
- set (CMAKE_REQUIRED_INCLUDES ${ICU_HOMEBREW_INC_PATH} )
31
- CHECK_CXX_SOURCE_COMPILES ("
32
- #include <unicode/dtfmtsym.h>
33
- int main() { DateFormatSymbols::DtWidthType e = DateFormatSymbols::DtWidthType::SHORT; }
34
- " HAVE_DTWIDTHTYPE_SHORT )
17
+ if (NOT CLR_CMAKE_PLATFORM_DARWIN )
18
+ find_library (ICUUC icuuc )
19
+ if (ICUUC STREQUAL ICUUC-NOTFOUND )
20
+ message (FATAL_ERROR "Cannot find libicuuc, try installing libicu-dev (or the appropriate package for your platform)" )
21
+ return ()
22
+ endif ()
23
+
24
+ find_library (ICUI18N icui18n )
25
+ if (ICUI18N STREQUAL ICUI18N-NOTFOUND )
26
+ message (FATAL_ERROR "Cannot find libicui18n, try installing libicu-dev (or the appropriate package for your platform)" )
27
+ return ()
28
+ endif ()
29
+
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
35
36
- if (HAVE_DTWIDTHTYPE_SHORT )
37
- add_definitions (-DHAVE_DTWIDTHTYPE_SHORT=1 )
38
- endif (HAVE_DTWIDTHTYPE_SHORT )
36
+ if (HAVE_UDAT_STANDALONE_SHORTER_WEEKDAYS )
37
+ add_definitions (-DHAVE_UDAT_STANDALONE_SHORTER_WEEKDAYS=1 )
38
+ endif (HAVE_UDAT_STANDALONE_SHORTER_WEEKDAYS )
39
+
40
+ else ()
41
+
42
+ find_library (ICUCORE icucore )
43
+ if (ICUI18N STREQUAL ICUCORE-NOTFOUND )
44
+ message (FATAL_ERROR "Cannot find libicucore, skipping build for System.Globalization.Native. .NET globalization is not expected to function." )
45
+ return ()
46
+ endif ()
47
+
48
+ # libicucore supports UDAT_STANDALONE_SHORTER_WEEKDAYS
49
+ add_definitions (-DHAVE_UDAT_STANDALONE_SHORTER_WEEKDAYS=1 )
50
+
51
+ endif ()
39
52
40
53
add_compile_options (-fPIC )
41
54
@@ -61,9 +74,17 @@ add_library(System.Globalization.Native
61
74
# Disable the "lib" prefix.
62
75
set_target_properties (System .Globalization.Native PROPERTIES PREFIX "" )
63
76
64
- target_link_libraries (System .Globalization.Native
65
- ${ICUUC}
66
- ${ICUI18N}
67
- )
77
+ if (NOT CLR_CMAKE_PLATFORM_DARWIN )
78
+ target_link_libraries (System .Globalization.Native
79
+ ${ICUUC}
80
+ ${ICUI18N}
81
+ )
82
+ else ()
83
+ target_link_libraries (System .Globalization.Native
84
+ ${ICUCORE}
85
+ )
86
+
87
+ add_definitions (-DU_DISABLE_RENAMING=1 )
88
+ endif ()
68
89
69
90
install (TARGETS System .Globalization.Native DESTINATION . )
0 commit comments