mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 12:05:15 +00:00
Meta: Add Android cross-compile support to Lagom
This is a start to properly letting us cross-compile Lagom where both the Tools and the BUILD_LAGOM=ON build are using Lagom CMakeLists. The initial cut allows an Android build to succeed, more or less. But there are issues with namespace clashes when using FetchContent with this approach.
This commit is contained in:
parent
d84fc60f96
commit
9c2211f246
Notes:
sideshowbarker
2024-07-17 08:48:39 +09:00
Author: https://github.com/ADKaster Commit: https://github.com/SerenityOS/serenity/commit/9c2211f246 Pull-request: https://github.com/SerenityOS/serenity/pull/14606 Reviewed-by: https://github.com/linusg Reviewed-by: https://github.com/nico
3 changed files with 12 additions and 7 deletions
|
@ -48,7 +48,8 @@ jobs:
|
|||
cmake -GNinja -B tools-build \
|
||||
-DBUILD_LAGOM=OFF \
|
||||
-DENABLE_LAGOM_CCACHE=ON \
|
||||
-DCMAKE_INSTALL_PREFIX=tool-install
|
||||
-DCMAKE_INSTALL_PREFIX=tool-install \
|
||||
-Dpackage=LagomTools
|
||||
ninja -C tools-build install
|
||||
cmake -GNinja -B Build \
|
||||
-DBUILD_LAGOM=ON \
|
||||
|
|
|
@ -46,7 +46,8 @@ export AFL_NOOPT=1
|
|||
echo "Building Lagom Tools..."
|
||||
cmake -GNinja -B Build/tools \
|
||||
-DBUILD_LAGOM=OFF \
|
||||
-DCMAKE_INSTALL_PREFIX=Build/tool-install
|
||||
-DCMAKE_INSTALL_PREFIX=Build/tool-install \
|
||||
-Dpackage=LagomTools
|
||||
ninja -C Build/tools install
|
||||
|
||||
# Restore flags for oss-fuzz
|
||||
|
|
|
@ -148,7 +148,7 @@ include_directories(${CMAKE_BINARY_DIR}/Services)
|
|||
include(CMakePackageConfigHelpers)
|
||||
|
||||
# find_package(<package>) call for consumers to find this project
|
||||
set(package Lagom)
|
||||
set(package Lagom CACHE STRING "")
|
||||
|
||||
# Allow package maintainers to freely override the path for the configs
|
||||
set(Lagom_INSTALL_CMAKEDIR "${CMAKE_INSTALL_DATADIR}/${package}"
|
||||
|
@ -176,7 +176,7 @@ function(lagom_lib library fs_name)
|
|||
|
||||
# Don't make alias when we're going to import a previous build for Tools
|
||||
# FIXME: Is there a better way to write this?
|
||||
if (NOT ENABLE_FUZZERS)
|
||||
if (NOT ENABLE_FUZZERS AND NOT CMAKE_CROSSCOMPILING)
|
||||
# alias for parity with exports
|
||||
add_library(Lagom::${library} ALIAS ${target_name})
|
||||
endif()
|
||||
|
@ -260,11 +260,14 @@ endif()
|
|||
# Note: AK is included in LibCore for the host build instead of LibC per the target build
|
||||
file(GLOB AK_SOURCES CONFIGURE_DEPENDS "../../AK/*.cpp")
|
||||
file(GLOB LIBCORE_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibCore/*.cpp")
|
||||
if (ANDROID)
|
||||
list(REMOVE_ITEM LIBCORE_SOURCES "${CMAKE_CURRENT_LIST_DIR}/../../Userland/Libraries/LibCore/Account.cpp")
|
||||
endif()
|
||||
lagom_lib(Core core
|
||||
SOURCES ${AK_SOURCES} ${LIBCORE_SOURCES}
|
||||
LIBS Threads::Threads
|
||||
)
|
||||
if (NOT APPLE AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD")
|
||||
if (NOT APPLE AND NOT ANDROID AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD")
|
||||
target_link_libraries(LibCore crypt) # LibCore::Account uses crypt() but it's not in libcrypt on macOS
|
||||
endif()
|
||||
|
||||
|
@ -298,8 +301,8 @@ install(
|
|||
# Code Generators and other host tools
|
||||
# We need to make sure not to build code generators for Fuzzer builds, as they already have their own main.cpp
|
||||
# Instead, we import them from a previous install of Lagom. This mandates a two-stage build for fuzzers.
|
||||
if (ENABLE_FUZZERS)
|
||||
find_package(Lagom REQUIRED)
|
||||
if (ENABLE_FUZZERS OR CMAKE_CROSSCOMPILING)
|
||||
find_package(LagomTools REQUIRED)
|
||||
else()
|
||||
add_subdirectory(Tools)
|
||||
endif()
|
||||
|
|
Loading…
Add table
Reference in a new issue