fix: nix meshoptimizer

This commit is contained in:
Nova
2024-08-13 21:51:32 -04:00
parent 42738b739f
commit 003dd9fcc1
4 changed files with 39 additions and 10 deletions

6
Cargo.lock generated
View File

@@ -1397,7 +1397,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4"
dependencies = [
"cfg-if",
"windows-targets 0.52.6",
"windows-targets 0.48.5",
]
[[package]]
@@ -2488,12 +2488,12 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
[[package]]
name = "stereokit-macros"
version = "0.1.0"
source = "git+https://github.com/technobaboo/StereoKit-rust.git#e6e3b15f173208d7a7564852b526d6323bac6f43"
source = "git+https://github.com/technobaboo/StereoKit-rust.git#7dc90dc23537f7b71605612a8ce3a5e6f0a54eae"
[[package]]
name = "stereokit-rust"
version = "0.1.0"
source = "git+https://github.com/technobaboo/StereoKit-rust.git#e6e3b15f173208d7a7564852b526d6323bac6f43"
source = "git+https://github.com/technobaboo/StereoKit-rust.git#7dc90dc23537f7b71605612a8ce3a5e6f0a54eae"
dependencies = [
"android_logger",
"bitflags 2.6.0",

View File

@@ -37,10 +37,12 @@
perSystem = { config, self', inputs', pkgs, system, ... }: {
_module.args.pkgs = import inputs.nixpkgs { inherit system; overlays = [ inputs.self.overlays.default ]; };
overlayAttrs = config.packages;
packages = {
packages = let
meshoptimizer = pkgs.callPackage ./nix/meshoptimizer.nix {};
in {
default = self'.packages.${name};
gnome-graphical-test = self'.checks.gnome-graphical-test;
"${name}" = pkgs.callPackage ./nix/stardust-xr-server.nix { inherit name src; };
"${name}" = pkgs.callPackage ./nix/stardust-xr-server.nix { inherit name src meshoptimizer; };
};
apps.default = {
type = "app";

27
nix/meshoptimizer.nix Normal file
View File

@@ -0,0 +1,27 @@
{ lib, stdenv, fetchFromGitHub, cmake }:
stdenv.mkDerivation rec {
pname = "meshoptimizer";
version = "0.20";
src = fetchFromGitHub {
owner = "zeux";
repo = "meshoptimizer";
rev = "c21d3be6ddf627f8ca852ba4b6db9903b0557858";
sha256 = "sha256-QCxpM2g8WtYSZHkBzLTJNQ/oHb5j/n9rjaVmZJcCZIA=";
};
nativeBuildInputs = [ cmake ];
cmakeFlags = [
"-DCMAKE_POSITION_INDEPENDENT_CODE=ON"
];
meta = with lib; {
description = "Mesh optimization library that makes meshes smaller and faster to render";
homepage = "https://github.com/zeux/meshoptimizer";
license = licenses.mit;
platforms = platforms.all;
};
}

View File

@@ -12,6 +12,7 @@
, cpm-cmake
, pkg-config
, llvmPackages
, meshoptimizer
}:
rustPlatform.buildRustPackage rec {
@@ -30,11 +31,10 @@ rustPlatform.buildRustPackage rec {
cp ${cpm-cmake}/share/cpm/CPM.cmake $sk/build/cpm/CPM_0.38.7.cmake
'';
nativeBuildInputs = [
cmake cpm-cmake pkg-config llvmPackages.libcxxClang
cmake pkg-config llvmPackages.libcxxClang
];
buildInputs = [
openxr-loader libGL mesa xorg.libX11 fontconfig libxkbcommon
openxr-loader libGL mesa xorg.libX11 fontconfig libxkbcommon meshoptimizer
];
LIBCLANG_PATH = "${libclang.lib}/lib";
}