diff --git a/.clangd b/.clangd new file mode 100644 index 0000000..e95990a --- /dev/null +++ b/.clangd @@ -0,0 +1,2 @@ +CompileFlags: + CompilationDatabase: build/ diff --git a/.gitignore b/.gitignore index b2b6af9..11a0a23 100644 --- a/.gitignore +++ b/.gitignore @@ -39,3 +39,5 @@ /.vscode/* /.vs/ + +/.cache/ diff --git a/.zed/debug.json b/.zed/debug.json new file mode 100644 index 0000000..57db039 --- /dev/null +++ b/.zed/debug.json @@ -0,0 +1,18 @@ +// Project-local debug tasks +// +// For more documentation on how to configure debug tasks, +// see: https://zed.dev/docs/debugger +[ + { + "label": "Debug native binary", + "build": { + "command": "make build-debug", + // "args": ["-j8"], + "cwd": "$ZED_WORKTREE_ROOT", + }, + "program": "$ZED_WORKTREE_ROOT/build-debug/glowbox", + "cwd": "$ZED_WORKTREE_ROOT/build-debug", + "request": "launch", + "adapter": "CodeLLDB", + }, +] diff --git a/flake.lock b/flake.lock index 6959933..6013ccd 100644 --- a/flake.lock +++ b/flake.lock @@ -4,13 +4,13 @@ "locked": { "lastModified": 1768886240, "narHash": "sha256-C2TjvwYZ2VDxYWeqvvJ5XPPp6U7H66zeJlRaErJKoEM=", - "owner": "nixos", + "owner": "NixOS", "repo": "nixpkgs", "rev": "80e4adbcf8992d3fd27ad4964fbb84907f9478b0", "type": "github" }, "original": { - "owner": "nixos", + "owner": "NixOS", "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" diff --git a/flake.nix b/flake.nix index 6c945a3..c04feac 100644 --- a/flake.nix +++ b/flake.nix @@ -1,35 +1,41 @@ { - description = "assignment 1 of graphics and visualizations"; - - inputs = { - nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; - }; + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; outputs = { self, nixpkgs }: let - system = "x86_64-linux"; - pkgs = import nixpkgs { inherit system; }; + pkgs = nixpkgs.legacyPackages.x86_64-linux; + runtimeLibs = with pkgs; [ + libGL + libx11 + xorg.libXcursor + xorg.libXi + xorg.libXrandr + xorg.libXinerama + ]; in { - devShells.${system}.default = pkgs.mkShell { - buildInputs = with pkgs; [ - python3 + devShells.x86_64-linux.default = pkgs.mkShell { + nativeBuildInputs = with pkgs; [ cmake - git - libgcc - # x11 shenanigans libx11.dev libxcb.dev xorg.libXrandr.dev xorg.libXi.dev xorg.libXcursor.dev xorg.libXinerama.dev + python3 openal + flac.dev libvorbis.dev libogg.dev - flac.dev + xwayland-satellite + gdb ]; + + shellHook = '' + export LD_LIBRARY_PATH="${pkgs.lib.makeLibraryPath runtimeLibs}:$LD_LIBRARY_PATH" + ''; }; }; } diff --git a/src/main.cpp b/src/main.cpp index 0cbc3ff..24757dc 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -24,6 +24,9 @@ GLFWwindow* initialise() if (!glfwInit()) { fprintf(stderr, "Could not start GLFW\n"); + const char* desc; + int code = glfwGetError(&desc); + fprintf(stderr, "GLFW error %d: %s\n", code, desc); exit(EXIT_FAILURE); }