From da2e47ff862672c8fba3b3be9502d182172fa62b Mon Sep 17 00:00:00 2001 From: Toast Date: Thu, 14 Mar 2024 10:17:35 +0100 Subject: [PATCH 1/4] Add clang-tools to nix devshell --- flake.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/flake.nix b/flake.nix index a8057dd..cf6e490 100644 --- a/flake.nix +++ b/flake.nix @@ -16,6 +16,7 @@ name = "3ds-devshell"; packages = with nixpkgs.legacyPackages.${system}; [ gnumake + clang-tools ]; shellHook = '' export DEVKITPRO=${devkitARM} From 06332ac6982b344037a1e3e88b9bee1609982ca7 Mon Sep 17 00:00:00 2001 From: Toast Date: Thu, 14 Mar 2024 11:12:46 +0100 Subject: [PATCH 2/4] Ignore clang cache --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index d4fb4cf..323e656 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ # Nix/NixOS things result result-* + +# Clangd cache +.cache/clangd From 99102c2c093d9d2e5b10dd28e0b6ddd305034e82 Mon Sep 17 00:00:00 2001 From: Toast Date: Thu, 14 Mar 2024 11:22:11 +0100 Subject: [PATCH 3/4] Add clangd script to devshell --- flake.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/flake.nix b/flake.nix index cf6e490..8a7617f 100644 --- a/flake.nix +++ b/flake.nix @@ -17,6 +17,12 @@ packages = with nixpkgs.legacyPackages.${system}; [ gnumake clang-tools + ( + writeShellScriptBin "generateClangCompileCommands" '' + make clean + ${bear}/bin/bear -- make + '' + ) ]; shellHook = '' export DEVKITPRO=${devkitARM} From 2356375ced7954dc771d9a294bfeb930f4b6c49e Mon Sep 17 00:00:00 2001 From: Toast Date: Thu, 14 Mar 2024 11:22:43 +0100 Subject: [PATCH 4/4] Add clang compile_commands.json --- compile_commands.json | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 compile_commands.json diff --git a/compile_commands.json b/compile_commands.json new file mode 100644 index 0000000..457ae32 --- /dev/null +++ b/compile_commands.json @@ -0,0 +1,27 @@ +[ + { + "arguments": [ + "/nix/store/8nfqxz8d7ramdmc1h7yvnm45cghkknls-devkitARM/devkitARM/bin/arm-none-eabi-gcc", + "-g", + "-Wall", + "-O2", + "-mword-relocations", + "-ffunction-sections", + "-march=armv6k", + "-mtune=mpcore", + "-mfloat-abi=hard", + "-mtp=soft", + "-I/home/toast/Documents/Repos/3ds-helloWorld/include", + "-I/nix/store/8nfqxz8d7ramdmc1h7yvnm45cghkknls-devkitARM/libctru/include", + "-I/home/toast/Documents/Repos/3ds-helloWorld/build", + "-D__3DS__", + "-c", + "-o", + "main.o", + "/home/toast/Documents/Repos/3ds-helloWorld/source/main.c" + ], + "directory": "/home/toast/Documents/Repos/3ds-helloWorld/build", + "file": "/home/toast/Documents/Repos/3ds-helloWorld/source/main.c", + "output": "/home/toast/Documents/Repos/3ds-helloWorld/build/main.o" + } +]