1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 22:17:44 +00:00

Ladybird: Support building Ladybird as a non-top-level project

The implementation assumes that Lagom is either the top level project,
or included before Ladybird is.
This commit is contained in:
Andrew Kaster 2022-12-23 11:36:02 -07:00 committed by Andrew Kaster
parent 03294b0177
commit b4d80f92ec
4 changed files with 40 additions and 46 deletions

View file

@ -0,0 +1,18 @@
# Copyright (c) 2021, Andrew Kaster <akaster@serenityos.org>
#
# SPDX-License-Identifier: MIT
set(BUILD_LAGOM ON CACHE INTERNAL "Build all Lagom targets")
set(LAGOM_SOURCE_DIR "${SERENITY_SOURCE_DIR}/Meta/Lagom")
set(LAGOM_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/Lagom")
# FIXME: Setting target_include_directories on Lagom libraries might make this unecessary?
include_directories(${SERENITY_SOURCE_DIR})
include_directories(${SERENITY_SOURCE_DIR}/Userland/Libraries)
include_directories(${LAGOM_BINARY_DIR})
include_directories(${LAGOM_BINARY_DIR}/Userland/Services)
include_directories(${LAGOM_BINARY_DIR}/Userland/Libraries)
# We set EXCLUDE_FROM_ALL to make sure that only required Lagom libraries are built
add_subdirectory("${LAGOM_SOURCE_DIR}" "${LAGOM_BINARY_DIR}" EXCLUDE_FROM_ALL)

View file

@ -1,35 +0,0 @@
# Copyright (c) 2021, Andrew Kaster <akaster@serenityos.org>
#
# SPDX-License-Identifier: MIT
# Fetch serenity, so that we can build Lagom from it
FetchContent_Declare(lagom
GIT_REPOSITORY https://github.com/SerenityOS/serenity.git
GIT_TAG origin/master
GIT_SHALLOW TRUE
SOURCE_DIR serenity
)
# Allow developers to skip download/update steps with local checkout
if (SERENITY_SOURCE_DIR)
set(FETCHCONTENT_SOURCE_DIR_LAGOM ${SERENITY_SOURCE_DIR} CACHE PATH "Developer's pre-existing serenity source directory" FORCE)
message(STATUS "Using pre-existing SERENITY_SOURCE_DIR: ${SERENITY_SOURCE_DIR}")
endif()
# Can't use FetchContent_MakeAvailable b/c we want to use the Lagom build, not the main build
# Populate source directory for lagom
FetchContent_GetProperties(lagom)
if (NOT lagom_POPULATED)
FetchContent_Populate(lagom)
set(BUILD_LAGOM ON CACHE INTERNAL "Build all Lagom targets")
# FIXME: Setting target_include_directories on Lagom libraries might make this unecessary?
include_directories(${lagom_SOURCE_DIR})
include_directories(${lagom_SOURCE_DIR}/Userland/Libraries)
include_directories(${lagom_BINARY_DIR})
include_directories(${lagom_BINARY_DIR}/Userland/Services)
include_directories(${lagom_BINARY_DIR}/Userland/Libraries)
# We set EXCLUDE_FROM_ALL to make sure that only required Lagom libraries are built
add_subdirectory(${lagom_SOURCE_DIR}/Meta/Lagom ${lagom_BINARY_DIR} EXCLUDE_FROM_ALL)
endif()

View file

@ -28,7 +28,7 @@ install(TARGETS WebContent
DESTINATION bundle
)
include("${Lagom_SOURCE_DIR}/get_linked_lagom_libraries.cmake")
include("${SERENITY_SOURCE_DIR}/Meta/Lagom/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})