mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 05:37:43 +00:00
Meta: Make generate_state_machine() generate a proper target
And use GENERATED_SOURCES (or add_dependencies) to make LibVT depend on that target. Fixes a FIXME.
This commit is contained in:
parent
a42bf04701
commit
c6b12841ee
3 changed files with 24 additions and 13 deletions
|
@ -293,7 +293,6 @@ generate_state_machine(../Userland/Libraries/LibVT/StateMachine.txt ../Userland/
|
||||||
set(VT_SOURCES
|
set(VT_SOURCES
|
||||||
../Userland/Libraries/LibVT/Terminal.cpp
|
../Userland/Libraries/LibVT/Terminal.cpp
|
||||||
../Userland/Libraries/LibVT/Line.cpp
|
../Userland/Libraries/LibVT/Line.cpp
|
||||||
../Userland/Libraries/LibVT/EscapeSequenceStateMachine.h
|
|
||||||
../Userland/Libraries/LibVT/EscapeSequenceParser.cpp
|
../Userland/Libraries/LibVT/EscapeSequenceParser.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -376,6 +375,8 @@ else()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_executable(Kernel ${SOURCES})
|
add_executable(Kernel ${SOURCES})
|
||||||
|
add_dependencies(Kernel generate_EscapeSequenceStateMachine.h)
|
||||||
|
|
||||||
if (ENABLE_KERNEL_LTO)
|
if (ENABLE_KERNEL_LTO)
|
||||||
include(CheckIPOSupported)
|
include(CheckIPOSupported)
|
||||||
check_ipo_supported()
|
check_ipo_supported()
|
||||||
|
|
|
@ -169,13 +169,21 @@ function(embed_resource target section file)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
function(generate_state_machine source header)
|
function(generate_state_machine source header)
|
||||||
set(source ${CMAKE_CURRENT_SOURCE_DIR}/${source})
|
get_filename_component(header_name ${header} NAME)
|
||||||
add_custom_command(
|
set(target_name "generate_${header_name}")
|
||||||
OUTPUT ${header}
|
# Note: This function is called twice with the same header, once in the kernel
|
||||||
COMMAND ${write_if_different} ${header} ${CMAKE_BINARY_DIR}/Userland/DevTools/StateMachineGenerator/StateMachineGenerator ${source} > ${header}
|
# and once in Userland/LibVT, this check makes sure that only one target
|
||||||
VERBATIM
|
# is generated for that header.
|
||||||
DEPENDS StateMachineGenerator
|
if(NOT TARGET ${target_name})
|
||||||
MAIN_DEPENDENCY ${source}
|
set(source ${CMAKE_CURRENT_SOURCE_DIR}/${source})
|
||||||
)
|
set(output ${CMAKE_CURRENT_SOURCE_DIR}/${header})
|
||||||
get_filename_component(output_name ${header} NAME)
|
add_custom_command(
|
||||||
|
OUTPUT ${output}
|
||||||
|
COMMAND ${write_if_different} ${output} ${CMAKE_BINARY_DIR}/Userland/DevTools/StateMachineGenerator/StateMachineGenerator ${source}
|
||||||
|
VERBATIM
|
||||||
|
DEPENDS StateMachineGenerator
|
||||||
|
MAIN_DEPENDENCY ${source}
|
||||||
|
)
|
||||||
|
add_custom_target(${target_name} DEPENDS ${output})
|
||||||
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
# FIXME: this assumes that EscapeSequenceStateMachine.h has been
|
|
||||||
# already generated when the kernel was built. This will probably
|
|
||||||
# mess builds up later on.
|
|
||||||
set(SOURCES
|
set(SOURCES
|
||||||
Line.cpp
|
Line.cpp
|
||||||
Terminal.cpp
|
Terminal.cpp
|
||||||
|
@ -8,5 +5,10 @@ set(SOURCES
|
||||||
EscapeSequenceParser.cpp
|
EscapeSequenceParser.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
set(GENERATED_SOURCES
|
||||||
|
EscapeSequenceStateMachine.h
|
||||||
|
)
|
||||||
|
|
||||||
|
generate_state_machine(StateMachine.txt EscapeSequenceStateMachine.h)
|
||||||
serenity_lib(LibVT vt)
|
serenity_lib(LibVT vt)
|
||||||
target_link_libraries(LibVT LibC LibCore LibGUI LibGfx LibDesktop)
|
target_link_libraries(LibVT LibC LibCore LibGUI LibGfx LibDesktop)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue