draco: modernize

This commit is contained in:
Zexin Yuan
2026-05-15 16:41:32 +02:00
committed by Wolfgang Walther
parent b24bf10ba3
commit 9828d404e4
2 changed files with 15 additions and 19 deletions
+14 -15
View File
@@ -14,12 +14,11 @@
}:
let
cmakeBool = b: if b then "ON" else "OFF";
tinygltf = callPackage ./tinygltf.nix { };
in
stdenv.mkDerivation (finalAttrs: {
version = "1.5.7";
pname = "draco";
version = "1.5.7";
src = fetchFromGitHub {
owner = "google";
@@ -32,9 +31,14 @@ stdenv.mkDerivation (finalAttrs: {
# ld: unknown option: --start-group
postPatch = ''
substituteInPlace cmake/draco_targets.cmake \
--replace "^Clang" "^AppleClang"
--replace-fail "^Clang" "^AppleClang"
'';
nativeBuildInputs = [
cmake
python3
];
buildInputs = [
gtest
]
@@ -44,21 +48,16 @@ stdenv.mkDerivation (finalAttrs: {
tinygltf
];
nativeBuildInputs = [
cmake
python3
];
cmakeFlags = [
"-DDRACO_ANIMATION_ENCODING=${cmakeBool withAnimation}"
"-DDRACO_GOOGLETEST_PATH=${gtest}"
"-DBUILD_SHARED_LIBS=${cmakeBool true}"
"-DDRACO_TRANSCODER_SUPPORTED=${cmakeBool withTranscoder}"
(lib.cmakeFeature "DRACO_GOOGLETEST_PATH" (builtins.toString gtest))
(lib.cmakeBool "DRACO_ANIMATION_ENCODING" withAnimation)
(lib.cmakeBool "BUILD_SHARED_LIBS" true)
(lib.cmakeBool "DRACO_TRANSCODER_SUPPORTED" withTranscoder)
]
++ lib.optionals withTranscoder [
"-DDRACO_EIGEN_PATH=${eigen}/include/eigen3"
"-DDRACO_FILESYSTEM_PATH=${ghc_filesystem}"
"-DDRACO_TINYGLTF_PATH=${tinygltf}"
(lib.cmakeFeature "DRACO_EIGEN_PATH" "${eigen}/include/eigen3")
(lib.cmakeFeature "DRACO_FILESYSTEM_PATH" (builtins.toString ghc_filesystem))
(lib.cmakeFeature "DRACO_TINYGLTF_PATH" (builtins.toString tinygltf))
];
env.CXXFLAGS = toString [
+1 -4
View File
@@ -2,7 +2,6 @@
lib,
stdenv,
fetchFromGitHub,
nix-update-script,
cmake,
}:
@@ -13,14 +12,12 @@ stdenv.mkDerivation (finalAttrs: {
src = fetchFromGitHub {
owner = "syoyo";
repo = "tinygltf";
rev = "v${finalAttrs.version}";
tag = "v${finalAttrs.version}";
hash = "sha256-uQlv+mUWnqUJIXnPf2pVuRg1akcXAfqyBIzPPmm4Np4=";
};
nativeBuildInputs = [ cmake ];
passthru.updateScript = nix-update-script { };
meta = {
description = "Header only C++11 tiny glTF 2.0 library";
homepage = "https://github.com/syoyo/tinygltf";