Meta: Support running ladybird with arguments from serenity.sh

You may now, for example, run:

    ./Meta/serenity.sh run lagom ladybird https://serenityos.org
This commit is contained in:
Timothy Flynn 2023-01-26 06:51:48 -05:00 committed by Tim Flynn
parent 9743445e44
commit ad8183beb4
Notes: sideshowbarker 2024-07-17 06:38:11 +09:00
2 changed files with 6 additions and 5 deletions

View file

@ -116,8 +116,9 @@ if (ANDROID)
endif()
add_custom_target(run${LADYBIRD_CUSTOM_TARGET_SUFFIX}
COMMAND "${CMAKE_COMMAND}" -E env "SERENITY_SOURCE_DIR=${SERENITY_SOURCE_DIR}" "$<TARGET_FILE:ladybird>"
COMMAND "${CMAKE_COMMAND}" -E env "SERENITY_SOURCE_DIR=${SERENITY_SOURCE_DIR}" "$<TARGET_FILE:ladybird>" $ENV{LAGOM_ARGS}
USES_TERMINAL
VERBATIM
)
add_custom_target(debug${LADYBIRD_CUSTOM_TARGET_SUFFIX}

View file

@ -402,6 +402,7 @@ run_gdb() {
}
build_and_run_lagom_target() {
local run_target="${1}"
local lagom_target="${CMD_ARGS[0]}"
local lagom_args
@ -415,7 +416,7 @@ build_and_run_lagom_target() {
# Then existing list separators must be replaced with a semicolon for CMake.
lagom_args=$(IFS=';' ; echo -e "${cmd_args[*]}")
LAGOM_TARGET="${lagom_target}" LAGOM_ARGS="${lagom_args[*]}" build_target "run-lagom-target"
LAGOM_TARGET="${lagom_target}" LAGOM_ARGS="${lagom_args[*]}" build_target "${run_target}"
}
if [[ "$CMD" =~ ^(build|install|image|copy-src|run|gdb|test|rebuild|recreate|kaddr2line|addr2line|setup-and-run)$ ]]; then
@ -447,10 +448,9 @@ if [[ "$CMD" =~ ^(build|install|image|copy-src|run|gdb|test|rebuild|recreate|kad
run)
if [ "$TARGET" = "lagom" ]; then
if [ "${CMD_ARGS[0]}" = "ladybird" ]; then
build_target "${CMD_ARGS[0]}"
ninja -C "$BUILD_DIR" run-ladybird
build_and_run_lagom_target "run-ladybird"
else
build_and_run_lagom_target
build_and_run_lagom_target "run-lagom-target"
fi
else
build_target