mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-25 17:25:08 +02:00
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.
This commit is contained in:
Notes:
github-actions[bot]
2026-03-29 20:00:52 +00:00
Author: https://github.com/cqundefine Commit: https://github.com/LadybirdBrowser/ladybird/commit/829d1123271 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/8650 Reviewed-by: https://github.com/ADKaster ✅ Reviewed-by: https://github.com/spholz
2
.github/workflows/lagom-template.yml
vendored
2
.github/workflows/lagom-template.yml
vendored
@@ -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 \
|
||||
|
||||
2
.github/workflows/libjs-test262.yml
vendored
2
.github/workflows/libjs-test262.yml
vendored
@@ -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),
|
||||
|
||||
202
CMakeLists.txt
202
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(<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)
|
||||
|
||||
@@ -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/<build-preset>/Lagom/Libraries/LibWeb/CSS/`.
|
||||
`Build/<build-preset>/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).
|
||||
|
||||
@@ -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/
|
||||
```
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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}" \
|
||||
|
||||
@@ -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(<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()
|
||||
@@ -1,11 +0,0 @@
|
||||
{
|
||||
"version": 6,
|
||||
"cmakeMinimumRequired": {
|
||||
"major": 3,
|
||||
"minor": 21,
|
||||
"patch": 0
|
||||
},
|
||||
"include": [
|
||||
"../../CMakePresets.json"
|
||||
]
|
||||
}
|
||||
@@ -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" ]
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
../../vcpkg.json
|
||||
@@ -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()
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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" \
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
# Copyright (c) 2021, Andrew Kaster <akaster@serenityos.org>
|
||||
#
|
||||
# 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}")
|
||||
Reference in New Issue
Block a user