mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-11 05:25:32 +03:00
Ladybird: Always place helper processes in bundle directory on macOS
Don't put them in bin/ and then copy them to the bundle dir later, as this means that they only get updated in the bundle directory if the Ladybird binary itself needs updated. Which is not a fun workflow if you are working on WPT and want to hack on the WebDriver binary.
This commit is contained in:
parent
9918dcd4d5
commit
86c1d97e3c
Notes:
sideshowbarker
2024-07-17 10:39:39 +09:00
Author: https://github.com/ADKaster Commit: https://github.com/SerenityOS/serenity/commit/86c1d97e3c Pull-request: https://github.com/SerenityOS/serenity/pull/23304 Reviewed-by: https://github.com/clausecker Reviewed-by: https://github.com/timschumi ✅ Reviewed-by: https://github.com/trflynn89 ✅
@ -182,6 +182,13 @@ target_include_directories(ladybird PRIVATE ${SERENITY_SOURCE_DIR}/Userland/)
|
||||
target_include_directories(ladybird PRIVATE ${SERENITY_SOURCE_DIR}/Userland/Applications/)
|
||||
target_include_directories(ladybird PRIVATE ${SERENITY_SOURCE_DIR}/Userland/Services/)
|
||||
|
||||
function(set_ladybird_helper_output_directory target_name)
|
||||
if (APPLE)
|
||||
# Store helper processes in the same bundle directory as the main application
|
||||
set_target_properties(${target_name} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "$<TARGET_FILE_DIR:ladybird>")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
add_executable(headless-browser
|
||||
${SERENITY_SOURCE_DIR}/Userland/Utilities/headless-browser.cpp
|
||||
${SERENITY_SOURCE_DIR}/Userland/Services/WebContent/WebDriverConnection.cpp
|
||||
@ -213,7 +220,9 @@ add_subdirectory(WebContent)
|
||||
add_subdirectory(WebDriver)
|
||||
add_subdirectory(WebSocket)
|
||||
add_subdirectory(WebWorker)
|
||||
add_dependencies(ladybird ImageDecoder RequestServer SQLServer WebContent WebDriver WebSocketServer WebWorker headless-browser)
|
||||
|
||||
set(ladybird_helper_processes ImageDecoder RequestServer SQLServer WebContent WebDriver WebSocketServer WebWorker headless-browser)
|
||||
add_dependencies(ladybird ${ladybird_helper_processes})
|
||||
|
||||
function(create_ladybird_bundle target_name)
|
||||
set_target_properties(${target_name} PROPERTIES
|
||||
@ -228,18 +237,8 @@ function(create_ladybird_bundle target_name)
|
||||
)
|
||||
|
||||
if (APPLE)
|
||||
# FIXME: Create a proper app bundle for each helper process
|
||||
set(app_dir "$<TARGET_FILE_DIR:${target_name}>")
|
||||
set(bundle_dir "$<TARGET_BUNDLE_DIR:${target_name}>")
|
||||
add_custom_command(TARGET ${target_name} POST_BUILD
|
||||
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "$<TARGET_FILE:ImageDecoder>" "${app_dir}"
|
||||
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "$<TARGET_FILE:RequestServer>" "${app_dir}"
|
||||
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "$<TARGET_FILE:SQLServer>" "${app_dir}"
|
||||
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "$<TARGET_FILE:WebContent>" "${app_dir}"
|
||||
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "$<TARGET_FILE:WebDriver>" "${app_dir}"
|
||||
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "$<TARGET_FILE:WebSocketServer>" "${app_dir}"
|
||||
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "$<TARGET_FILE:WebWorker>" "${app_dir}"
|
||||
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "$<TARGET_FILE:headless-browser>" "${app_dir}"
|
||||
COMMAND "mkdir" -p "${bundle_dir}/Contents/Resources"
|
||||
COMMAND "iconutil" --convert icns "${SERENITY_SOURCE_DIR}/Ladybird/Icons/macos/app_icon.iconset" --output "${bundle_dir}/Contents/Resources/app_icon.icns"
|
||||
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${Lagom_BINARY_DIR}/cacert.pem" "${bundle_dir}/Contents"
|
||||
@ -248,6 +247,9 @@ function(create_ladybird_bundle target_name)
|
||||
endfunction()
|
||||
|
||||
create_ladybird_bundle(ladybird)
|
||||
foreach(helper_process IN LISTS ladybird_helper_processes)
|
||||
set_ladybird_helper_output_directory(${helper_process})
|
||||
endforeach()
|
||||
|
||||
if(NOT CMAKE_SKIP_INSTALL_RULES)
|
||||
include(cmake/InstallRules.cmake)
|
||||
@ -269,9 +271,4 @@ if (BUILD_TESTING)
|
||||
ENVIRONMENT QT_QPA_PLATFORM=offscreen
|
||||
ENVIRONMENT "SERENITY_SOURCE_DIR=${SERENITY_SOURCE_DIR}"
|
||||
)
|
||||
if (APPLE)
|
||||
set_tests_properties(LibWeb WPT PROPERTIES
|
||||
ENVIRONMENT "WEBDRIVER_BINARY=$<TARGET_FILE_DIR:ladybird>/$<TARGET_FILE_NAME:WebDriver>"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
@ -4,7 +4,7 @@ include(GNUInstallDirs)
|
||||
|
||||
set(package ladybird)
|
||||
|
||||
set(ladybird_applications ladybird SQLServer WebContent WebDriver WebSocketServer RequestServer ImageDecoder WebWorker headless-browser)
|
||||
set(ladybird_applications ladybird ${ladybird_helper_processes})
|
||||
|
||||
set(app_install_targets ${ladybird_applications})
|
||||
|
||||
|
@ -11,7 +11,7 @@ then
|
||||
fi
|
||||
|
||||
|
||||
: "${WEBDRIVER_BINARY:=$(env PATH="${SERENITY_SOURCE_DIR}/Build/lagom/bin:${SERENITY_SOURCE_DIR}/Meta/Lagom/Build/bin:${PATH}" \
|
||||
: "${WEBDRIVER_BINARY:=$(env PATH="${SERENITY_SOURCE_DIR}/Build/lagom/bin/Ladybird.app/Contents/MacOS:${SERENITY_SOURCE_DIR}/Build/lagom/bin:${SERENITY_SOURCE_DIR}/Meta/Lagom/Build/bin:${PATH}" \
|
||||
which WebDriver)}"
|
||||
update_expectations_metadata=false
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user