diff options
author | Timothy Flynn <trflynn89@pm.me> | 2021-12-22 16:30:21 -0500 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-01-08 12:45:34 +0100 |
commit | 9ba386a7bbe978702174df45e19e0a4fd14e77b9 (patch) | |
tree | 6975dbaa59dc8f6b1deda108ac12e288071e2874 /Meta/CMake | |
parent | d5f14b5ff9a9a857a27eb1a44ab6c4406136fa59 (diff) | |
download | serenity-9ba386a7bbe978702174df45e19e0a4fd14e77b9.zip |
Meta: Move invoke_generator to utils.cmake
Diffstat (limited to 'Meta/CMake')
-rw-r--r-- | Meta/CMake/unicode_data.cmake | 25 | ||||
-rw-r--r-- | Meta/CMake/utils.cmake | 17 |
2 files changed, 25 insertions, 17 deletions
diff --git a/Meta/CMake/unicode_data.cmake b/Meta/CMake/unicode_data.cmake index ee7bf9f4bf..ef3153b417 100644 --- a/Meta/CMake/unicode_data.cmake +++ b/Meta/CMake/unicode_data.cmake @@ -87,23 +87,6 @@ function(extract_cldr_file source path) endif() endfunction() -function(invoke_generator name generator header implementation) - cmake_parse_arguments(invoke_generator "" "" "arguments" ${ARGN}) - - add_custom_command( - OUTPUT "${header}" "${implementation}" - COMMAND $<TARGET_FILE:${generator}> -h "${header}.tmp" -c "${implementation}.tmp" ${invoke_generator_arguments} - COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${header}.tmp" "${header}" - COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${implementation}.tmp" "${implementation}" - COMMAND "${CMAKE_COMMAND}" -E remove "${header}.tmp" "${implementation}.tmp" - VERBATIM - DEPENDS ${generator} "${UCD_VERSION_FILE}" "${CLDR_VERSION_FILE}" - ) - - add_custom_target(generate_${UNICODE_META_TARGET_PREFIX}${name} DEPENDS "${header}" "${implementation}") - add_dependencies(all_generated generate_${UNICODE_META_TARGET_PREFIX}${name}) -endfunction() - if (ENABLE_UNICODE_DATABASE_DOWNLOAD) remove_path_if_version_changed("${UCD_VERSION}" "${UCD_VERSION_FILE}" "${UCD_PATH}") remove_path_if_version_changed("${CLDR_VERSION}" "${CLDR_VERSION_FILE}" "${CLDR_PATH}") @@ -167,6 +150,8 @@ if (ENABLE_UNICODE_DATABASE_DOWNLOAD) invoke_generator( "UnicodeData" Lagom::GenerateUnicodeData + "${UCD_VERSION_FILE}" + "${UNICODE_META_TARGET_PREFIX}" "${UNICODE_DATA_HEADER}" "${UNICODE_DATA_IMPLEMENTATION}" arguments -u "${UNICODE_DATA_PATH}" -s "${SPECIAL_CASING_PATH}" -g "${DERIVED_GENERAL_CATEGORY_PATH}" -p "${PROP_LIST_PATH}" -d "${DERIVED_CORE_PROP_PATH}" -b "${DERIVED_BINARY_PROP_PATH}" -a "${PROP_ALIAS_PATH}" -v "${PROP_VALUE_ALIAS_PATH}" -r "${SCRIPTS_PATH}" -x "${SCRIPT_EXTENSIONS_PATH}" -e "${EMOJI_DATA_PATH}" -m "${NAME_ALIAS_PATH}" -n "${NORM_PROPS_PATH}" @@ -174,6 +159,8 @@ if (ENABLE_UNICODE_DATABASE_DOWNLOAD) invoke_generator( "UnicodeDateTimeFormat" Lagom::GenerateUnicodeDateTimeFormat + "${CLDR_VERSION_FILE}" + "${UNICODE_META_TARGET_PREFIX}" "${UNICODE_DATE_TIME_FORMAT_HEADER}" "${UNICODE_DATE_TIME_FORMAT_IMPLEMENTATION}" arguments -r "${CLDR_CORE_PATH}" -d "${CLDR_DATES_PATH}" @@ -181,6 +168,8 @@ if (ENABLE_UNICODE_DATABASE_DOWNLOAD) invoke_generator( "UnicodeLocale" Lagom::GenerateUnicodeLocale + "${CLDR_VERSION_FILE}" + "${UNICODE_META_TARGET_PREFIX}" "${UNICODE_LOCALE_HEADER}" "${UNICODE_LOCALE_IMPLEMENTATION}" arguments -r "${CLDR_CORE_PATH}" -l "${CLDR_LOCALES_PATH}" -m "${CLDR_MISC_PATH}" -n "${CLDR_NUMBERS_PATH}" -d "${CLDR_DATES_PATH}" @@ -188,6 +177,8 @@ if (ENABLE_UNICODE_DATABASE_DOWNLOAD) invoke_generator( "UnicodeNumberFormat" Lagom::GenerateUnicodeNumberFormat + "${CLDR_VERSION_FILE}" + "${UNICODE_META_TARGET_PREFIX}" "${UNICODE_NUMBER_FORMAT_HEADER}" "${UNICODE_NUMBER_FORMAT_IMPLEMENTATION}" arguments -n "${CLDR_NUMBERS_PATH}" -u "${CLDR_UNITS_PATH}" diff --git a/Meta/CMake/utils.cmake b/Meta/CMake/utils.cmake index 9f48a64e1b..94c90a4b9f 100644 --- a/Meta/CMake/utils.cmake +++ b/Meta/CMake/utils.cmake @@ -175,3 +175,20 @@ function(remove_path_if_version_changed version version_file cache_path) file(WRITE "${version_file}" "${version}") endif() endfunction() + +function(invoke_generator name generator version_file prefix header implementation) + cmake_parse_arguments(invoke_generator "" "" "arguments" ${ARGN}) + + add_custom_command( + OUTPUT "${header}" "${implementation}" + COMMAND $<TARGET_FILE:${generator}> -h "${header}.tmp" -c "${implementation}.tmp" ${invoke_generator_arguments} + COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${header}.tmp" "${header}" + COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${implementation}.tmp" "${implementation}" + COMMAND "${CMAKE_COMMAND}" -E remove "${header}.tmp" "${implementation}.tmp" + VERBATIM + DEPENDS ${generator} "${version_file}" + ) + + add_custom_target("generate_${prefix}${name}" DEPENDS "${header}" "${implementation}") + add_dependencies(all_generated "generate_${prefix}${name}") +endfunction() |