Documentation: Update IDE docs to reference CMakePresets.json

This commit is contained in:
Andrew Kaster 2024-06-04 15:30:09 -06:00 committed by Andrew Kaster
parent 6a1a62d9b6
commit 1d502dfd7c
5 changed files with 18 additions and 27 deletions

View File

@ -2,19 +2,13 @@
CLion can integrate with CMake to provide code comprehension features.
After opening the `ladybird` repository in CLion as a new project, the "`Open Project Wizard`" window will open, from here set the following fields:
After opening the `ladybird` repository in CLion as a new project, the "`Open Project Wizard`" window will open.
(Assuming you use `Ninja` as the build system and configured the CMake build directory to `Build/ladybird`)
Select the `default` Preset in the `Settings -> Build, Execution and Deployment -> CMake` window and click the `Enable Profile` checkbox.
`CMake Options`:
```
-DSERENITY_CACHE_DIR=$CMakeProjectDir$/Build/caches
-GNinja
```
`Build Directory`: `Build/ladybird`
If you already have the project open, you can go to `File -> Settings -> Build, Execution, Deployment -> CMake` to find these options.
If the build complains that there is no `Default` Toolchain, go to the `Settings -> Build, Execution and Deployment -> Toolchains`
tab and copy the currently defaulted host toolchain and rename it to `Default`. Make sure that the compiler chosen has a version of
at least gcc-13 or clang-17.
## Excluding Build Artifacts

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -16,11 +16,8 @@ First, make sure you have a working toolchain and can build and run Ladybird. Go
* Add the following `#define`s to the file:
```
#define ENABLE_UNICODE_DATA 1
//#define ENABLE_COMPILETIME_FORMAT_CHECK
#define __serenity__
#define ENABLE_COMPILETIME_FORMAT_CHECK
#define SANITIZE_PTRS 1
#define __SSE__
```
* Edit the `ladybird.cxxflags` file to say `-std=c++23 -fsigned-char -fconcepts -fno-exceptions -fno-semantic-interposition -fPIC`
* Edit the `ladybird.includes` file to list the following lines:
@ -29,11 +26,10 @@ First, make sure you have a working toolchain and can build and run Ladybird. Go
Userland/
Userland/Libraries/
Userland/Services/
Toolchain/Local/x86_64/x86_64-pc-serenity/include/c++/13.1.0
Build/x86_64/
Build/x86_64/Userland/
Build/x86_64/Userland/Libraries/
Build/x86_64/Userland/Services/
Build/ladybird/
Build/ladybird/Userland/
Build/ladybird/Userland/Libraries/
Build/ladybird/Userland/Services/
AK/
```
@ -87,8 +83,3 @@ In QtCreator, select the menu "Tools", item "Options", section "C++", tab
"File Naming" (don't ask me why it's here). At the bottom there should be the
option "License template:". Click "Browse…", select your file (i.e.,
`license-template.creator`). Click "OK", and you're done! :)
## Compiler Kits
You can slightly improve how well Qt interprets the code by adding and setting up an appropriate "compiler kit".
For that you will need to reference the compilers at `Toolchain/Local/x86_64/bin/x86_64-pc-serenity-gcc` and `Toolchain/Local/x86_64/bin/x86_64-pc-serenity-g++`.

View File

@ -6,12 +6,18 @@ The WSL Remote extension allows you to use VS Code in Windows while using the no
The recommended extensions for VS Code include:
- [CMake Tools](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cmake-tools)
- [clangd](https://marketplace.visualstudio.com/items?itemName=llvm-vs-code-extensions.vscode-clangd)
- [GitLens](https://marketplace.visualstudio.com/items?itemName=eamodio.gitlens)
## Configuration
The CMake Tools plugin should automatically detect the `CMakePresets.json` at the root of the repository.
Selecting and activating the `default` preset should be enough to get started.
## Code comprehension
Clangd has the best support for cross-compiling workflows, especially if configured as noted below. The Microsoft C/C++ tools can work, but require a lot more configuration and may not understand the sysroot in use.
Clangd has the best support for modern compilers, especially if configured as noted below. The Microsoft C/C++ tools can work, but may require more configuration.
### clangd
@ -126,7 +132,7 @@ These belong in the `.vscode/settings.json` of Serenity.
"Toolchain/Build/**": true,
"Build/**": true,
},
// Force clang-format to respect Serenity's .clang-format style file. This is not necessary if you're not using the Microsoft C++ extension.
// Force clang-format to respect Ladybird's .clang-format style file. This is not necessary if you're not using the Microsoft C++ extension.
"C_Cpp.clang_format_style": "file",
// Tab settings
"editor.tabSize": 4,