Add compile_commands.json support
This commit is contained in:
parent
cc107f975c
commit
5e86f3ccb9
4 changed files with 36 additions and 7 deletions
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
.cache
|
||||||
|
compile_commands.json
|
||||||
2
Makefile
2
Makefile
|
|
@ -7,7 +7,7 @@ TARGET = connect4
|
||||||
CFILES = main.c connect4.c
|
CFILES = main.c connect4.c
|
||||||
OFILES = ${CFILES:.c=.o}
|
OFILES = ${CFILES:.c=.o}
|
||||||
|
|
||||||
all: ${OFILES}
|
connect4: ${OFILES}
|
||||||
$(CC) $(CFLAGS) -o ${TARGET} ${OFILES}
|
$(CC) $(CFLAGS) -o ${TARGET} ${OFILES}
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
|
|
||||||
17
flake.lock
generated
17
flake.lock
generated
|
|
@ -1,5 +1,21 @@
|
||||||
{
|
{
|
||||||
"nodes": {
|
"nodes": {
|
||||||
|
"mini-compile-commands": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1689962671,
|
||||||
|
"narHash": "sha256-qPyV3iU8rXhIlHEELAtu2UwXtdZgsWMK9dHySlVa8Jo=",
|
||||||
|
"owner": "danielbarter",
|
||||||
|
"repo": "mini_compile_commands",
|
||||||
|
"rev": "073ad72d27287f3e8073c3ef0c9069223fb2048c",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "danielbarter",
|
||||||
|
"repo": "mini_compile_commands",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1720768451,
|
"lastModified": 1720768451,
|
||||||
|
|
@ -17,6 +33,7 @@
|
||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
|
"mini-compile-commands": "mini-compile-commands",
|
||||||
"nixpkgs": "nixpkgs"
|
"nixpkgs": "nixpkgs"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
22
flake.nix
22
flake.nix
|
|
@ -3,9 +3,13 @@
|
||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "nixpkgs/nixos-unstable";
|
nixpkgs.url = "nixpkgs/nixos-unstable";
|
||||||
|
mini-compile-commands = {
|
||||||
|
url = "github:danielbarter/mini_compile_commands";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixpkgs }:
|
outputs = { self, nixpkgs, mini-compile-commands }:
|
||||||
let
|
let
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
pkgs = nixpkgs.legacyPackages.${system};
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
|
|
@ -14,13 +18,19 @@
|
||||||
gnumake
|
gnumake
|
||||||
gcc
|
gcc
|
||||||
gdb
|
gdb
|
||||||
# clang_16
|
clang_16
|
||||||
# clang-tools_16
|
clang-tools_16
|
||||||
# lld_16
|
lld_16
|
||||||
# llvmPackages_16.libllvm
|
llvmPackages_16.libllvm
|
||||||
|
|
||||||
|
cmake
|
||||||
|
gtest
|
||||||
];
|
];
|
||||||
in {
|
in {
|
||||||
devShells.${system}.default = pkgs.mkShell {
|
devShells.${system}.default =
|
||||||
|
with import nixpkgs { system = "${system}"; };
|
||||||
|
let mcc-env = (callPackage mini-compile-commands {}).wrap stdenv;
|
||||||
|
in (pkgs.mkShell.override {stdenv = mcc-env;}) {
|
||||||
buildInputs = libs;
|
buildInputs = libs;
|
||||||
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath libs;
|
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath libs;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue