-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add System.Globalization.Native support for Windows
- Loading branch information
Showing
107 changed files
with
402 additions
and
291 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
99 changes: 99 additions & 0 deletions
99
src/libraries/Native/AnyOS/System.Globalization.Native/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
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) | ||
|
||
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_DARWIN) | ||
find_library(ICUCORE icucore) | ||
if(ICUCORE STREQUAL ICUCORE-NOTFOUND) | ||
message(FATAL_ERROR "Cannot find libicucore, skipping build for System.Globalization.Native. .NET globalization is not expected to function.") | ||
return() | ||
endif() | ||
add_definitions(-DOSX_ICU_LIBRARY_PATH=\"${ICUCORE}\") | ||
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() | ||
|
||
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 | ||
) | ||
|
||
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_library_and_symbols (System.Globalization.Native) | ||
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) | ||
|
||
install (TARGETS System.Globalization.Native-Static DESTINATION .) | ||
|
||
if(NOT CLR_CMAKE_TARGET_DARWIN) | ||
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() |
File renamed without changes.
34 changes: 34 additions & 0 deletions
34
src/libraries/Native/AnyOS/System.Globalization.Native/configure.cmake
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
include(CheckCSourceCompiles) | ||
include(CheckSymbolExists) | ||
|
||
if(CLR_CMAKE_TARGET_ANDROID) | ||
string(REPLACE ";" ":" ANDROID_RPATHS "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}:${CMAKE_SYSTEM_LIBRARY_PATH}") | ||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -rpath ${ANDROID_RPATHS}") | ||
endif() | ||
|
||
if (CLR_CMAKE_TARGET_UNIX) | ||
set(CMAKE_REQUIRED_INCLUDES ${UTYPES_H} ${ICU_HOMEBREW_INC_PATH}) | ||
|
||
CHECK_C_SOURCE_COMPILES(" | ||
#include <unicode/udat.h> | ||
int main(void) { enum UDateFormatSymbolType e = UDAT_STANDALONE_SHORTER_WEEKDAYS; } | ||
" HAVE_UDAT_STANDALONE_SHORTER_WEEKDAYS) | ||
|
||
if(CLR_CMAKE_TARGET_DARWIN) | ||
set(CMAKE_REQUIRED_LIBRARIES ${ICUCORE}) | ||
else() | ||
set(CMAKE_REQUIRED_LIBRARIES ${ICUUC} ${ICUI18N}) | ||
endif() | ||
|
||
check_symbol_exists( | ||
ucol_setMaxVariable | ||
"unicode/ucol.h" | ||
HAVE_SET_MAX_VARIABLE) | ||
|
||
unset(CMAKE_REQUIRED_LIBRARIES) | ||
unset(CMAKE_REQUIRED_INCLUDES) | ||
endif() | ||
|
||
configure_file( | ||
${CMAKE_CURRENT_SOURCE_DIR}/config.h.in | ||
${CMAKE_CURRENT_BINARY_DIR}/config.h) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.