1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 13:27:35 +00:00

Meta+Userland: Allow generating C++ initializer code from GML

This does the exact same thing as the runtime initializer,
except it is faster and can catch some errors much earlier.

The code generator includes these important features:
- Automatic include generation where necessary
- Special-casing for TabWidget and ScrollableContainerWidget
- No use of DeprecatedString where possible
This commit is contained in:
kleines Filmröllchen 2023-08-11 15:16:51 +02:00 committed by Jelle Raaijmakers
parent 1e67435ff5
commit d1645efde9
6 changed files with 347 additions and 0 deletions

View file

@ -18,6 +18,22 @@ function(stringify_gml source output string_name)
add_dependencies(all_generated generate_${output_name})
endfunction()
function(compile_gml source output)
set(source ${CMAKE_CURRENT_SOURCE_DIR}/${source})
add_custom_command(
OUTPUT ${output}
COMMAND $<TARGET_FILE:Lagom::GMLCompiler> ${source} > ${output}.tmp
COMMAND "${CMAKE_COMMAND}" -E copy_if_different ${output}.tmp ${output}
COMMAND "${CMAKE_COMMAND}" -E remove ${output}.tmp
VERBATIM
DEPENDS Lagom::GMLCompiler
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})
endfunction()
function(compile_ipc source output)
if (NOT IS_ABSOLUTE ${source})
set(source ${CMAKE_CURRENT_SOURCE_DIR}/${source})