From 829d11232719534360e2a98315d21f1bf4116888 Mon Sep 17 00:00:00 2001 From: Undefine Date: Fri, 27 Mar 2026 23:04:23 +0100 Subject: [PATCH] Meta: Move Lagom CMakeLists stuff to the top level CMakeLists This allows us to get rid of the annoying Build/.../Lagom directory and helps to deduplicate a bunch of logic while also drastically simplifying everything. --- .github/workflows/lagom-template.yml | 2 +- .github/workflows/libjs-test262.yml | 2 +- CMakeLists.txt | 202 +++++++++++++++- Documentation/CSSGeneratedFiles.md | 2 +- .../QtCreatorConfiguration.md | 6 +- Documentation/Testing.md | 2 +- Meta/Lagom/BuildFuzzers.sh | 8 +- Meta/Lagom/CMakeLists.txt | 222 ------------------ Meta/Lagom/CMakePresets.json | 11 - Meta/Lagom/vcpkg-configuration.json | 10 - Meta/Lagom/vcpkg.json | 1 - Tests/LibTLS/CMakeLists.txt | 2 +- Tests/LibWasm/CMakeLists.txt | 2 +- UI/Android/BuildLagomTools.sh | 2 +- UI/cmake/EnableLagom.cmake | 16 -- 15 files changed, 208 insertions(+), 282 deletions(-) delete mode 100644 Meta/Lagom/CMakeLists.txt delete mode 100644 Meta/Lagom/CMakePresets.json delete mode 100644 Meta/Lagom/vcpkg-configuration.json delete mode 120000 Meta/Lagom/vcpkg.json delete mode 100644 UI/cmake/EnableLagom.cmake diff --git a/.github/workflows/lagom-template.yml b/.github/workflows/lagom-template.yml index f109e067a2..9c273e7481 100644 --- a/.github/workflows/lagom-template.yml +++ b/.github/workflows/lagom-template.yml @@ -146,7 +146,7 @@ jobs: VCPKG_CACHE_SAS: ${{ github.ref == 'refs/heads/master' && secrets.VCPKG_CACHE_SAS || '' }} VCPKG_CACHE_MODE: ${{ github.ref == 'refs/heads/master' && 'write' || '' }} run: | - cmake --preset=Distribution -S Meta/Lagom -B ${{ github.workspace }}/Build/tools-build \ + cmake --preset=Distribution -B ${{ github.workspace }}/Build/tools-build \ -DLAGOM_TOOLS_ONLY=ON \ -DINSTALL_LAGOM_TOOLS=ON \ -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/Build/tools-install \ diff --git a/.github/workflows/libjs-test262.yml b/.github/workflows/libjs-test262.yml index a08254de36..c19be85bac 100644 --- a/.github/workflows/libjs-test262.yml +++ b/.github/workflows/libjs-test262.yml @@ -108,7 +108,7 @@ jobs: - name: Run test-wasm working-directory: libjs-test262 run: | - Build/bin/test-wasm --per-file Build/Lagom/Libraries/LibWasm/Tests > ../libjs-data/wasm/per-file-master.json || true + Build/bin/test-wasm --per-file Build/Libraries/LibWasm/Tests > ../libjs-data/wasm/per-file-master.json || true jq -nc -f /dev/stdin <<-EOF --slurpfile previous ../libjs-data/wasm/results.json --slurpfile details ../libjs-data/wasm/per-file-master.json > wasm-new-results.json \$details[0] as \$details | \$previous[0] + [{ "commit_timestamp": $(git -C .. log -1 --format=%ct), diff --git a/CMakeLists.txt b/CMakeLists.txt index ca5a007113..19d74eacdb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,17 +36,203 @@ endif() set(CMAKE_EXPORT_COMPILE_COMMANDS ON) -set(LADYBIRD_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") -list(APPEND CMAKE_MODULE_PATH "${LADYBIRD_SOURCE_DIR}/Meta/CMake") - -include(UI/cmake/EnableLagom.cmake) -include(cmake_options NO_POLICY_SCOPE) -include(compile_options) - # We need to find OpenSSL in order to link it explicitly with all targets. find_package(OpenSSL REQUIRED) -include(CTest) # for BUILD_TESTING option, default ON +# Ensure that when single-value arguments are passed to `cmake_parse_arguments()` +# with no or empty string arguments, they are still defined. +if (POLICY CMP0174) + cmake_policy(SET CMP0174 NEW) +endif() + +set(LADYBIRD_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") +list(APPEND CMAKE_MODULE_PATH "${LADYBIRD_SOURCE_DIR}/Meta/CMake") + +if(NOT COMMAND ladybird_option) + macro(ladybird_option) + set(${ARGV}) + endmacro() +endif() + +include(check_for_dependencies) +include(gui_framework) +include(cmake_options NO_POLICY_SCOPE) +include(compile_options) + +if(ENABLE_ALL_THE_DEBUG_MACROS) + include(all_the_debug_macros) +endif() + +find_package(Threads REQUIRED) +# FIXME: This global link libraries is required to workaround linker issues (on some systems) +# from the Ladybird import. See https://github.com/SerenityOS/serenity/issues/16847 +link_libraries(Threads::Threads) + +if (ENABLE_LAGOM_CCACHE) + include(setup_ccache) +endif() + +if (ENABLE_FUZZERS_LIBFUZZER OR ENABLE_FUZZERS_OSSFUZZ) + set(ENABLE_FUZZERS ON) +endif() + +# 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. +# The same concern goes for cross-compile builds, where we need the tools built for the host +set(BUILD_LAGOM_TOOLS ON) +if (ENABLE_FUZZERS OR CMAKE_CROSSCOMPILING) + find_package(LagomTools REQUIRED) + set(BUILD_LAGOM_TOOLS OFF) +endif() + +if (ENABLE_COMPILETIME_FORMAT_CHECK) + add_compile_definitions(ENABLE_COMPILETIME_FORMAT_CHECK) +endif() + +add_library(JSClangPlugin INTERFACE) +add_library(GenericClangPlugin INTERFACE) + +if (CMAKE_CXX_COMPILER_ID MATCHES "Clang$") + if (ENABLE_FUZZERS_LIBFUZZER) + add_cxx_compile_options(-fsanitize=fuzzer) + set(LINKER_FLAGS "${LINKER_FLAGS} -fsanitize=fuzzer") + endif() + + # Vanilla host builds only for building the clang plugins + if (ENABLE_CLANG_PLUGINS AND NOT CROSS_COMPILING AND NOT ENABLE_FUZZERS AND NOT ENABLE_COMPILER_EXPLORER_BUILD) + add_subdirectory(Meta/Lagom/ClangPlugins) + depend_on_clang_plugin(JSClangPlugin LibJSGCClangPlugin) + depend_on_clang_plugin(GenericClangPlugin LambdaCaptureClangPlugin) + endif() +elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + if (ENABLE_FUZZERS_LIBFUZZER) + message(FATAL_ERROR + "Fuzzer Sanitizer (-fsanitize=fuzzer) is only supported for Fuzzer targets with LLVM. " + "Reconfigure CMake with -DCMAKE_C_COMPILER and -DCMAKE_CXX_COMPILER pointing to a clang-based toolchain " + "or build binaries without built-in fuzzing support by setting -DENABLE_FUZZERS instead." + ) + endif() +endif() + +# These are here to support Fuzzili builds further down the directory stack +set(ORIGINAL_CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}") +set(ORIGINAL_CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}") +set(ORIGINAL_CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS}") + +set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${LINKER_FLAGS}") +set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${LINKER_FLAGS}") +set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${LINKER_FLAGS}") + +configure_file(AK/Debug.h.in AK/Debug.h @ONLY) + +include_directories(${LADYBIRD_SOURCE_DIR}) +include_directories(Libraries) +include_directories(Services) +include_directories(${CMAKE_BINARY_DIR}) +include_directories(${CMAKE_BINARY_DIR}/Libraries) +include_directories(${CMAKE_BINARY_DIR}/Services) + +# install rules, think about moving to its own helper cmake file +include(CMakePackageConfigHelpers) + +# find_package() call for consumers to find this project +set(package Lagom CACHE STRING "") + +# Allow package maintainers to freely override the path for the configs +set(Lagom_INSTALL_CMAKEDIR "${CMAKE_INSTALL_DATADIR}/${package}" + CACHE PATH "CMake package config location relative to the install prefix") +mark_as_advanced(Lagom_INSTALL_CMAKEDIR) + +install( + FILES "${LADYBIRD_SOURCE_DIR}/Meta/CMake/lagom-install-config.cmake" + DESTINATION "${Lagom_INSTALL_CMAKEDIR}" + RENAME "${package}Config.cmake" + COMPONENT Lagom_Development +) + +install( + EXPORT LagomTargets + NAMESPACE Lagom:: + DESTINATION "${Lagom_INSTALL_CMAKEDIR}" + COMPONENT Lagom_Development +) + +if (WIN32) + find_package(pthread REQUIRED) + find_package(mman REQUIRED) +endif() + +include(rust_crate) +include(targets) + +# Plugins need to be installed in order to be used by non-lagom builds +add_lagom_library_install_rules(GenericClangPlugin) +add_lagom_library_install_rules(JSClangPlugin) + +# Create mostly empty targets for system libraries we don't need to build for Lagom +add_library(NoCoverage INTERFACE) +# "install" these special targets to placate CMake +install(TARGETS NoCoverage EXPORT LagomTargets) + +# AK +add_subdirectory(AK) + +# LibCore dependencies +add_subdirectory(Libraries/LibTextCodec) +add_subdirectory(Libraries/LibUnicode) +add_subdirectory(Libraries/LibRegex) +add_subdirectory(Libraries/LibURL) + +# LibCore +add_subdirectory(Libraries/LibCore) + +# LibMain +add_subdirectory(Libraries/LibMain) + +# LibFileSystem +# This is needed even if Lagom is not enabled because it is depended upon by code generators. +add_subdirectory(Libraries/LibFileSystem) + +# LibIDL +# This is used by the BindingsGenerator so needs to always be built. +add_subdirectory(Libraries/LibIDL) + +# Code Generators and other host tools +if (BUILD_LAGOM_TOOLS) + add_subdirectory(Meta/Lagom/Tools) +endif() + +if (LAGOM_TOOLS_ONLY) + return() +endif() + +# Lagom Libraries +# FIXME: Move these calls to the relevant client library CMakeLists +# Note that the Services themselves are only built if ENABLE_GUI_TARGETS, from top level. +compile_ipc(${LADYBIRD_SOURCE_DIR}/Services/RequestServer/RequestClient.ipc Services/RequestServer/RequestClientEndpoint.h) +compile_ipc(${LADYBIRD_SOURCE_DIR}/Services/RequestServer/RequestServer.ipc Services/RequestServer/RequestServerEndpoint.h) +compile_ipc(${LADYBIRD_SOURCE_DIR}/Services/WebContent/WebContentServer.ipc Services/WebContent/WebContentServerEndpoint.h) +compile_ipc(${LADYBIRD_SOURCE_DIR}/Services/WebContent/WebContentClient.ipc Services/WebContent/WebContentClientEndpoint.h) +compile_ipc(${LADYBIRD_SOURCE_DIR}/Services/WebContent/WebDriverClient.ipc Services/WebContent/WebDriverClientEndpoint.h) +compile_ipc(${LADYBIRD_SOURCE_DIR}/Services/WebContent/WebDriverServer.ipc Services/WebContent/WebDriverServerEndpoint.h) +compile_ipc(${LADYBIRD_SOURCE_DIR}/Services/WebContent/WebUIClient.ipc Services/WebContent/WebUIClientEndpoint.h) +compile_ipc(${LADYBIRD_SOURCE_DIR}/Services/WebContent/WebUIServer.ipc Services/WebContent/WebUIServerEndpoint.h) + +add_subdirectory(Libraries) + +if (ENABLE_FUZZERS) + add_subdirectory(Meta/Lagom/Fuzzers) +endif() + +# No utilities or tests in these configs +if (NOT (ENABLE_FUZZERS OR ENABLE_COMPILER_EXPLORER_BUILD OR ANDROID OR IOS)) + add_subdirectory(Utilities) + + include(CTest) + if (BUILD_TESTING) + add_subdirectory(Tests) + endif() +endif() if (ENABLE_GUI_TARGETS) add_subdirectory(Services) diff --git a/Documentation/CSSGeneratedFiles.md b/Documentation/CSSGeneratedFiles.md index a2a383eac7..b5df8f51d8 100644 --- a/Documentation/CSSGeneratedFiles.md +++ b/Documentation/CSSGeneratedFiles.md @@ -2,7 +2,7 @@ We generate a significant amount of CSS-related code, taking in one or more .json files in [`Libraries/LibWeb/CSS`](../Libraries/LibWeb/CSS) and producing C++ code from them, located in -`Build//Lagom/Libraries/LibWeb/CSS/`. +`Build//Libraries/LibWeb/CSS/`. It's likely that you'll need to work with these if you add or modify a CSS property or its values. The generators are found in [`Meta/Lagom/Tools/CodeGenerators/LibWeb`](../Meta/Lagom/Tools/CodeGenerators/LibWeb). diff --git a/Documentation/EditorConfiguration/QtCreatorConfiguration.md b/Documentation/EditorConfiguration/QtCreatorConfiguration.md index a48b43f9d9..be57bce70b 100644 --- a/Documentation/EditorConfiguration/QtCreatorConfiguration.md +++ b/Documentation/EditorConfiguration/QtCreatorConfiguration.md @@ -24,9 +24,9 @@ First, make sure you have a working toolchain and can build and run Ladybird. Go ./ Libraries/ Services/ - Build/release/Lagom/ - Build/release/Lagom/Libraries/ - Build/release/Lagom/Services/ + Build/release/ + Build/release/Libraries/ + Build/release/Services/ Build/release/vcpkg_installed/x64-linux/include/skia/ AK/ ``` diff --git a/Documentation/Testing.md b/Documentation/Testing.md index 0e03eaa88d..40ca2ebea9 100644 --- a/Documentation/Testing.md +++ b/Documentation/Testing.md @@ -74,7 +74,7 @@ The Sanitizer test preset already sets these environment variables. ```sh export ASAN_OPTIONS='strict_string_checks=1:check_initialization_order=1:strict_init_order=1:detect_stack_use_after_return=1:allocator_may_return_null=1' export UBSAN_OPTIONS='print_stacktrace=1:print_summary=1:halt_on_error=1' -cmake -GNinja -S Meta/Lagom -B Build/lagom -DENABLE_ADDRESS_SANITIZER=ON -DENABLE_UNDEFINED_SANITIZER=ON +cmake -GNinja -B Build/lagom -DENABLE_ADDRESS_SANITIZER=ON -DENABLE_UNDEFINED_SANITIZER=ON cd Build/lagom ninja CTEST_OUTPUT_ON_FAILURE=1 LADYBIRD_SOURCE_DIR=${PWD}/../.. ninja test diff --git a/Meta/Lagom/BuildFuzzers.sh b/Meta/Lagom/BuildFuzzers.sh index 1d7678c81e..0bb6d455de 100755 --- a/Meta/Lagom/BuildFuzzers.sh +++ b/Meta/Lagom/BuildFuzzers.sh @@ -32,7 +32,7 @@ if ! eval "${find_compiler}" ; then die "Unable to determine clang compiler" fi -cmake -GNinja --preset=Distribution -B Build/tools \ +cmake -S ../.. -GNinja --preset=Distribution -B Build/tools \ -DLAGOM_TOOLS_ONLY=ON \ -DINSTALL_LAGOM_TOOLS=ON \ -DCMAKE_CXX_FLAGS="$CXXFLAGS" \ @@ -51,7 +51,7 @@ echo "Building Lagom Fuzzers..." if [ "$#" -gt "0" ] && [ "--oss-fuzz" = "$1" ] ; then echo "Building for oss-fuzz configuration..." - cmake -GNinja -B Build/fuzzers \ + cmake -S ../.. -GNinja -B Build/fuzzers \ -DBUILD_SHARED_LIBS=OFF \ -DENABLE_FUZZERS_OSSFUZZ=ON \ -DFUZZER_DICTIONARY_DIRECTORY="$OUT" \ @@ -64,13 +64,13 @@ if [ "$#" -gt "0" ] && [ "--oss-fuzz" = "$1" ] ; then cp Build/fuzzers/bin/Fuzz* "$OUT"/ elif [ "$#" -gt "0" ] && [ "--standalone" = "$1" ] ; then echo "Building for standalone fuzz configuration..." - cmake -GNinja -B Build/lagom-fuzzers-standalone \ + cmake -S ../.. -GNinja -B Build/lagom-fuzzers-standalone \ -DENABLE_FUZZERS=ON \ -DCMAKE_PREFIX_PATH=Build/tool-install ninja -C Build/lagom-fuzzers-standalone else echo "Building for local fuzz configuration..." - cmake -GNinja --preset Fuzzers -B Build/lagom-fuzzers \ + cmake -S ../.. -GNinja --preset Fuzzers -B Build/lagom-fuzzers \ -DCMAKE_PREFIX_PATH=Build/tool-install \ -DCMAKE_C_COMPILER="${CC}" \ -DCMAKE_CXX_COMPILER="${CXX}" \ diff --git a/Meta/Lagom/CMakeLists.txt b/Meta/Lagom/CMakeLists.txt deleted file mode 100644 index 5be915d1a0..0000000000 --- a/Meta/Lagom/CMakeLists.txt +++ /dev/null @@ -1,222 +0,0 @@ -cmake_minimum_required (VERSION 3.21) - -if (APPLE AND NOT CMAKE_OSX_SYSROOT) - set(CMAKE_OSX_SYSROOT macosx) -endif() - -project( - Lagom - VERSION 0.0.0 - DESCRIPTION "Host build of SerenityOS libraries and applications" - HOMEPAGE_URL "https://github.com/SerenityOS/serenity" - LANGUAGES C CXX -) - -if (${ENABLE_LAGOM_LADYBIRD} OR $CACHE{ENABLE_LAGOM_LADYBIRD}) - message(FATAL_ERROR - "The ENABLE_LAGOM_LADYBIRD option is no longer supported.\n" - "Please use the top-level CMakeLists.txt to enable Ladybird builds.\n") -endif() - -# Ensure that when single-value arguments are passed to `cmake_parse_arguments()` -# with no or empty string arguments, they are still defined. -if (POLICY CMP0174) - cmake_policy(SET CMP0174 NEW) -endif() - -list(APPEND CMAKE_MODULE_PATH "${LADYBIRD_SOURCE_DIR}/Meta/CMake") - -if(NOT COMMAND ladybird_option) - macro(ladybird_option) - set(${ARGV}) - endmacro() -endif() - -include(check_for_dependencies) -include(use_linker) -include(gui_framework) -include(cmake_options NO_POLICY_SCOPE) - -if(ENABLE_ALL_THE_DEBUG_MACROS) - include(all_the_debug_macros) -endif() - -find_package(Threads REQUIRED) -# FIXME: This global link libraries is required to workaround linker issues (on some systems) -# from the Ladybird import. See https://github.com/SerenityOS/serenity/issues/16847 -link_libraries(Threads::Threads) - -if (ENABLE_LAGOM_CCACHE) - include(setup_ccache) -endif() - -if (ENABLE_FUZZERS_LIBFUZZER OR ENABLE_FUZZERS_OSSFUZZ) - set(ENABLE_FUZZERS ON) -endif() - -# 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. -# The same concern goes for cross-compile builds, where we need the tools built for the host -set(BUILD_LAGOM_TOOLS ON) -if (ENABLE_FUZZERS OR CMAKE_CROSSCOMPILING) - find_package(LagomTools REQUIRED) - set(BUILD_LAGOM_TOOLS OFF) -endif() - -include(compile_options) - -set(CMAKE_EXPORT_COMPILE_COMMANDS ON) - -if (ENABLE_COMPILETIME_FORMAT_CHECK) - add_compile_definitions(ENABLE_COMPILETIME_FORMAT_CHECK) -endif() - -add_library(JSClangPlugin INTERFACE) -add_library(GenericClangPlugin INTERFACE) - -if (CMAKE_CXX_COMPILER_ID MATCHES "Clang$") - if (ENABLE_FUZZERS_LIBFUZZER) - add_cxx_compile_options(-fsanitize=fuzzer) - set(LINKER_FLAGS "${LINKER_FLAGS} -fsanitize=fuzzer") - endif() - - # Vanilla host builds only for building the clang plugins - if (ENABLE_CLANG_PLUGINS AND NOT CROSS_COMPILING AND NOT ENABLE_FUZZERS AND NOT ENABLE_COMPILER_EXPLORER_BUILD) - add_subdirectory(ClangPlugins) - depend_on_clang_plugin(JSClangPlugin LibJSGCClangPlugin) - depend_on_clang_plugin(GenericClangPlugin LambdaCaptureClangPlugin) - endif() -elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - if (ENABLE_FUZZERS_LIBFUZZER) - message(FATAL_ERROR - "Fuzzer Sanitizer (-fsanitize=fuzzer) is only supported for Fuzzer targets with LLVM. " - "Reconfigure CMake with -DCMAKE_C_COMPILER and -DCMAKE_CXX_COMPILER pointing to a clang-based toolchain " - "or build binaries without built-in fuzzing support by setting -DENABLE_FUZZERS instead." - ) - endif() -endif() - -# These are here to support Fuzzili builds further down the directory stack -set(ORIGINAL_CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}") -set(ORIGINAL_CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}") -set(ORIGINAL_CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS}") - -set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${LINKER_FLAGS}") -set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${LINKER_FLAGS}") -set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${LINKER_FLAGS}") - -configure_file(../../AK/Debug.h.in AK/Debug.h @ONLY) - -include_directories(../..) -include_directories(../../Libraries) -include_directories(../../Services) -include_directories(${CMAKE_BINARY_DIR}) -include_directories(${CMAKE_CURRENT_BINARY_DIR}) -include_directories(${CMAKE_CURRENT_BINARY_DIR}/Libraries) -include_directories(${CMAKE_CURRENT_BINARY_DIR}/Services) - -# install rules, think about moving to its own helper cmake file -include(CMakePackageConfigHelpers) - -# find_package() call for consumers to find this project -set(package Lagom CACHE STRING "") - -# Allow package maintainers to freely override the path for the configs -set(Lagom_INSTALL_CMAKEDIR "${CMAKE_INSTALL_DATADIR}/${package}" - CACHE PATH "CMake package config location relative to the install prefix") -mark_as_advanced(Lagom_INSTALL_CMAKEDIR) - -install( - FILES "${LADYBIRD_SOURCE_DIR}/Meta/CMake/lagom-install-config.cmake" - DESTINATION "${Lagom_INSTALL_CMAKEDIR}" - RENAME "${package}Config.cmake" - COMPONENT Lagom_Development -) - -install( - EXPORT LagomTargets - NAMESPACE Lagom:: - DESTINATION "${Lagom_INSTALL_CMAKEDIR}" - COMPONENT Lagom_Development -) - -if (WIN32) - find_package(pthread REQUIRED) - find_package(mman REQUIRED) -endif() - -include(rust_crate) -include(targets) - -# Plugins need to be installed in order to be used by non-lagom builds -add_lagom_library_install_rules(GenericClangPlugin) -add_lagom_library_install_rules(JSClangPlugin) - -# Create mostly empty targets for system libraries we don't need to build for Lagom -add_library(NoCoverage INTERFACE) -# "install" these special targets to placate CMake -install(TARGETS NoCoverage EXPORT LagomTargets) - -# AK -add_ladybird_subdirectory(AK) - -# LibCore dependencies -add_ladybird_subdirectory(Libraries/LibTextCodec) -add_ladybird_subdirectory(Libraries/LibUnicode) -add_ladybird_subdirectory(Libraries/LibRegex) -add_ladybird_subdirectory(Libraries/LibURL) - -# LibCore -add_ladybird_subdirectory(Libraries/LibCore) - -# LibMain -add_ladybird_subdirectory(Libraries/LibMain) - -# LibFileSystem -# This is needed even if Lagom is not enabled because it is depended upon by code generators. -add_ladybird_subdirectory(Libraries/LibFileSystem) - -# LibIDL -# This is used by the BindingsGenerator so needs to always be built. -add_ladybird_subdirectory(Libraries/LibIDL) - -# Code Generators and other host tools -if (BUILD_LAGOM_TOOLS) - add_subdirectory(Tools) -endif() - -if (LAGOM_TOOLS_ONLY) - return() -endif() - -# Lagom Libraries -# FIXME: Move these calls to the relevant client library CMakeLists -# Note that the Services themselves are only built if ENABLE_GUI_TARGETS, from top level. -compile_ipc(${LADYBIRD_SOURCE_DIR}/Services/RequestServer/RequestClient.ipc Services/RequestServer/RequestClientEndpoint.h) -compile_ipc(${LADYBIRD_SOURCE_DIR}/Services/RequestServer/RequestServer.ipc Services/RequestServer/RequestServerEndpoint.h) -compile_ipc(${LADYBIRD_SOURCE_DIR}/Services/WebContent/WebContentServer.ipc Services/WebContent/WebContentServerEndpoint.h) -compile_ipc(${LADYBIRD_SOURCE_DIR}/Services/WebContent/WebContentClient.ipc Services/WebContent/WebContentClientEndpoint.h) -compile_ipc(${LADYBIRD_SOURCE_DIR}/Services/WebContent/WebDriverClient.ipc Services/WebContent/WebDriverClientEndpoint.h) -compile_ipc(${LADYBIRD_SOURCE_DIR}/Services/WebContent/WebDriverServer.ipc Services/WebContent/WebDriverServerEndpoint.h) -compile_ipc(${LADYBIRD_SOURCE_DIR}/Services/WebContent/WebUIClient.ipc Services/WebContent/WebUIClientEndpoint.h) -compile_ipc(${LADYBIRD_SOURCE_DIR}/Services/WebContent/WebUIServer.ipc Services/WebContent/WebUIServerEndpoint.h) - -add_ladybird_subdirectory(Libraries) - -if (ENABLE_FUZZERS) - add_subdirectory(Fuzzers) -endif() - -# No utilities or tests in these configs -if (ENABLE_FUZZERS OR ENABLE_COMPILER_EXPLORER_BUILD OR ANDROID OR IOS) - return() -endif() - -# Lagom Utilities -add_ladybird_subdirectory(Utilities) - -# Tests -include(CTest) -if (BUILD_TESTING) - add_ladybird_subdirectory(Tests) -endif() diff --git a/Meta/Lagom/CMakePresets.json b/Meta/Lagom/CMakePresets.json deleted file mode 100644 index 6939dbdaf8..0000000000 --- a/Meta/Lagom/CMakePresets.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "version": 6, - "cmakeMinimumRequired": { - "major": 3, - "minor": 21, - "patch": 0 - }, - "include": [ - "../../CMakePresets.json" - ] -} diff --git a/Meta/Lagom/vcpkg-configuration.json b/Meta/Lagom/vcpkg-configuration.json deleted file mode 100644 index 0cc5bcb0c7..0000000000 --- a/Meta/Lagom/vcpkg-configuration.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "registries": [ - { - "kind": "artifact", - "location": "https://github.com/microsoft/vcpkg-ce-catalog/archive/refs/heads/main.zip", - "name": "microsoft" - } - ], - "overlay-ports": [ "../../Meta/CMake/vcpkg/overlay-ports" ] -} diff --git a/Meta/Lagom/vcpkg.json b/Meta/Lagom/vcpkg.json deleted file mode 120000 index fa268e15ef..0000000000 --- a/Meta/Lagom/vcpkg.json +++ /dev/null @@ -1 +0,0 @@ -../../vcpkg.json \ No newline at end of file diff --git a/Tests/LibTLS/CMakeLists.txt b/Tests/LibTLS/CMakeLists.txt index 92119e787d..0904d81f77 100644 --- a/Tests/LibTLS/CMakeLists.txt +++ b/Tests/LibTLS/CMakeLists.txt @@ -4,5 +4,5 @@ set(TEST_SOURCES ) foreach(source IN LISTS TEST_SOURCES) - lagom_test("${source}" LibTLS LIBS LibTLS LibCrypto WORKING_DIRECTORY ${Lagom_BINARY_DIR}) + lagom_test("${source}" LibTLS LIBS LibTLS LibCrypto WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) endforeach() diff --git a/Tests/LibWasm/CMakeLists.txt b/Tests/LibWasm/CMakeLists.txt index 74ab17748e..a6bc9b241a 100644 --- a/Tests/LibWasm/CMakeLists.txt +++ b/Tests/LibWasm/CMakeLists.txt @@ -2,7 +2,7 @@ add_executable(test-wasm test-wasm.cpp) target_link_libraries(test-wasm AK LibCore LibFileSystem JavaScriptTestRunnerMain LibTest LibWasm LibJS LibCrypto LibGC) set(wasm_test_root "${LADYBIRD_SOURCE_DIR}") if (INCLUDE_WASM_SPEC_TESTS) - set(wasm_test_root "${Lagom_BINARY_DIR}") + set(wasm_test_root "${CMAKE_BINARY_DIR}") endif() add_test( NAME Wasm diff --git a/UI/Android/BuildLagomTools.sh b/UI/Android/BuildLagomTools.sh index 2331f73b43..4899d5c1e6 100755 --- a/UI/Android/BuildLagomTools.sh +++ b/UI/Android/BuildLagomTools.sh @@ -29,7 +29,7 @@ export XDG_CACHE_HOME="$CACHE_DIR" "$LADYBIRD_SOURCE_DIR"/Meta/ladybird.py vcpkg -cmake -S "${LADYBIRD_SOURCE_DIR}/Meta/Lagom" -B "$BUILD_DIR/lagom-tools" \ +cmake -S "${LADYBIRD_SOURCE_DIR}" -B "$BUILD_DIR/lagom-tools" \ -GNinja -Dpackage=LagomTools \ -DCMAKE_INSTALL_PREFIX="$BUILD_DIR/lagom-tools-install" \ -DCMAKE_C_COMPILER="$CC" \ diff --git a/UI/cmake/EnableLagom.cmake b/UI/cmake/EnableLagom.cmake deleted file mode 100644 index 2621135b60..0000000000 --- a/UI/cmake/EnableLagom.cmake +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright (c) 2021, Andrew Kaster -# -# SPDX-License-Identifier: MIT - -set(LAGOM_SOURCE_DIR "${LADYBIRD_SOURCE_DIR}/Meta/Lagom") -set(LAGOM_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/Lagom") - -# FIXME: Setting target_include_directories on Lagom libraries might make this unnecessary? -include_directories(${LADYBIRD_SOURCE_DIR}) -include_directories(${LADYBIRD_SOURCE_DIR}/Services) -include_directories(${LADYBIRD_SOURCE_DIR}/Libraries) -include_directories(${LAGOM_BINARY_DIR}) -include_directories(${LAGOM_BINARY_DIR}/Services) -include_directories(${LAGOM_BINARY_DIR}/Libraries) - -add_subdirectory("${LAGOM_SOURCE_DIR}" "${LAGOM_BINARY_DIR}")