clang: Migrate to `CMake`, dropping `bear`.

pull/1/head
Joshua Potter 2023-12-19 15:36:21 -07:00
parent d1d383a5a7
commit 4a0f1aa919
4 changed files with 26 additions and 6 deletions

View File

@ -10,7 +10,7 @@ STAGED=$(
TARGETS=()
while IFS= read -r FILENAME
do
if [[ "$FILENAME" =~ .*\.c$ ]] || [[ "$FILENAME" =~ .*\.h$ ]]; then
if [[ "$FILENAME" =~ .*\.c(pp)?$ ]] || [[ "$FILENAME" =~ .*\.h(pp)?$ ]]; then
TARGETS+=("${FILENAME}")
fi
done <<< "$STAGED"

View File

@ -4,9 +4,6 @@
# Directory used by `direnv` to hold `use flake`-generated profiles.
/.direnv/
# The compilation database produced by `bear`.
/compile_commands.json
# The directory containing all build outputs.
/dist/
@ -15,3 +12,19 @@
# A symlink produced by default when running `nix build`.
/result
# The default executable built.
/a.out
# Files generated by CMake.
CMakeLists.txt.user
CMakeCache.txt
CMakeFiles
CMakeScripts
Testing
Makefile
cmake_install.cmake
install_manifest.txt
compile_commands.json
CTestTestfile.cmake
_deps

View File

@ -0,0 +1,7 @@
cmake_minimum_required(VERSION 3.15)
project(App VERSION 0.1.0)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
add_executable(a.out main.c)

View File

@ -15,7 +15,7 @@
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
};
outputs = { self, nixpkgs, flake-utils, ... }:
outputs = { nixpkgs, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
@ -30,8 +30,8 @@
stdenv = pkgs.clangStdenv;
} {
packages = with pkgs; [
bear
clang-tools
cmake
codelldb
doxygen
];