Meta: Use embed_as_string_view() for stringify_gml()

This commit is contained in:
Sam Atkins 2023-08-23 21:27:10 +01:00 committed by Sam Atkins
parent abba6f7b54
commit eab44f982a
2 changed files with 1 additions and 23 deletions

View file

@ -24,18 +24,8 @@ endfunction()
function(stringify_gml source output string_name)
set(source ${CMAKE_CURRENT_SOURCE_DIR}/${source})
add_custom_command(
OUTPUT ${output}
COMMAND ${SerenityOS_SOURCE_DIR}/Meta/text-to-cpp-string.sh ${string_name} ${source} > ${output}.tmp
COMMAND "${CMAKE_COMMAND}" -E copy_if_different ${output}.tmp ${output}
COMMAND "${CMAKE_COMMAND}" -E remove ${output}.tmp
VERBATIM
DEPENDS ${SerenityOS_SOURCE_DIR}/Meta/text-to-cpp-string.sh
MAIN_DEPENDENCY ${source}
)
get_filename_component(output_name ${output} NAME)
add_custom_target(generate_${output_name} DEPENDS ${output})
add_dependencies(all_generated generate_${output_name})
embed_as_string_view(${output_name} ${source} ${output} ${string_name})
endfunction()
function(compile_gml source output)

View file

@ -1,12 +0,0 @@
#!/usr/bin/env bash
# $1 name of the variable
# $2 input path
echo "#include <AK/StringView.h>"
echo
echo "extern StringView $1;"
printf "StringView %s = R\"~~~(" "$1"
grep -v '^ *#' < "$2" | while IFS= read -r line; do
echo "$line"
done
echo ")~~~\"sv;"