diff --git a/Meta/CMake/unicode_data.cmake b/Meta/CMake/unicode_data.cmake index f963ff8b05c..9be8680a4a3 100644 --- a/Meta/CMake/unicode_data.cmake +++ b/Meta/CMake/unicode_data.cmake @@ -63,6 +63,16 @@ function(download_ucd_file url path) endif() endfunction() +function(extract_cldr_file source path) + if(EXISTS "${CLDR_ZIP_PATH}" AND NOT EXISTS "${path}") + message(STATUS "Extracting CLDR ${source} from ${CLDR_ZIP_PATH}...") + execute_process(COMMAND unzip -q "${CLDR_ZIP_PATH}" "${source}/**" -d "${LOCALE_DATA_CACHE_LOCATION}" RESULT_VARIABLE unzip_result) + if (NOT unzip_result EQUAL 0) + message(FATAL_ERROR "Failed to unzip ${source} from ${CLDR_ZIP_PATH} with status ${unzip_result}") + endif() + endif() +endfunction() + if (ENABLE_UNICODE_DATABASE_DOWNLOAD) download_ucd_file("${UNICODE_DATA_URL}" "${UNICODE_DATA_PATH}") download_ucd_file("${SPECIAL_CASING_URL}" "${SPECIAL_CASING_PATH}") @@ -77,39 +87,16 @@ if (ENABLE_UNICODE_DATABASE_DOWNLOAD) download_ucd_file("${EMOJI_DATA_URL}" "${EMOJI_DATA_PATH}") download_ucd_file("${NORM_PROPS_URL}" "${NORM_PROPS_PATH}") - if (NOT EXISTS ${CLDR_ZIP_PATH}) + if (NOT EXISTS "${CLDR_ZIP_PATH}") message(STATUS "Downloading CLDR database from ${CLDR_ZIP_URL}...") - file(DOWNLOAD ${CLDR_ZIP_URL} ${CLDR_ZIP_PATH} INACTIVITY_TIMEOUT 10) - endif() - if(EXISTS ${CLDR_ZIP_PATH} AND NOT EXISTS ${CLDR_CORE_PATH}) - message(STATUS "Extracting CLDR ${CLDR_CORE_SOURCE} from ${CLDR_ZIP_PATH}...") - execute_process(COMMAND unzip -q ${CLDR_ZIP_PATH} "${CLDR_CORE_SOURCE}/**" -d ${LOCALE_DATA_CACHE_LOCATION} RESULT_VARIABLE unzip_result) - if (NOT unzip_result EQUAL 0) - message(FATAL_ERROR "Failed to unzip ${CLDR_CORE_SOURCE} from ${CLDR_ZIP_PATH} with status ${unzip_result}") - endif() - endif() - if(EXISTS ${CLDR_ZIP_PATH} AND NOT EXISTS ${CLDR_LOCALES_PATH}) - message(STATUS "Extracting CLDR ${CLDR_LOCALES_SOURCE} from ${CLDR_ZIP_PATH}...") - execute_process(COMMAND unzip -q ${CLDR_ZIP_PATH} "${CLDR_LOCALES_SOURCE}/**" -d ${LOCALE_DATA_CACHE_LOCATION} RESULT_VARIABLE unzip_result) - if (NOT unzip_result EQUAL 0) - message(FATAL_ERROR "Failed to unzip ${CLDR_LOCALES_SOURCE} from ${CLDR_ZIP_PATH} with status ${unzip_result}") - endif() - endif() - if(EXISTS ${CLDR_ZIP_PATH} AND NOT EXISTS ${CLDR_MISC_PATH}) - message(STATUS "Extracting CLDR ${CLDR_MISC_SOURCE} from ${CLDR_ZIP_PATH}...") - execute_process(COMMAND unzip -q ${CLDR_ZIP_PATH} "${CLDR_MISC_SOURCE}/**" -d ${LOCALE_DATA_CACHE_LOCATION} RESULT_VARIABLE unzip_result) - if (NOT unzip_result EQUAL 0) - message(FATAL_ERROR "Failed to unzip ${CLDR_MISC_SOURCE} from ${CLDR_ZIP_PATH} with status ${unzip_result}") - endif() - endif() - if(EXISTS ${CLDR_ZIP_PATH} AND NOT EXISTS ${CLDR_NUMBERS_PATH}) - message(STATUS "Extracting CLDR ${CLDR_NUMBERS_SOURCE} from ${CLDR_ZIP_PATH}...") - execute_process(COMMAND unzip -q ${CLDR_ZIP_PATH} "${CLDR_NUMBERS_SOURCE}/**" -d ${LOCALE_DATA_CACHE_LOCATION} RESULT_VARIABLE unzip_result) - if (NOT unzip_result EQUAL 0) - message(FATAL_ERROR "Failed to unzip ${CLDR_NUMBERS_SOURCE} from ${CLDR_ZIP_PATH} with status ${unzip_result}") - endif() + file(DOWNLOAD "${CLDR_ZIP_URL}" "${CLDR_ZIP_PATH}" INACTIVITY_TIMEOUT 10) endif() + extract_cldr_file("${CLDR_CORE_SOURCE}" "${CLDR_CORE_PATH}") + extract_cldr_file("${CLDR_LOCALES_SOURCE}" "${CLDR_LOCALES_PATH}") + extract_cldr_file("${CLDR_MISC_SOURCE}" "${CLDR_MISC_PATH}") + extract_cldr_file("${CLDR_NUMBERS_SOURCE}" "${CLDR_NUMBERS_PATH}") + set(UNICODE_DATA_HEADER LibUnicode/UnicodeData.h) set(UNICODE_DATA_IMPLEMENTATION LibUnicode/UnicodeData.cpp)