cleanup flake
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@ -2,3 +2,5 @@
|
|||||||
cmake-build-debug
|
cmake-build-debug
|
||||||
cmake-build-release
|
cmake-build-release
|
||||||
/platform
|
/platform
|
||||||
|
/result
|
||||||
|
/.gdb_history
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
./cmake-build-debug/compile_commands.json
|
./cmake-build-release/compile_commands.json
|
||||||
119
flake.lock
generated
119
flake.lock
generated
@ -1,66 +1,5 @@
|
|||||||
{
|
{
|
||||||
"nodes": {
|
"nodes": {
|
||||||
"clj-nix": {
|
|
||||||
"inputs": {
|
|
||||||
"devshell": "devshell",
|
|
||||||
"nix-fetcher-data": "nix-fetcher-data",
|
|
||||||
"nixpkgs": [
|
|
||||||
"nixpkgs"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1770563144,
|
|
||||||
"narHash": "sha256-pddc5NHWPRYmQm723SLTjXVNDi4VnMOWqVbTOkfOE9k=",
|
|
||||||
"owner": "jlesquembre",
|
|
||||||
"repo": "clj-nix",
|
|
||||||
"rev": "b439ecd3eb92737f56330c4395c2d0eba0a4dbdd",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "jlesquembre",
|
|
||||||
"repo": "clj-nix",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"devshell": {
|
|
||||||
"inputs": {
|
|
||||||
"nixpkgs": [
|
|
||||||
"clj-nix",
|
|
||||||
"nixpkgs"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1768818222,
|
|
||||||
"narHash": "sha256-460jc0+CZfyaO8+w8JNtlClB2n4ui1RbHfPTLkpwhU8=",
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "devshell",
|
|
||||||
"rev": "255a2b1725a20d060f566e4755dbf571bbbb5f76",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "devshell",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"flake-parts": {
|
|
||||||
"inputs": {
|
|
||||||
"nixpkgs-lib": "nixpkgs-lib"
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1719745305,
|
|
||||||
"narHash": "sha256-xwgjVUpqSviudEkpQnioeez1Uo2wzrsMaJKJClh+Bls=",
|
|
||||||
"owner": "hercules-ci",
|
|
||||||
"repo": "flake-parts",
|
|
||||||
"rev": "c3c5ecc05edc7dafba779c6c1a61cd08ac6583e9",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "hercules-ci",
|
|
||||||
"repo": "flake-parts",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"flake-utils": {
|
"flake-utils": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"systems": "systems"
|
"systems": "systems"
|
||||||
@ -79,28 +18,6 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nix-fetcher-data": {
|
|
||||||
"inputs": {
|
|
||||||
"flake-parts": "flake-parts",
|
|
||||||
"nixpkgs": [
|
|
||||||
"clj-nix",
|
|
||||||
"nixpkgs"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1755022803,
|
|
||||||
"narHash": "sha256-/QtBdVfZlrRJW5enUoWlBE2wrLXJBMJ45X0rZh0jiaU=",
|
|
||||||
"owner": "jlesquembre",
|
|
||||||
"repo": "nix-fetcher-data",
|
|
||||||
"rev": "9da3926b1459d6ff15268072d1c51351b82811b9",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "jlesquembre",
|
|
||||||
"repo": "nix-fetcher-data",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1770843696,
|
"lastModified": 1770843696,
|
||||||
@ -115,44 +32,10 @@
|
|||||||
"type": "indirect"
|
"type": "indirect"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nixpkgs-lib": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1717284937,
|
|
||||||
"narHash": "sha256-lIbdfCsf8LMFloheeE6N31+BMIeixqyQWbSr2vk79EQ=",
|
|
||||||
"type": "tarball",
|
|
||||||
"url": "https://github.com/NixOS/nixpkgs/archive/eb9ceca17df2ea50a250b6b27f7bf6ab0186f198.tar.gz"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"type": "tarball",
|
|
||||||
"url": "https://github.com/NixOS/nixpkgs/archive/eb9ceca17df2ea50a250b6b27f7bf6ab0186f198.tar.gz"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"clj-nix": "clj-nix",
|
|
||||||
"flake-utils": "flake-utils",
|
"flake-utils": "flake-utils",
|
||||||
"nixpkgs": "nixpkgs",
|
"nixpkgs": "nixpkgs"
|
||||||
"rust-overlay": "rust-overlay"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"rust-overlay": {
|
|
||||||
"inputs": {
|
|
||||||
"nixpkgs": [
|
|
||||||
"nixpkgs"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1770865833,
|
|
||||||
"narHash": "sha256-oiARqnlvaW6pVGheVi4ye6voqCwhg5hCcGish2ZvQzI=",
|
|
||||||
"owner": "oxalica",
|
|
||||||
"repo": "rust-overlay",
|
|
||||||
"rev": "c8cfbe26238638e2f3a2c0ae7e8d240f5e4ded85",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "oxalica",
|
|
||||||
"repo": "rust-overlay",
|
|
||||||
"type": "github"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"systems": {
|
"systems": {
|
||||||
|
|||||||
141
flake.nix
141
flake.nix
@ -4,29 +4,20 @@ rec {
|
|||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "nixpkgs"; # Use nixpkgs from system registry
|
nixpkgs.url = "nixpkgs"; # Use nixpkgs from system registry
|
||||||
flake-utils.url = "github:numtide/flake-utils";
|
flake-utils.url = "github:numtide/flake-utils";
|
||||||
|
|
||||||
rust-overlay.url = "github:oxalica/rust-overlay";
|
|
||||||
rust-overlay.inputs.nixpkgs.follows = "nixpkgs";
|
|
||||||
|
|
||||||
clj-nix.url = "github:jlesquembre/clj-nix";
|
|
||||||
clj-nix.inputs.nixpkgs.follows = "nixpkgs";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = {
|
outputs = {
|
||||||
self,
|
self,
|
||||||
nixpkgs,
|
nixpkgs,
|
||||||
flake-utils,
|
flake-utils,
|
||||||
rust-overlay,
|
|
||||||
clj-nix,
|
|
||||||
}:
|
}:
|
||||||
# Create a shell (and possibly package) for each possible system, not only x86_64-linux
|
# Create a shell (and possibly package) for each possible system, not only x86_64-linux
|
||||||
flake-utils.lib.eachDefaultSystem (system: let
|
flake-utils.lib.eachDefaultSystem (
|
||||||
|
system: let
|
||||||
pkgs = import nixpkgs {
|
pkgs = import nixpkgs {
|
||||||
inherit system;
|
inherit system;
|
||||||
config.allowUnfree = true;
|
config.allowUnfree = true;
|
||||||
overlays = [
|
overlays = [];
|
||||||
rust-overlay.overlays.default
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
inherit (pkgs) lib stdenv;
|
inherit (pkgs) lib stdenv;
|
||||||
|
|
||||||
@ -50,22 +41,6 @@ rec {
|
|||||||
bintools = bintools;
|
bintools = bintools;
|
||||||
};
|
};
|
||||||
|
|
||||||
# Multilib C/C++ compilers that don't collide (use the same libc)
|
|
||||||
# bintools_multilib = pkgs.wrapBintoolsWith {
|
|
||||||
# bintools = pkgs.bintools.bintools; # Unwrapped bintools
|
|
||||||
# libc = pkgs.glibc_multi;
|
|
||||||
# };
|
|
||||||
# gcc_multilib = pkgs.hiPrio (pkgs.wrapCCWith {
|
|
||||||
# cc = pkgs.gcc.cc; # Unwrapped gcc
|
|
||||||
# libc = pkgs.glibc_multi;
|
|
||||||
# bintools = bintools_multilib;
|
|
||||||
# });
|
|
||||||
# clang_multilib = pkgs.wrapCCWith {
|
|
||||||
# cc = pkgs.clang.cc; # Unwrapped clang
|
|
||||||
# libc = pkgs.glibc_multi;
|
|
||||||
# bintools = bintools_multilib;
|
|
||||||
# };
|
|
||||||
|
|
||||||
# Raylib CPP wrapper
|
# Raylib CPP wrapper
|
||||||
raylib-cpp = stdenv.mkDerivation {
|
raylib-cpp = stdenv.mkDerivation {
|
||||||
pname = "raylib-cpp";
|
pname = "raylib-cpp";
|
||||||
@ -133,6 +108,8 @@ rec {
|
|||||||
# pprof
|
# pprof
|
||||||
gprof2dot
|
gprof2dot
|
||||||
kdePackages.kcachegrind
|
kdePackages.kcachegrind
|
||||||
|
gdbgui
|
||||||
|
# renderdoc
|
||||||
];
|
];
|
||||||
|
|
||||||
# Add dependencies to buildInputs if they will end up copied or linked into the final output or otherwise used at runtime:
|
# Add dependencies to buildInputs if they will end up copied or linked into the final output or otherwise used at runtime:
|
||||||
@ -143,7 +120,7 @@ rec {
|
|||||||
# boost
|
# boost
|
||||||
# sfml
|
# sfml
|
||||||
raylib
|
raylib
|
||||||
llvmPackages.openmp
|
llvmPackages.openmp # not required for compilation but for clangd to find the headers
|
||||||
# raylib-cpp
|
# raylib-cpp
|
||||||
# tinyobjloader
|
# tinyobjloader
|
||||||
# gperftools
|
# gperftools
|
||||||
@ -151,26 +128,32 @@ rec {
|
|||||||
# ===========================================================================================
|
# ===========================================================================================
|
||||||
# Define buildable + installable packages
|
# Define buildable + installable packages
|
||||||
# ===========================================================================================
|
# ===========================================================================================
|
||||||
# package = stdenv.mkDerivation {
|
package = stdenv.mkDerivation rec {
|
||||||
# inherit nativeBuildInputs buildInputs;
|
inherit buildInputs;
|
||||||
# pname = "";
|
pname = "masssprings";
|
||||||
# version = "1.0.0";
|
version = "0.0.1";
|
||||||
# src = ./.;
|
src = ./.;
|
||||||
#
|
|
||||||
# installPhase = ''
|
nativeBuildInputs = with pkgs; [
|
||||||
# mkdir -p $out/bin
|
gcc
|
||||||
# mv ./BINARY $out/bin
|
cmake
|
||||||
# '';
|
];
|
||||||
# };
|
|
||||||
|
installPhase = ''
|
||||||
|
mkdir -p $out/bin
|
||||||
|
mv ./${pname} $out/bin
|
||||||
|
'';
|
||||||
|
};
|
||||||
in rec {
|
in rec {
|
||||||
# Provide package for "nix build"
|
# Provide package for "nix build"
|
||||||
# defaultPackage = package;
|
defaultPackage = package;
|
||||||
# defaultApp = flake-utils.lib.mkApp {
|
defaultApp = flake-utils.lib.mkApp {
|
||||||
# drv = defaultPackage;
|
drv = defaultPackage;
|
||||||
# };
|
};
|
||||||
|
|
||||||
# Provide environment for "nix develop"
|
# Provide environment for "nix develop"
|
||||||
devShell = pkgs.mkShell {
|
devShells = {
|
||||||
|
default = pkgs.mkShell {
|
||||||
inherit nativeBuildInputs buildInputs;
|
inherit nativeBuildInputs buildInputs;
|
||||||
name = description;
|
name = description;
|
||||||
|
|
||||||
@ -224,17 +207,9 @@ rec {
|
|||||||
-DCMAKE_BUILD_TYPE="${type}" \
|
-DCMAKE_BUILD_TYPE="${type}" \
|
||||||
..
|
..
|
||||||
|
|
||||||
echo "Generating .clangd"
|
|
||||||
echo "CompileFlags:" >> .clangd
|
|
||||||
echo " Add:" >> .clangd
|
|
||||||
echo " - \"-I${pkgs.raylib}/include\"" >> .clangd
|
|
||||||
|
|
||||||
echo "Linking compile_commands.json"
|
echo "Linking compile_commands.json"
|
||||||
cd ..
|
cd ..
|
||||||
ln -sf ./cmake-build-${typeLower}/compile_commands.json ./compile_commands.json
|
ln -sf ./cmake-build-${typeLower}/compile_commands.json ./compile_commands.json
|
||||||
|
|
||||||
echo "Linking .clangd"
|
|
||||||
ln -sf ./cmake-build-${typeLower}/.clangd ./.clangd
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
cmakeDebug = mkCmakeScript "Debug";
|
cmakeDebug = mkCmakeScript "Debug";
|
||||||
@ -260,22 +235,13 @@ rec {
|
|||||||
# Determine the project root, used e.g. in cmake scripts
|
# Determine the project root, used e.g. in cmake scripts
|
||||||
set -g -x FLAKE_PROJECT_ROOT (git rev-parse --show-toplevel)
|
set -g -x FLAKE_PROJECT_ROOT (git rev-parse --show-toplevel)
|
||||||
|
|
||||||
# Rust Bevy:
|
|
||||||
# abbr -a build-release-windows "CARGO_FEATURE_PURE=1 cargo xwin build --release --target x86_64-pc-windows-msvc"
|
|
||||||
|
|
||||||
# C/C++:
|
# C/C++:
|
||||||
abbr -a cmake-debug "${cmakeDebug}"
|
abbr -a cmake-debug "${cmakeDebug}"
|
||||||
abbr -a cmake-release "${cmakeRelease}"
|
abbr -a cmake-release "${cmakeRelease}"
|
||||||
abbr -a build-debug "${buildDebug}"
|
abbr -a build-debug "${buildDebug}"
|
||||||
abbr -a build-release "${buildRelease}"
|
abbr -a build-release "${buildRelease}"
|
||||||
|
abbr -a debug "${buildDebug} && ./cmake-build-debug/masssprings"
|
||||||
# Clojure:
|
abbr -a release "${buildRelease} && ./cmake-build-release/masssprings"
|
||||||
# abbr -a clojure-deps "deps-lock --lein"
|
|
||||||
|
|
||||||
# Python:
|
|
||||||
# abbr -a run "python ./app/main.py"
|
|
||||||
# abbr -a profile "py-spy record -o profile.svg -- python ./app/main.py && firefox profile.svg"
|
|
||||||
# abbr -a ptop "py-spy top -- python ./app/main.py"
|
|
||||||
'';
|
'';
|
||||||
in
|
in
|
||||||
builtins.concatStringsSep "\n" [
|
builtins.concatStringsSep "\n" [
|
||||||
@ -285,5 +251,50 @@ rec {
|
|||||||
''
|
''
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
});
|
|
||||||
|
# TODO: Doesn't work
|
||||||
|
|
||||||
|
# FHS environment for renderdoc. Access with "nix develop .#renderdoc".
|
||||||
|
# https://ryantm.github.io/nixpkgs/builders/special/fhs-environments
|
||||||
|
# renderdoc =
|
||||||
|
# (pkgs.buildFHSEnv {
|
||||||
|
# name = "renderdoc-env";
|
||||||
|
#
|
||||||
|
# targetPkgs = pkgs:
|
||||||
|
# with pkgs; [
|
||||||
|
# # RenderDoc
|
||||||
|
# renderdoc
|
||||||
|
#
|
||||||
|
# # Build tools
|
||||||
|
# gcc
|
||||||
|
# cmake
|
||||||
|
#
|
||||||
|
# # Raylib
|
||||||
|
# raylib
|
||||||
|
# libGL
|
||||||
|
# mesa
|
||||||
|
#
|
||||||
|
# # X11
|
||||||
|
# libx11
|
||||||
|
# libxcursor
|
||||||
|
# libxrandr
|
||||||
|
# libxinerama
|
||||||
|
# libxi
|
||||||
|
# libxext
|
||||||
|
# libxfixes
|
||||||
|
#
|
||||||
|
# # Wayland
|
||||||
|
# wayland
|
||||||
|
# wayland-protocols
|
||||||
|
# libxkbcommon
|
||||||
|
# ];
|
||||||
|
#
|
||||||
|
# runScript = "fish";
|
||||||
|
#
|
||||||
|
# profile = ''
|
||||||
|
# '';
|
||||||
|
# }).env;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,11 +26,6 @@
|
|||||||
// - Click states to display them in the board
|
// - Click states to display them in the board
|
||||||
// - Find shortest path to any winning state and mark it in the graph
|
// - Find shortest path to any winning state and mark it in the graph
|
||||||
// - Also mark the next move along the path on the board
|
// - Also mark the next move along the path on the board
|
||||||
// TODO: Don't tie the simulation step resolution to the FPS (frametime)
|
|
||||||
// - This breaks the simulation on slower systems
|
|
||||||
// - Add a modifiable speed setting?
|
|
||||||
// - Clamp the frametime?
|
|
||||||
// - Use a fixed step size and control how often it runs per frame?
|
|
||||||
|
|
||||||
auto main(int argc, char *argv[]) -> int {
|
auto main(int argc, char *argv[]) -> int {
|
||||||
// if (argc < 2) {
|
// if (argc < 2) {
|
||||||
@ -43,7 +38,7 @@ auto main(int argc, char *argv[]) -> int {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// RayLib window setup
|
// RayLib window setup
|
||||||
// SetTraceLogLevel(LOG_ERROR);
|
SetTraceLogLevel(LOG_ERROR);
|
||||||
// SetConfigFlags(FLAG_VSYNC_HINT);
|
// SetConfigFlags(FLAG_VSYNC_HINT);
|
||||||
SetConfigFlags(FLAG_MSAA_4X_HINT);
|
SetConfigFlags(FLAG_MSAA_4X_HINT);
|
||||||
SetConfigFlags(FLAG_WINDOW_RESIZABLE);
|
SetConfigFlags(FLAG_WINDOW_RESIZABLE);
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
#include "renderer.hpp"
|
#include "renderer.hpp"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstring>
|
|
||||||
#include <format>
|
#include <format>
|
||||||
#include <raylib.h>
|
#include <raylib.h>
|
||||||
#include <raymath.h>
|
#include <raymath.h>
|
||||||
@ -12,6 +11,10 @@
|
|||||||
#include "klotski.hpp"
|
#include "klotski.hpp"
|
||||||
#include "mass_springs.hpp"
|
#include "mass_springs.hpp"
|
||||||
|
|
||||||
|
#ifdef BATCHING
|
||||||
|
#include <cstring>
|
||||||
|
#endif
|
||||||
|
|
||||||
auto OrbitCamera3D::Update(const Mass ¤t_mass) -> void {
|
auto OrbitCamera3D::Update(const Mass ¤t_mass) -> void {
|
||||||
Vector2 mouse = GetMousePosition();
|
Vector2 mouse = GetMousePosition();
|
||||||
if (mouse.x >= GetScreenWidth() / 2.0 && mouse.y >= MENU_HEIGHT) {
|
if (mouse.x >= GetScreenWidth() / 2.0 && mouse.y >= MENU_HEIGHT) {
|
||||||
|
|||||||
Reference in New Issue
Block a user