diff --git a/specs/clang/template/.githooks/pre-commit b/specs/clang/template/.githooks/pre-commit index aefe06d..69db1d4 100755 --- a/specs/clang/template/.githooks/pre-commit +++ b/specs/clang/template/.githooks/pre-commit @@ -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" diff --git a/specs/clang/template/.gitignore b/specs/clang/template/.gitignore index 731f196..2691046 100644 --- a/specs/clang/template/.gitignore +++ b/specs/clang/template/.gitignore @@ -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 diff --git a/specs/clang/template/CMakeLists.txt b/specs/clang/template/CMakeLists.txt new file mode 100644 index 0000000..ee2f214 --- /dev/null +++ b/specs/clang/template/CMakeLists.txt @@ -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) diff --git a/specs/clang/template/flake.nix b/specs/clang/template/flake.nix index ac0b714..2c7cdee 100644 --- a/specs/clang/template/flake.nix +++ b/specs/clang/template/flake.nix @@ -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 ];