From 0384513779613b04f55ef305514d7624681aab5d Mon Sep 17 00:00:00 2001 From: Andrew Kaster Date: Fri, 23 Dec 2022 11:36:45 -0700 Subject: [PATCH] Lagom: Add option to build Ladybird as part of a Lagom build This means that Ladybird can be built with either Meta/Lagom or Ladybird as the top-level source directory. This setup is a bit awkward, but will preserve the packaging story for Ladybird until we come up with a more permanent solution. --- Meta/CMake/lagom_options.cmake | 1 + Meta/Lagom/CMakeLists.txt | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/Meta/CMake/lagom_options.cmake b/Meta/CMake/lagom_options.cmake index 7789ca234d..c37d889d38 100644 --- a/Meta/CMake/lagom_options.cmake +++ b/Meta/CMake/lagom_options.cmake @@ -12,3 +12,4 @@ serenity_option(ENABLE_FUZZERS_OSSFUZZ OFF CACHE BOOL "Build OSS-Fuzz compatible serenity_option(BUILD_LAGOM OFF CACHE BOOL "Build parts of the system targeting the host OS for fuzzing/testing") serenity_option(ENABLE_LAGOM_CCACHE ON CACHE BOOL "Enable ccache for Lagom builds") serenity_option(ENABLE_LAGOM_LIBWEB ON CACHE BOOL "Enable compiling LibWeb for Lagom builds") +serenity_option(ENABLE_LAGOM_LADYBIRD OFF CACHE BOOL "Enable compiling Ladybird from Lagom") diff --git a/Meta/Lagom/CMakeLists.txt b/Meta/Lagom/CMakeLists.txt index 2e8dd8d46e..dbf2aefed2 100644 --- a/Meta/Lagom/CMakeLists.txt +++ b/Meta/Lagom/CMakeLists.txt @@ -42,6 +42,11 @@ if(ENABLE_ALL_THE_DEBUG_MACROS) include(all_the_debug_macros) endif() +# FIXME: Is it worth inventing `serenity_dependent_option` ? +if (ENABLE_LAGOM_LADYBIRD) + set(ENABLE_LAGOM_LIBWEB ON CACHE BOOL "" FORCE) +endif() + # FIXME: BUILD_SHARED_LIBS has a default of OFF, as it's intended to be set by the # user when configuring the project. We should instead change libjs-test262 # and oss-fuzz to set this option on their end, and enable it by default in @@ -115,6 +120,13 @@ if (ENABLE_FUZZERS) add_compile_options(-fno-omit-frame-pointer) endif() +if (ENABLE_LAGOM_LADYBIRD AND (ENABLE_FUZZERS OR ENABLE_COMPILER_EXPLORER_BUILD)) + message(FATAL_ERROR + "Ladybird build not supported for Fuzzers or Compiler Explorer." + "Disable ENABLE_LAGOM_LADYBIRD and try again." + ) +endif() + if (CMAKE_CXX_COMPILER_ID MATCHES "Clang$") # Clang's default constexpr-steps limit is 1048576(2^20), GCC doesn't have one add_compile_options(-Wno-overloaded-virtual -Wno-user-defined-literals -fconstexpr-steps=16777216) @@ -441,6 +453,10 @@ if (BUILD_LAGOM) add_serenity_subdirectory(Userland/Shell) + if (ENABLE_LAGOM_LADYBIRD) + add_serenity_subdirectory(Ladybird) + endif() + if (NOT ENABLE_FUZZERS AND NOT ENABLE_COMPILER_EXPLORER_BUILD AND NOT ANDROID) # Lagom Services add_serenity_subdirectory(Userland/Services)