-
Notifications
You must be signed in to change notification settings - Fork 4.8k
/
CMakeLists.txt
115 lines (94 loc) · 3.93 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
project(System.Globalization.Native C)
if(CLR_CMAKE_TARGET_UNIX)
add_compile_options(-Wno-switch-enum)
add_compile_options(-Wno-covered-switch-default)
# Workaround for warnings produced by ICU headers
add_compile_options(-Wno-reserved-id-macro)
add_compile_options(-Wno-documentation)
add_compile_options(-Wno-documentation-unknown-command)
# Workaround for https://unicode-org.atlassian.net/browse/ICU-20601
add_compile_options(-Wno-extra-semi-stmt)
add_compile_options(-Wno-unknown-warning-option)
if (NOT CLR_CMAKE_TARGET_ANDROID)
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 "Cannot find utypes.h, try installing libicu-dev (or the appropriate package for your platform)")
return()
endif()
if(CLR_CMAKE_TARGET_OSX)
add_definitions(-DOSX_ICU_LIBRARY_PATH="/usr/lib/libicucore.dylib")
add_definitions(-DU_DISABLE_RENAMING)
else()
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 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()
endif()
include_directories(${UTYPES_H})
endif()
endif()
if ((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 10.0))
add_compile_options(-Wno-error=stringop-truncation)
endif()
include(configure.cmake)
set(NATIVEGLOBALIZATION_SOURCES
pal_calendarData.c
pal_casing.c
pal_collation.c
pal_idna.c
pal_locale.c
pal_localeNumberData.c
pal_localeStringData.c
pal_normalization.c
pal_timeZoneInfo.c
pal_icushim.c
entrypoints.c
)
if (MSVC)
set_source_files_properties(${NATIVEGLOBALIZATION_SOURCES} PROPERTIES LANGUAGE CXX)
endif()
include_directories("../Common")
if (GEN_SHARED_LIB)
add_library(System.Globalization.Native
SHARED
${NATIVEGLOBALIZATION_SOURCES}
${VERSION_FILE_PATH}
)
target_link_libraries(System.Globalization.Native
dl
)
install_with_stripped_symbols (System.Globalization.Native PROGRAMS .)
endif()
add_library(System.Globalization.Native-Static
STATIC
${NATIVEGLOBALIZATION_SOURCES}
)
set_target_properties(System.Globalization.Native-Static PROPERTIES OUTPUT_NAME System.Globalization.Native CLEAN_DIRECT_OUTPUT 1)
if (GEN_SHARED_LIB)
# this builds with libs to check for libs-level warnings
install (TARGETS System.Globalization.Native-Static DESTINATION .)
else()
# this one builds with coreclr and used by singlefilehost.
# it needs to build with coreclr in order to be linkable with it on Windows
# coreclr and static libraries must match because linker does not permit mixing modules
# with different C runtimes (i.e. Debug vs. Release)
install (TARGETS System.Globalization.Native-Static DESTINATION lib)
endif()
if(NOT CLR_CMAKE_TARGET_OSX AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS AND NOT CLR_CMAKE_TARGET_ANDROID)
if (GEN_SHARED_LIB)
add_custom_command(TARGET System.Globalization.Native POST_BUILD
COMMENT "Verifying System.Globalization.Native.so dependencies"
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/../verify-so.sh
$<TARGET_FILE:System.Globalization.Native>
"Verification failed. System.Globalization.Native.so has undefined dependencies. These are likely ICU APIs that need to be added to icushim.h."
VERBATIM
)
endif()
endif()