Skip to content

Commit

Permalink
Add clangd instructions (n)vim (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinschweikert authored Oct 24, 2024
1 parent c870fae commit f9469b4
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,6 @@ xav-*.tar
.vscode/
ffmpeg_build/
.elixir_ls/
_dialyzer/
_dialyzer/
.cache/
compile_commands.json
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,26 @@ batch = Nx.Batch.concatenate(frames)
batch = Nx.Defn.jit_apply(&Function.identity/1, [batch])
Nx.Serving.run(serving, batch)
```

## Development

To make `clangd` aware of the header files used in your project, you can create a `compile_commands.json` file.
`clangd` uses this file to know the compiler flags, include paths, and other compilation options for each source file.

### Install bear

The easiest way to generate `compile_commands.json` from a Makefile is to use the `bear` tool. `bear` is a tool that records the compiler calls during a build and creates the `compile_commands.json` file.

You can install `bear` with your package manager:

- __macOS__: brew install bear
- __Ubuntu/Debian__: sudo apt install bear
- __Fedora__: sudo dnf install bear

### Generate compile_commands.json

After installing bear, you can run it alongside your make command to capture the necessary information.

```bash
bear -- mix compile
```
1 change: 0 additions & 1 deletion c_src/xav/reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include <stdlib.h>
#include <string.h>

#include "audio_converter.h"
#include "utils.h"

struct Reader {
Expand Down

0 comments on commit f9469b4

Please sign in to comment.