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

Meta: Add support for declaring components

Components are a group of build targets that can be built and installed
separately. Whether a component should be built can be configured with
CMake arguments: -DBUILD_<NAME>=ON|OFF, where <NAME> is the name of the
component (in all caps).

Components can be marked as REQUIRED if they're necessary for a
minimally functional base system or they can be marked as RECOMMENDED
if they're not strictly necessary but are useful for most users.

A component can have an optional description which isn't used by the
build system but may be useful for a configuration UI.

Components specify the TARGETS which should be built when the component
is enabled. They can also specify other components which they depend on
(with DEPENDS).

This also adds the BUILD_EVERYTHING CMake variable which lets the user
build all optional components. For now this defaults to ON to make the
transition to the components-based build system easier.

The list of components is exported as an INI file in the build directory
(e.g. Build/i686/components.ini).

Fixes #8048.
This commit is contained in:
Gunnar Beutner 2021-06-15 15:07:25 +02:00 committed by Andreas Kling
parent 70697a5999
commit 0dd03413d6
4 changed files with 105 additions and 9 deletions

View file

@ -260,11 +260,23 @@ if (ENABLE_UNDEFINED_SANITIZER)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-sanitize=vptr")
endif()
add_custom_target(components ALL)
option(BUILD_EVERYTHING "Build all optional components" ON)
include(${CMAKE_SOURCE_DIR}/Meta/CMake/utils.cmake)
serenity_component(
Tests
RECOMMENDED
)
add_subdirectory(AK)
add_subdirectory(Kernel)
add_subdirectory(Userland)
add_subdirectory(Tests)
export_components("${CMAKE_BINARY_DIR}/components.ini")
set(PCI_IDS_GZ_URL https://pci-ids.ucw.cz/v2.2/pci.ids.gz)
set(PCI_IDS_GZ_PATH ${CMAKE_BINARY_DIR}/pci.ids.gz)
set(PCI_IDS_PATH ${CMAKE_BINARY_DIR}/pci.ids)