diff options
author | Daniel Bertalan <dani@danielbertalan.dev> | 2021-05-15 01:55:36 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-15 00:55:36 +0100 |
commit | 00498e0405a03ca5b6daf4cce8a3eae6f98a150f (patch) | |
tree | 56387ef4bc4623c9f7faa619a52465ee6766a1e3 /Documentation | |
parent | 5864aab87a1bd609cf5ebc492e37abd48ae8b88e (diff) | |
download | serenity-00498e0405a03ca5b6daf4cce8a3eae6f98a150f.zip |
Documentation: Document CMake build options
Closes #7107.
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/BuildInstructions.md | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/Documentation/BuildInstructions.md b/Documentation/BuildInstructions.md index 497cbb66ca..8a47ed331f 100644 --- a/Documentation/BuildInstructions.md +++ b/Documentation/BuildInstructions.md @@ -239,6 +239,30 @@ Outside of QEMU, Serenity will run on VirtualBox and VMware. If you're curious, Later on, when you `git pull` to get the latest changes, there's (usually) no need to rebuild the toolchain. You can simply run `ninja install`, `ninja image`, and `ninja run` again. CMake will only rebuild those parts that have been updated. +### CMake build options + +There are some optional features that can be enabled during compilation that are intended to help with specific types of development work or introduce experimental features. Currently, the following build options are available: +- `ENABLE_ADDRESS_SANITIZER` and `ENABLE_KERNEL_ADDRESS_SANITIZER`: builds in runtime checks for memory corruption bugs (like buffer overflows and memory leaks) in Lagom test cases and the kernel, respectively. +- `ENABLE_MEMORY_SANITIZER`: enables runtime checks for uninitialized memory accesses in Lagom test cases. +- `ENABLE_UNDEFINED_SANITIZER`: builds in runtime checks for [undefined behavior](https://en.wikipedia.org/wiki/Undefined_behavior) (like null pointer dereferences and signed integer overflows) in Lagom test cases. +- `ENABLE_FUZZER_SANITIZER`: builds [fuzzers](https://en.wikipedia.org/wiki/Fuzzing) for various parts of the system. +- `ENABLE_ALL_THE_DEBUG_MACROS`: used for checking whether debug code compiles on CI. This should not be set normally, as it clutters the console output and makes the system run very slowly. Instead, enable only the needed debug macros, as described below. +- `ENABLE_COMPILETIME_FORMAT_CHECK`: checks for the validity of `std::format`-style format string during compilation. Enabled by default. +- `ENABLE_PCI_IDS_DOWNLOAD`: downloads the [`pci.ids` database](https://pci-ids.ucw.cz/) that contains information about PCI devices at build time, if not already present. Enabled by default. +- `BUILD_LAGOM`: builds [Lagom](../Meta/Lagom/ReadMe.md), which makes various SerenityOS libraries and programs available on the host system. +- `PRECOMPILE_COMMON_HEADERS`: precompiles some common headers to speedup compilation. +- `ENABLE_KERNEL_LTO`: builds the kernel with link-time optimization. + +Many parts of the SerenityOS codebase have debug functionality, mostly consisting of additional messages printed to the debug console. This is done via the `<component_name>_DEBUG` macros, which can be enabled individually at build time. They are listed in [this file](../Meta/CMake/all_the_debug_macros.cmake). + +To toggle a build option, add it to the `cmake` command invocation with a `-D` prefix. To enable it, add `=ON` at the end, or add `=OFF` to disable it. The complete command should look similarly to this: + +```console +$ cmake ../.. -G Ninja -DPROCESS_DEBUG=ON -DENABLE_PCI_IDS_DOWNLOAD=OFF +``` + +For the changes to take effect, SerenityOS needs to be recompiled and the disk image needs to be rebuilt. + ## Ports To add a package from the ports collection to Serenity, for example curl, go into `Ports/curl/` and run `./package.sh`. The sourcecode for the package will be downloaded and the package will be built. After that, rebuild the disk image. The next time you start Serenity, `curl` will be available. |