mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 09:00:22 +00:00
Ladybird: Ensure that installed ladybird can launch WebContent process
Always call platform_init after there's a QApplication, because in the installed configuration that's how we find the resources. Try QCoreApplication::applicationDirPath() after looking in ./WebContent for the WebContent process. In an installed configuration, ladybird and WebContent will both be in $PREFIX/bin. Add install rules for WebContent and its linked libraries, for if they ever differ from ladybird's.
This commit is contained in:
parent
bbb08c1912
commit
6fff03713c
Notes:
sideshowbarker
2024-07-17 03:10:07 +09:00
Author: https://github.com/ADKaster Commit: https://github.com/SerenityOS/serenity/commit/6fff03713c Pull-request: https://github.com/SerenityOS/serenity/pull/16583 Reviewed-by: https://github.com/awesomekling ✅ Reviewed-by: https://github.com/linusg
6 changed files with 32 additions and 17 deletions
|
@ -96,9 +96,9 @@ add_custom_target(debug
|
|||
|
||||
qt_finalize_executable(ladybird)
|
||||
|
||||
add_subdirectory(WebContent)
|
||||
add_dependencies(ladybird WebContent)
|
||||
|
||||
if(NOT CMAKE_SKIP_INSTALL_RULES)
|
||||
include(cmake/InstallRules.cmake)
|
||||
endif()
|
||||
|
||||
add_subdirectory(WebContent)
|
||||
add_dependencies(ladybird WebContent)
|
||||
|
|
|
@ -38,10 +38,10 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
// FIXME: Refactor things so we can get rid of this somehow.
|
||||
Core::EventLoop event_loop;
|
||||
|
||||
platform_init();
|
||||
|
||||
QGuiApplication app(arguments.argc, arguments.argv);
|
||||
|
||||
platform_init();
|
||||
|
||||
Web::Platform::EventLoopPlugin::install(*new Ladybird::EventLoopPluginQt);
|
||||
Web::Platform::ImageCodecPlugin::install(*new Ladybird::ImageCodecPluginLadybird);
|
||||
|
||||
|
|
|
@ -570,6 +570,8 @@ void WebContentView::create_client()
|
|||
MUST(Core::System::setenv("FD_PASSING_SOCKET"sv, fd_passing_socket_string, true));
|
||||
|
||||
auto rc = execlp("./WebContent/WebContent", "WebContent", nullptr);
|
||||
if (rc < 0)
|
||||
rc = execlp((QCoreApplication::applicationDirPath() + "/WebContent").toStdString().c_str(), "WebContent", nullptr);
|
||||
if (rc < 0)
|
||||
perror("execlp");
|
||||
VERIFY_NOT_REACHED();
|
||||
|
|
|
@ -18,10 +18,23 @@ install(TARGETS ladybird
|
|||
DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
)
|
||||
|
||||
install(TARGETS WebContent
|
||||
EXPORT ladybirdTargets
|
||||
RUNTIME
|
||||
COMPONENT ladybird_Runtime
|
||||
DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
BUNDLE
|
||||
COMPONENT ladybird_Runtime
|
||||
DESTINATION bundle
|
||||
)
|
||||
|
||||
include("${Lagom_SOURCE_DIR}/get_linked_lagom_libraries.cmake")
|
||||
get_linked_lagom_libraries(ladybird ladybird_lagom_libraries)
|
||||
get_linked_lagom_libraries(WebContent webcontent_lagom_libraries)
|
||||
list(APPEND all_required_lagom_libraries ${ladybird_lagom_libraries} ${webcontent_lagom_libraries})
|
||||
list(REMOVE_DUPLICATES all_required_lagom_libraries)
|
||||
|
||||
install(TARGETS ${ladybird_lagom_libraries}
|
||||
install(TARGETS ${all_required_lagom_libraries}
|
||||
EXPORT ladybirdTargets
|
||||
COMPONENT ladybird_Runtime
|
||||
LIBRARY
|
||||
|
|
|
@ -17,18 +17,18 @@ Browser::Settings* s_settings;
|
|||
|
||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
platform_init();
|
||||
|
||||
// NOTE: We only instantiate this to ensure that Gfx::FontDatabase has its default queries initialized.
|
||||
Gfx::FontDatabase::set_default_font_query("Katica 10 400 0");
|
||||
Gfx::FontDatabase::set_fixed_width_font_query("Csilla 10 400 0");
|
||||
|
||||
// NOTE: This is only used for the Core::Socket inside the IPC connections.
|
||||
// FIXME: Refactor things so we can get rid of this somehow.
|
||||
Core::EventLoop event_loop;
|
||||
|
||||
QApplication app(arguments.argc, arguments.argv);
|
||||
|
||||
platform_init();
|
||||
|
||||
// NOTE: We only instantiate this to ensure that Gfx::FontDatabase has its default queries initialized.
|
||||
Gfx::FontDatabase::set_default_font_query("Katica 10 400 0");
|
||||
Gfx::FontDatabase::set_fixed_width_font_query("Csilla 10 400 0");
|
||||
|
||||
String url;
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.set_general_help("The Ladybird web browser :^)");
|
||||
|
|
Loading…
Reference in a new issue