From f9469b4f272b68b18b61ca6f95d21d660e3b0a58 Mon Sep 17 00:00:00 2001 From: Kevin Schweikert <54439512+kevinschweikert@users.noreply.github.com> Date: Thu, 24 Oct 2024 15:43:49 +0200 Subject: [PATCH] Add `clangd` instructions (n)vim (#17) --- .gitignore | 4 +++- README.md | 23 +++++++++++++++++++++++ c_src/xav/reader.h | 1 - 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index f2c13ff..c8a1769 100644 --- a/.gitignore +++ b/.gitignore @@ -28,4 +28,6 @@ xav-*.tar .vscode/ ffmpeg_build/ .elixir_ls/ -_dialyzer/ \ No newline at end of file +_dialyzer/ +.cache/ +compile_commands.json diff --git a/README.md b/README.md index f37362f..6eb6e8c 100644 --- a/README.md +++ b/README.md @@ -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 +``` diff --git a/c_src/xav/reader.h b/c_src/xav/reader.h index 9b15706..29b4de6 100644 --- a/c_src/xav/reader.h +++ b/c_src/xav/reader.h @@ -10,7 +10,6 @@ #include #include -#include "audio_converter.h" #include "utils.h" struct Reader {