Skip to content

Commit

Permalink
Documentation: Update IDE docs to reference CMakePresets.json
Browse files Browse the repository at this point in the history
  • Loading branch information
ADKaster committed Jun 6, 2024
1 parent 6a1a62d commit 1d502df
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 27 deletions.
16 changes: 5 additions & 11 deletions Documentation/CLionConfiguration.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Binary file removed Documentation/CLion_Add_Configuration.png
Binary file not shown.
Binary file removed Documentation/CLion_Add_Configuration_Existing.png
Binary file not shown.
19 changes: 5 additions & 14 deletions Documentation/QtCreatorConfiguration.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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/
```
Expand Down Expand Up @@ -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++`.
10 changes: 8 additions & 2 deletions Documentation/VSCodeConfiguration.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 1d502df

Please sign in to comment.