fix icu4c compile

This commit is contained in:
qianlong 2020-09-16 10:23:36 +08:00
parent 3fe8916afa
commit 4c49d557d2
3 changed files with 22 additions and 10 deletions

View File

@ -4,16 +4,25 @@ set(LIB_ICU_I18N icui18n)
if (CMAKE_SYSTEM_NAME MATCHES "Windows")
message("icu4c thirdparty do not support windows currently.")
else()
set(JSON_FILE "{ \n\
\"strategy\": \"additive\",\n\
\"featureFilters\": {\n\
\"normalization\": \"include\"\n\
}\n\
}\
")
file(WRITE ${CMAKE_BINARY_DIR}/icu4c_filter.json ${JSON_FILE})
mindspore_add_pkg(icu4c
VER 67.1
LIBS ${LIB_ICU_COMMON} ${LIB_ICU_DATA} ${LIB_ICU_I18N}
URL https://github.com/unicode-org/icu/archive/release-67-1.tar.gz
MD5 0c2662a2b0bc80b0eb56495205247c8f
CONFIGURE_COMMAND ${CMAKE_SOURCE_DIR}/scripts/build_icu4c.sh
PATCHES ${CMAKE_SOURCE_DIR}/third_party/patch/icu4c/icu4c.patch01
CONFIGURE_COMMAND ./icu4c/source/runConfigureICU Linux --enable-rpath --disable-tests --disable-samples --disable-icuio --disable-extras ICU_DATA_FILTER_FILE=${CMAKE_BINARY_DIR}/icu4c_filter.json
)
include_directories(${icu4c_INC})
add_library(mindspore::icuuc ALIAS icu4c::${LIB_ICU_COMMON})
add_library(mindspore::icudata ALIAS icu4c::${LIB_ICU_DATA})
add_library(mindspore::icui18n ALIAS icu4c::${LIB_ICU_I18N})
add_definitions(-D ENABLE_ICU4C)
endif()
endif()

View File

@ -1,8 +0,0 @@
#!/bin/bash
echo '{
"strategy": "additive",
"featureFilters": {
"normalization": "include"
}
}' > filter.json
CFLAGS="-fstack-protector -Wl,-z,now -D_FORTIFY_SOURCE=2 -O2" ./icu4c/source/runConfigureICU Linux --enable-rpath --disable-tests --disable-samples --disable-icuio --disable-extras ICU_DATA_FILTER_FILE=filter.json "$@"

11
third_party/patch/icu4c/icu4c.patch01 vendored Normal file
View File

@ -0,0 +1,11 @@
--- ./icu4c/source/runConfigureICU 2020-09-16 10:29:53.446938469 +0800
+++ ./icu4c/source/runConfigureICU_cflags 2020-04-23 01:49:10.000000000 +0800
@@ -247,7 +247,7 @@ case $platform in
Linux*)
THE_OS="Linux"
THE_COMP="the clang or else GNU C++"
- RELEASE_CFLAGS='-O3'
+ RELEASE_CFLAGS='-fstack-protector -Wl,-z,now -D_FORTIFY_SOURCE=2 -O3'
RELEASE_CXXFLAGS='-O3'
DEBUG_CFLAGS='-g'
DEBUG_CXXFLAGS='-g'