mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-11 05:25:32 +03:00
Build+TextEditor: Add a compile_json_gui() CMake helper
This makes it easier to include JSON GUI declarations in any app. :^)
This commit is contained in:
parent
119a0c5dee
commit
f67c876df0
Notes:
sideshowbarker
2024-07-19 02:25:20 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/f67c876df0f
@ -1,14 +1,10 @@
|
||||
compile_json_gui(MainWindow.json MainWindowUI.h main_window_ui_json)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
TextEditorWidget.cpp
|
||||
MainWindowUI.h
|
||||
)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT MainWindowUI.h
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/MainWindow.json
|
||||
COMMAND ${write_if_different} MainWindowUI.h ${CMAKE_SOURCE_DIR}/Meta/text-to-cpp-string.sh main_window_ui_json ${CMAKE_CURRENT_SOURCE_DIR}/MainWindow.json
|
||||
)
|
||||
|
||||
serenity_bin(TextEditor)
|
||||
target_link_libraries(TextEditor LibWeb LibMarkdown LibGUI LibDesktop)
|
||||
|
@ -137,6 +137,19 @@ function(serenity_bin target_name)
|
||||
serenity_generated_sources(${target_name})
|
||||
endfunction()
|
||||
|
||||
function(compile_json_gui source output string_name)
|
||||
set(source ${CMAKE_CURRENT_SOURCE_DIR}/${source})
|
||||
add_custom_command(
|
||||
OUTPUT ${output}
|
||||
COMMAND ${write_if_different} ${output} ${CMAKE_SOURCE_DIR}/Meta/text-to-cpp-string.sh ${string_name} ${source}
|
||||
VERBATIM
|
||||
DEPENDS ${CMAKE_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})
|
||||
endfunction()
|
||||
|
||||
function(compile_ipc source output)
|
||||
set(source ${CMAKE_CURRENT_SOURCE_DIR}/${source})
|
||||
add_custom_command(
|
||||
|
Loading…
Reference in New Issue
Block a user