mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 00:50:22 +00:00
Meta: Uncouple ladybird.sh run from a specific CMake configuration
This commit is contained in:
parent
e62f0a8da3
commit
ec6072e7cd
Notes:
sideshowbarker
2024-07-18 00:34:07 +09:00
Author: https://github.com/ADKaster Commit: https://github.com/LadybirdBrowser/ladybird/commit/ec6072e7cd Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/48 Reviewed-by: https://github.com/trflynn89 ✅
3 changed files with 16 additions and 31 deletions
|
@ -120,7 +120,7 @@ if (ANDROID)
|
|||
include(cmake/AndroidExtras.cmake)
|
||||
endif()
|
||||
|
||||
add_custom_target(run-ladybird
|
||||
add_custom_target(run
|
||||
COMMAND "${CMAKE_COMMAND}" -E env "LADYBIRD_SOURCE_DIR=${LADYBIRD_SOURCE_DIR}" "$<TARGET_FILE:ladybird>" $ENV{LAGOM_ARGS}
|
||||
USES_TERMINAL
|
||||
VERBATIM
|
||||
|
|
|
@ -261,7 +261,6 @@ function(lagom_test source)
|
|||
COMMAND ${LAGOM_TEST_NAME}
|
||||
WORKING_DIRECTORY ${LAGOM_TEST_WORKING_DIRECTORY}
|
||||
)
|
||||
set_target_properties(${LAGOM_TEST_NAME} PROPERTIES LAGOM_WORKING_DIRECTORY "${LAGOM_TEST_WORKING_DIRECTORY}")
|
||||
endfunction()
|
||||
|
||||
function(lagom_utility name)
|
||||
|
@ -675,17 +674,4 @@ else()
|
|||
export_components("${CMAKE_BINARY_DIR}/components.ini")
|
||||
endif()
|
||||
|
||||
if (NOT "$ENV{LAGOM_TARGET}" STREQUAL "")
|
||||
add_custom_target(run-lagom-target
|
||||
COMMAND "${CMAKE_COMMAND}"
|
||||
-E env "LADYBIRD_SOURCE_DIR=${SERENITY_PROJECT_ROOT}" "$<TARGET_FILE:$ENV{LAGOM_TARGET}>"
|
||||
$ENV{LAGOM_ARGS}
|
||||
|
||||
WORKING_DIRECTORY "$<TARGET_PROPERTY:$ENV{LAGOM_TARGET},LAGOM_WORKING_DIRECTORY>"
|
||||
DEPENDS "$<TARGET_FILE:$ENV{LAGOM_TARGET}>"
|
||||
USES_TERMINAL
|
||||
VERBATIM
|
||||
)
|
||||
endif()
|
||||
|
||||
include(ca_certificates_data)
|
||||
|
|
|
@ -156,21 +156,24 @@ run_gdb() {
|
|||
}
|
||||
|
||||
build_and_run_lagom_target() {
|
||||
local run_target="${1}"
|
||||
local lagom_target="${CMD_ARGS[0]}"
|
||||
local lagom_args
|
||||
local lagom_args=("${CMD_ARGS[@]:1}")
|
||||
|
||||
# All command arguments must have any existing semicolon escaped, to prevent CMake from
|
||||
# interpreting them as list separators.
|
||||
local cmd_args=()
|
||||
for arg in "${CMD_ARGS[@]:1}"; do
|
||||
cmd_args+=( "${arg//;/\\;}" )
|
||||
done
|
||||
if [ -z "$lagom_target" ]; then
|
||||
lagom_target="ladybird"
|
||||
fi
|
||||
|
||||
# Then existing list separators must be replaced with a semicolon for CMake.
|
||||
lagom_args=$(IFS=';' ; echo -e "${cmd_args[*]}")
|
||||
build_target "${lagom_target}"
|
||||
|
||||
LAGOM_TARGET="${lagom_target}" LAGOM_ARGS="${lagom_args[*]}" build_target "${run_target}"
|
||||
if [ "$lagom_target" = "ladybird" ] && [ "$(uname -s)" = "Darwin" ]; then
|
||||
open --wait-apps --stdout $(tty) --stderr $(tty) "$BUILD_DIR/bin/Ladybird.app" --args "${lagom_args[@]}"
|
||||
else
|
||||
local lagom_bin="$lagom_target"
|
||||
if [ "$lagom_bin" = "ladybird" ]; then
|
||||
lagom_bin="Ladybird"
|
||||
fi
|
||||
"$BUILD_DIR/bin/$lagom_bin" "${lagom_args[@]}"
|
||||
fi
|
||||
}
|
||||
|
||||
if [[ "$CMD" =~ ^(build|install|run|gdb|test|rebuild|recreate|addr2line)$ ]]; then
|
||||
|
@ -186,11 +189,7 @@ if [[ "$CMD" =~ ^(build|install|run|gdb|test|rebuild|recreate|addr2line)$ ]]; th
|
|||
build_target install
|
||||
;;
|
||||
run)
|
||||
if [ "${CMD_ARGS[0]}" = "ladybird" ]; then
|
||||
build_and_run_lagom_target "run-ladybird"
|
||||
else
|
||||
build_and_run_lagom_target "run-lagom-target"
|
||||
fi
|
||||
build_and_run_lagom_target
|
||||
;;
|
||||
gdb)
|
||||
[ $# -ge 1 ] || usage
|
||||
|
|
Loading…
Reference in a new issue