1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 06:37:35 +00:00

Ladybird: Add new template Kotlin Android application without Qt

This template app from Android Studio should hopefully be more fun to
work on than the Qt wrapped application we were using before. :^)

It currently builds the native code using gradle rules, and has a stub
WebViewImplementationNative class that will wrap a c++ class of the same
name that inhertis from WebView::ViewImplementation. Spawning helper
processes and creating proper views in Kotlin is next on the list.
This commit is contained in:
Andrew Kaster 2023-09-02 17:30:21 +02:00 committed by Andrew Kaster
parent 6e8f1549a3
commit 7bc009d80f
50 changed files with 943 additions and 370 deletions

View file

@ -3,42 +3,6 @@
# SPDX-License-Identifier: BSD-2-Clause
#
#
# Source directory for androiddeployqt to use when bundling the application
#
set_property(TARGET ladybird APPEND PROPERTY
QT_ANDROID_PACKAGE_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/android
)
#
# Android-specific sources and libs
#
add_library(android_init STATIC AndroidPlatform.cpp)
target_link_libraries(android_init PUBLIC Qt::Core Qt::Gui Qt::Network LibCompress LibArchive LibFileSystem)
macro(link_android_libs target)
target_link_libraries(${target} PRIVATE android_init)
endmacro()
#
# NDK and Qt don't ship OpenSSL for Android
# Download the prebuilt binaries from KDAB for inclusion as recommended in Qt docs.
#
include(FetchContent)
FetchContent_Declare(android_openssl
GIT_REPOSITORY https://github.com/KDAB/android_openssl
GIT_TAG origin/master
GIT_SHALLOW TRUE
)
FetchContent_MakeAvailable(android_openssl)
link_android_libs(ladybird)
target_link_libraries(ladybird PRIVATE Qt::Network)
set_property(TARGET ladybird APPEND PROPERTY QT_ANDROID_EXTRA_LIBS ${ANDROID_EXTRA_LIBS}
"${CMAKE_CURRENT_BINARY_DIR}/WebContent/libWebContent_${ANDROID_ABI}.so"
"${CMAKE_CURRENT_BINARY_DIR}/SQLServer/libSQLServer_${ANDROID_ABI}.so"
"${CMAKE_CURRENT_BINARY_DIR}/WebDriver/libWebDriver_${ANDROID_ABI}.so"
)
#
# Copy resources into tarball for inclusion in /assets of APK
#
@ -70,6 +34,6 @@ add_custom_target(copy-content-filters
"asset-bundle/res/ladybird/BrowserContentFilters.txt"
)
add_dependencies(archive-assets copy-autoplay-allowlist copy-content-filters)
add_custom_target(copy-assets COMMAND ${CMAKE_COMMAND} -E copy_if_different ladybird-assets.tar.gz "${CMAKE_SOURCE_DIR}/android/assets/")
add_custom_target(copy-assets COMMAND ${CMAKE_COMMAND} -E copy_if_different ladybird-assets.tar.gz "${CMAKE_SOURCE_DIR}/Android/src/main/assets/")
add_dependencies(copy-assets archive-assets)
add_dependencies(ladybird copy-assets)

View file

@ -7,10 +7,6 @@ set(package ladybird)
set(ladybird_applications ladybird SQLServer WebContent WebDriver WebSocketServer RequestServer headless-browser)
set(app_install_targets ${ladybird_applications})
if (ANDROID)
# androiddeployqt will get confused with duplicate resources if we install every app
set(app_install_targets ladybird)
endif()
install(TARGETS ${app_install_targets}
EXPORT ladybirdTargets
@ -37,6 +33,9 @@ foreach (application IN LISTS ladybird_applications)
endforeach()
list(REMOVE_DUPLICATES all_required_lagom_libraries)
# Remove ladybird shlib if it exists
list(REMOVE_ITEM all_required_lagom_libraries ladybird)
# Install webcontent impl library if it exists
if (TARGET webcontent)
list(APPEND all_required_lagom_libraries webcontent)