update
This commit is contained in:
parent
9cb47c4c83
commit
f16cb153e1
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,3 +1,6 @@
|
|||||||
|
.direnv
|
||||||
|
.ccls-cache
|
||||||
|
compile_commands.json
|
||||||
# Prerequisites
|
# Prerequisites
|
||||||
*.d
|
*.d
|
||||||
|
|
||||||
|
10
Makefile
10
Makefile
@ -1,6 +1,6 @@
|
|||||||
# ----- Variables for customization -----
|
# ----- Variables for customization -----
|
||||||
CC = gcc # Compiler (you can change to clang if desired)
|
CC = gcc # Compiler (you can change to clang if desired)
|
||||||
CFLAGS = -g3 -Wall -Wextra -fsanitize=address,undefined # Standard flags + debugging & warnings
|
CFLAGS = -g2 -Wall -Wextra #-fsanitize=address # Standard flags + debugging & warnings
|
||||||
LDFLAGS = # Linker flags, if any
|
LDFLAGS = # Linker flags, if any
|
||||||
|
|
||||||
# ----- Automatic dependency tracking -----
|
# ----- Automatic dependency tracking -----
|
||||||
@ -9,14 +9,14 @@ OBJS := $(SRCS:.c=.o) # Corresponding object files (.o)
|
|||||||
HDRS := $(SRCS:.c=.h)
|
HDRS := $(SRCS:.c=.h)
|
||||||
|
|
||||||
# ----- Targets -----
|
# ----- Targets -----
|
||||||
server: $(OBJS)
|
server: $(OBJS)
|
||||||
$(CC) $(CFLAGS) $(OBJS) -o server $(LDFLAGS)
|
$(CC) $(CFLAGS) $(OBJS) -o server $(LDFLAGS)
|
||||||
|
|
||||||
# Create object files from source files
|
# Create object files from source files
|
||||||
%.o: %.c %.h
|
%.o: %.c %.h
|
||||||
$(CC) $(CFLAGS) -c $< -o $@
|
$(CC) $(CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
# Phony target for cleaning
|
# Phony target for cleaning
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
rm -f $(OBJS) server
|
rm -f $(OBJS)
|
||||||
|
25
flake.lock
generated
Normal file
25
flake.lock
generated
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1721379653,
|
||||||
|
"narHash": "sha256-8MUgifkJ7lkZs3u99UDZMB4kbOxvMEXQZ31FO3SopZ0=",
|
||||||
|
"rev": "1d9c2c9b3e71b9ee663d11c5d298727dace8d374",
|
||||||
|
"revCount": 655136,
|
||||||
|
"type": "tarball",
|
||||||
|
"url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.1.655136%2Brev-1d9c2c9b3e71b9ee663d11c5d298727dace8d374/0190cd4f-c0eb-72cb-834b-ac854aa282dc/source.tar.gz"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"type": "tarball",
|
||||||
|
"url": "https://flakehub.com/f/NixOS/nixpkgs/0.1.%2A.tar.gz"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
39
flake.nix
Normal file
39
flake.nix
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
{
|
||||||
|
description = "A Nix-flake-based C/C++ development environment";
|
||||||
|
|
||||||
|
inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1.*.tar.gz";
|
||||||
|
|
||||||
|
outputs = { self, nixpkgs }:
|
||||||
|
let
|
||||||
|
supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
|
||||||
|
forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f {
|
||||||
|
pkgs = import nixpkgs { inherit system; };
|
||||||
|
});
|
||||||
|
in
|
||||||
|
{
|
||||||
|
devShells = forEachSupportedSystem ({ pkgs }: {
|
||||||
|
default = pkgs.mkShell.override
|
||||||
|
{
|
||||||
|
# Override stdenv in order to change compiler:
|
||||||
|
# stdenv = pkgs.clangStdenv;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
packages = with pkgs; [
|
||||||
|
clang-tools
|
||||||
|
cmake
|
||||||
|
codespell
|
||||||
|
conan
|
||||||
|
cppcheck
|
||||||
|
doxygen
|
||||||
|
gtest
|
||||||
|
lcov
|
||||||
|
vcpkg
|
||||||
|
vcpkg-tool
|
||||||
|
ccls
|
||||||
|
bear
|
||||||
|
] ++ (if system == "aarch64-darwin" then [ ] else [ gdb ]);
|
||||||
|
};
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user