mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-11 05:25:32 +03: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
@ -96,9 +96,9 @@ add_custom_target(debug
|
|||||||
|
|
||||||
qt_finalize_executable(ladybird)
|
qt_finalize_executable(ladybird)
|
||||||
|
|
||||||
|
add_subdirectory(WebContent)
|
||||||
|
add_dependencies(ladybird WebContent)
|
||||||
|
|
||||||
if(NOT CMAKE_SKIP_INSTALL_RULES)
|
if(NOT CMAKE_SKIP_INSTALL_RULES)
|
||||||
include(cmake/InstallRules.cmake)
|
include(cmake/InstallRules.cmake)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_subdirectory(WebContent)
|
|
||||||
add_dependencies(ladybird WebContent)
|
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
set(WEBCONTENT_SOURCE_DIR ${SERENITY_SOURCE_DIR}/Userland/Services/WebContent/)
|
set(WEBCONTENT_SOURCE_DIR ${SERENITY_SOURCE_DIR}/Userland/Services/WebContent/)
|
||||||
|
|
||||||
set(WEBCONTENT_SOURCES
|
set(WEBCONTENT_SOURCES
|
||||||
${WEBCONTENT_SOURCE_DIR}/ConnectionFromClient.cpp
|
${WEBCONTENT_SOURCE_DIR}/ConnectionFromClient.cpp
|
||||||
${WEBCONTENT_SOURCE_DIR}/ConsoleGlobalObject.cpp
|
${WEBCONTENT_SOURCE_DIR}/ConsoleGlobalObject.cpp
|
||||||
${WEBCONTENT_SOURCE_DIR}/PageHost.cpp
|
${WEBCONTENT_SOURCE_DIR}/PageHost.cpp
|
||||||
${WEBCONTENT_SOURCE_DIR}/WebContentConsoleClient.cpp
|
${WEBCONTENT_SOURCE_DIR}/WebContentConsoleClient.cpp
|
||||||
../EventLoopPluginQt.cpp
|
../EventLoopPluginQt.cpp
|
||||||
../FontPluginQt.cpp
|
../FontPluginQt.cpp
|
||||||
../ImageCodecPluginLadybird.cpp
|
../ImageCodecPluginLadybird.cpp
|
||||||
@ -14,7 +14,7 @@ set(WEBCONTENT_SOURCES
|
|||||||
../WebSocketClientManagerLadybird.cpp
|
../WebSocketClientManagerLadybird.cpp
|
||||||
../WebSocketLadybird.cpp
|
../WebSocketLadybird.cpp
|
||||||
main.cpp
|
main.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
qt_add_executable(WebContent ${WEBCONTENT_SOURCES})
|
qt_add_executable(WebContent ${WEBCONTENT_SOURCES})
|
||||||
|
|
||||||
|
@ -38,10 +38,10 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||||||
// FIXME: Refactor things so we can get rid of this somehow.
|
// FIXME: Refactor things so we can get rid of this somehow.
|
||||||
Core::EventLoop event_loop;
|
Core::EventLoop event_loop;
|
||||||
|
|
||||||
platform_init();
|
|
||||||
|
|
||||||
QGuiApplication app(arguments.argc, arguments.argv);
|
QGuiApplication app(arguments.argc, arguments.argv);
|
||||||
|
|
||||||
|
platform_init();
|
||||||
|
|
||||||
Web::Platform::EventLoopPlugin::install(*new Ladybird::EventLoopPluginQt);
|
Web::Platform::EventLoopPlugin::install(*new Ladybird::EventLoopPluginQt);
|
||||||
Web::Platform::ImageCodecPlugin::install(*new Ladybird::ImageCodecPluginLadybird);
|
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));
|
MUST(Core::System::setenv("FD_PASSING_SOCKET"sv, fd_passing_socket_string, true));
|
||||||
|
|
||||||
auto rc = execlp("./WebContent/WebContent", "WebContent", nullptr);
|
auto rc = execlp("./WebContent/WebContent", "WebContent", nullptr);
|
||||||
|
if (rc < 0)
|
||||||
|
rc = execlp((QCoreApplication::applicationDirPath() + "/WebContent").toStdString().c_str(), "WebContent", nullptr);
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
perror("execlp");
|
perror("execlp");
|
||||||
VERIFY_NOT_REACHED();
|
VERIFY_NOT_REACHED();
|
||||||
|
@ -18,10 +18,23 @@ install(TARGETS ladybird
|
|||||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
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")
|
include("${Lagom_SOURCE_DIR}/get_linked_lagom_libraries.cmake")
|
||||||
get_linked_lagom_libraries(ladybird ladybird_lagom_libraries)
|
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
|
EXPORT ladybirdTargets
|
||||||
COMPONENT ladybird_Runtime
|
COMPONENT ladybird_Runtime
|
||||||
LIBRARY
|
LIBRARY
|
||||||
|
@ -17,18 +17,18 @@ Browser::Settings* s_settings;
|
|||||||
|
|
||||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
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.
|
// NOTE: This is only used for the Core::Socket inside the IPC connections.
|
||||||
// FIXME: Refactor things so we can get rid of this somehow.
|
// FIXME: Refactor things so we can get rid of this somehow.
|
||||||
Core::EventLoop event_loop;
|
Core::EventLoop event_loop;
|
||||||
|
|
||||||
QApplication app(arguments.argc, arguments.argv);
|
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;
|
String url;
|
||||||
Core::ArgsParser args_parser;
|
Core::ArgsParser args_parser;
|
||||||
args_parser.set_general_help("The Ladybird web browser :^)");
|
args_parser.set_general_help("The Ladybird web browser :^)");
|
||||||
|
Loading…
Reference in New Issue
Block a user