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

Ladybird/Meta: Convert to CMake build

This commit is contained in:
Andrew Kaster 2022-07-04 05:45:18 -06:00 committed by Andrew Kaster
parent da19b78dea
commit 74fda4aff5
7 changed files with 177 additions and 43 deletions

View file

@ -0,0 +1,14 @@
option(LADYBIRD_USE_LLD "Use llvm lld to link application" ON)
if (LADYBIRD_USE_LLD AND NOT APPLE)
find_program(LLD_LINKER NAMES "ld.lld")
if (NOT LLD_LINKER)
message(INFO "LLD not found, cannot use to link. Disabling option...")
set(LADYBIRD_USE_LLD OFF CACHE BOOL "" FORCE)
endif()
endif()
if (LADYBIRD_USE_LLD AND NOT APPLE)
add_link_options(-fuse-ld=lld)
add_compile_options(-ggnu-pubnames)
add_link_options(LINKER:--gdb-index)
endif()

View file

@ -0,0 +1,33 @@
# 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}/Userland/Libraries)
include_directories(${lagom_SOURCE_DIR})
include_directories(${lagom_BINARY_DIR})
# 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()