Meta: Make embed_as_string_view.py produce Strings instead

This is only used for CSS style sheets. One case wants it as a String,
and the others don't care, but will in future also want to have the
source as a String.
This commit is contained in:
Sam Atkins 2024-08-22 12:42:12 +01:00 committed by Sam Atkins
commit 8cbc211616
Notes: github-actions[bot] 2024-09-03 09:13:30 +00:00
9 changed files with 31 additions and 32 deletions

View file

@ -2,7 +2,7 @@
# Functions for generating sources using host tools
#
function(embed_as_string_view name source_file output source_variable_name)
function(embed_as_string name source_file output source_variable_name)
cmake_parse_arguments(PARSE_ARGV 4 EMBED_STRING_VIEW "" "NAMESPACE" "")
set(namespace_arg "")
if (EMBED_STRING_VIEW_NAMESPACE)
@ -11,11 +11,11 @@ function(embed_as_string_view name source_file output source_variable_name)
find_package(Python3 REQUIRED COMPONENTS Interpreter)
add_custom_command(
OUTPUT "${output}"
COMMAND "${Python3_EXECUTABLE}" "${SerenityOS_SOURCE_DIR}/Meta/embed_as_string_view.py" "${source_file}" -o "${output}.tmp" -n "${source_variable_name}" ${namespace_arg}
COMMAND "${Python3_EXECUTABLE}" "${SerenityOS_SOURCE_DIR}/Meta/embed_as_string.py" "${source_file}" -o "${output}.tmp" -n "${source_variable_name}" ${namespace_arg}
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${output}.tmp" "${output}"
COMMAND "${CMAKE_COMMAND}" -E remove "${output}.tmp"
VERBATIM
DEPENDS "${SerenityOS_SOURCE_DIR}/Meta/embed_as_string_view.py"
DEPENDS "${SerenityOS_SOURCE_DIR}/Meta/embed_as_string.py"
MAIN_DEPENDENCY "${source_file}"
)
@ -78,4 +78,3 @@ function(compile_ipc source output)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${output} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${current_source_dir_relative}" OPTIONAL)
endif()
endfunction()