mirror of
https://github.com/slendidev/smath.git
synced 2026-03-17 02:26:50 +02:00
Those headers are used for interoping with various popular C++ libraries. For now, those libraries are Eigen, GLM, HandmadeMath, Raylib, and SFML. Some other ones may be added in the future. Those are disabled by default, as most projects I would imagine would not use them. But in case you need any of them for special reasons like I did, they are there. Signed-off-by: Slendi <slendi@socopon.com>
90 lines
2.1 KiB
Nix
90 lines
2.1 KiB
Nix
{
|
|
description = "Single-file linear algebra math library for C++23.";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
};
|
|
|
|
outputs =
|
|
{
|
|
self,
|
|
nixpkgs,
|
|
flake-utils,
|
|
}:
|
|
flake-utils.lib.eachDefaultSystem (
|
|
system:
|
|
let
|
|
pkgs = import nixpkgs {
|
|
system = system;
|
|
};
|
|
in
|
|
{
|
|
devShells.default = pkgs.mkShell {
|
|
packages = with pkgs; [
|
|
cmake
|
|
ninja
|
|
clang-tools
|
|
lldb
|
|
pkg-config
|
|
];
|
|
};
|
|
|
|
packages.default = pkgs.stdenv.mkDerivation {
|
|
pname = "smath";
|
|
version = "master";
|
|
|
|
src = ./.;
|
|
|
|
nativeBuildInputs = with pkgs; [
|
|
cmake
|
|
gtest
|
|
copyPkgconfigItems
|
|
];
|
|
|
|
pkgconfigItems = [
|
|
(pkgs.makePkgconfigItem rec {
|
|
name = "smath";
|
|
version = "1";
|
|
cflags = [ "-I${variables.includedir}" ];
|
|
variables = rec {
|
|
prefix = "${placeholder "out"}";
|
|
includedir = "${prefix}/include";
|
|
};
|
|
description = "Single-file linear algebra math library for C++23.";
|
|
})
|
|
];
|
|
|
|
extraCMakeFlags = [
|
|
"-DSMATH_INSTALL_INTEROP_HEADERS=ON"
|
|
];
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
mkdir -p $out/include/
|
|
cp -r ../include/smath/ $out/include/
|
|
runHook postInstall
|
|
'';
|
|
|
|
dontBuild = false;
|
|
doCheck = true;
|
|
|
|
meta = with pkgs.lib; {
|
|
description = "Single-file linear algebra math library for C++23.";
|
|
homepage = "https://github.com/slendidev/smath";
|
|
license = licenses.asl20;
|
|
platforms = platforms.all;
|
|
maintainers = [
|
|
{
|
|
name = "Slendi";
|
|
email = "slendi@socopon.com";
|
|
github = "slendidev";
|
|
githubId = 32436619;
|
|
}
|
|
];
|
|
};
|
|
};
|
|
}
|
|
);
|
|
}
|