Browse Source

LibUnicode: Extract cldr-misc dataset from CLDR database

Timothy Flynn 3 years ago
parent
commit
9cd986d8c0

+ 12 - 2
Meta/CMake/unicode_data.cmake

@@ -46,6 +46,9 @@ set(CLDR_CORE_PATH ${CLDR_PATH}/${CLDR_CORE_SOURCE})
 set(CLDR_LOCALES_SOURCE cldr-localenames-modern)
 set(CLDR_LOCALES_SOURCE cldr-localenames-modern)
 set(CLDR_LOCALES_PATH ${CLDR_PATH}/${CLDR_LOCALES_SOURCE})
 set(CLDR_LOCALES_PATH ${CLDR_PATH}/${CLDR_LOCALES_SOURCE})
 
 
+set(CLDR_MISC_SOURCE cldr-misc-modern)
+set(CLDR_MISC_PATH ${CLDR_PATH}/${CLDR_MISC_SOURCE})
+
 set(CLDR_NUMBERS_SOURCE cldr-numbers-modern)
 set(CLDR_NUMBERS_SOURCE cldr-numbers-modern)
 set(CLDR_NUMBERS_PATH ${CLDR_PATH}/${CLDR_NUMBERS_SOURCE})
 set(CLDR_NUMBERS_PATH ${CLDR_PATH}/${CLDR_NUMBERS_SOURCE})
 
 
@@ -117,6 +120,13 @@ if (ENABLE_UNICODE_DATABASE_DOWNLOAD)
             message(FATAL_ERROR "Failed to unzip ${CLDR_LOCALES_SOURCE} from ${CLDR_ZIP_PATH} with status ${unzip_result}")
             message(FATAL_ERROR "Failed to unzip ${CLDR_LOCALES_SOURCE} from ${CLDR_ZIP_PATH} with status ${unzip_result}")
         endif()
         endif()
     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 ${CLDR_PATH} 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})
     if(EXISTS ${CLDR_ZIP_PATH} AND NOT EXISTS ${CLDR_NUMBERS_PATH})
         message(STATUS "Extracting CLDR ${CLDR_NUMBERS_SOURCE} from ${CLDR_ZIP_PATH}...")
         message(STATUS "Extracting CLDR ${CLDR_NUMBERS_SOURCE} from ${CLDR_ZIP_PATH}...")
         execute_process(COMMAND unzip -q ${CLDR_ZIP_PATH} "${CLDR_NUMBERS_SOURCE}/**" -d ${CLDR_PATH} RESULT_VARIABLE unzip_result)
         execute_process(COMMAND unzip -q ${CLDR_ZIP_PATH} "${CLDR_NUMBERS_SOURCE}/**" -d ${CLDR_PATH} RESULT_VARIABLE unzip_result)
@@ -153,9 +163,9 @@ if (ENABLE_UNICODE_DATABASE_DOWNLOAD)
 
 
     add_custom_command(
     add_custom_command(
         OUTPUT ${UNICODE_LOCALE_HEADER} ${UNICODE_LOCALE_IMPLEMENTATION}
         OUTPUT ${UNICODE_LOCALE_HEADER} ${UNICODE_LOCALE_IMPLEMENTATION}
-        COMMAND $<TARGET_FILE:GenerateUnicodeLocale> -h ${UNICODE_LOCALE_HEADER} -c ${UNICODE_LOCALE_IMPLEMENTATION} -r ${CLDR_CORE_PATH} -l ${CLDR_LOCALES_PATH} -n ${CLDR_NUMBERS_PATH}
+        COMMAND $<TARGET_FILE:GenerateUnicodeLocale> -h ${UNICODE_LOCALE_HEADER} -c ${UNICODE_LOCALE_IMPLEMENTATION} -r ${CLDR_CORE_PATH} -l ${CLDR_LOCALES_PATH} -m ${CLDR_MISC_PATH} -n ${CLDR_NUMBERS_PATH}
         VERBATIM
         VERBATIM
-        DEPENDS GenerateUnicodeLocale ${CLDR_CORE_PATH} ${CLDR_LOCALES_PATH} ${CLDR_NUMBERS_PATH}
+        DEPENDS GenerateUnicodeLocale ${CLDR_CORE_PATH} ${CLDR_LOCALES_PATH} ${CLDR_MISC_PATH} ${CLDR_NUMBERS_PATH}
     )
     )
     add_custom_target(generate_${UNICODE_META_TARGET_PREFIX}UnicodeLocale DEPENDS ${UNICODE_LOCALE_HEADER} ${UNICODE_LOCALE_IMPLEMENTATION})
     add_custom_target(generate_${UNICODE_META_TARGET_PREFIX}UnicodeLocale DEPENDS ${UNICODE_LOCALE_HEADER} ${UNICODE_LOCALE_IMPLEMENTATION})
     add_dependencies(all_generated generate_${UNICODE_META_TARGET_PREFIX}UnicodeLocale)
     add_dependencies(all_generated generate_${UNICODE_META_TARGET_PREFIX}UnicodeLocale)

+ 2 - 0
Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateUnicodeLocale.cpp

@@ -937,6 +937,7 @@ int main(int argc, char** argv)
     char const* generated_implementation_path = nullptr;
     char const* generated_implementation_path = nullptr;
     char const* core_path = nullptr;
     char const* core_path = nullptr;
     char const* locale_names_path = nullptr;
     char const* locale_names_path = nullptr;
+    char const* misc_path = nullptr;
     char const* numbers_path = nullptr;
     char const* numbers_path = nullptr;
 
 
     Core::ArgsParser args_parser;
     Core::ArgsParser args_parser;
@@ -944,6 +945,7 @@ int main(int argc, char** argv)
     args_parser.add_option(generated_implementation_path, "Path to the Unicode locale implementation file to generate", "generated-implementation-path", 'c', "generated-implementation-path");
     args_parser.add_option(generated_implementation_path, "Path to the Unicode locale implementation file to generate", "generated-implementation-path", 'c', "generated-implementation-path");
     args_parser.add_option(core_path, "Path to cldr-core directory", "core-path", 'r', "core-path");
     args_parser.add_option(core_path, "Path to cldr-core directory", "core-path", 'r', "core-path");
     args_parser.add_option(locale_names_path, "Path to cldr-localenames directory", "locale-names-path", 'l', "locale-names-path");
     args_parser.add_option(locale_names_path, "Path to cldr-localenames directory", "locale-names-path", 'l', "locale-names-path");
+    args_parser.add_option(misc_path, "Path to cldr-misc directory", "misc-path", 'm', "misc-path");
     args_parser.add_option(numbers_path, "Path to cldr-numbers directory", "numbers-path", 'n', "numbers-path");
     args_parser.add_option(numbers_path, "Path to cldr-numbers directory", "numbers-path", 'n', "numbers-path");
     args_parser.parse(argc, argv);
     args_parser.parse(argc, argv);