aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--srcds-pkgs/compressonator-sdk.nix32
1 files changed, 21 insertions, 11 deletions
diff --git a/srcds-pkgs/compressonator-sdk.nix b/srcds-pkgs/compressonator-sdk.nix
index bdfd4c5..6d9f53a 100644
--- a/srcds-pkgs/compressonator-sdk.nix
+++ b/srcds-pkgs/compressonator-sdk.nix
@@ -1,4 +1,11 @@
-{ lib, stdenv, fetchFromGitHub, cmake, pkg-config, openexr, glm, mesa }:
+{ lib, stdenv, fetchFromGitHub
+, cmake, ninja, pkg-config
+, glm
+, openexr, withOpenEXR ? false
+, debug ? false
+}:
+assert lib.assertMsg (withOpenEXR == false)
+ "openexr has busted pkg-config files for now; sorry!";
stdenv.mkDerivation rec {
pname = "compressonator-sdk";
version = "4.5.52";
@@ -10,21 +17,24 @@ stdenv.mkDerivation rec {
hash = "sha256-Vehzdlx39LX3p3z+U1y/ZbKyyPNuye21+RHCY2BbNHg=";
};
- nativeBuildInputs = [ cmake pkg-config ];
- buildInputs = [ openexr glm mesa ];
+ nativeBuildInputs = [ cmake pkg-config ninja ];
+ buildInputs = [ glm ] ++ lib.optional withOpenEXR [ openexr ];
- cmakeFlags = [
- "-DOPTION_ENABLE_ALL_APPS=OFF"
- "-DOPTION_BUILD_CMP_SDK=ON"
- "-DOPTION_BUILD_KTX2=OFF"
+ cmakeFlags = with lib; [
+ "-GNinja"
+ (cmakeBool "OPTION_ENABLE_ALL_APPS" false)
+ (cmakeBool "OPTION_BUILD_CMP_SDK" true)
+ (cmakeBool "OPTION_BUILD_KTX2" false)
+ (cmakeBool "OPTION_BUILD_EXR" withOpenEXR)
];
-
+ cmakeBuildType = if debug then "Debug" else "Release";
+
postPatch = ''
# the call sites for this are guarded behind ifdef OPTION_CMP_OPENCV but
# for some reason the thing itself isn't, and still gets built (???)
rm applications/_plugins/common/ssim*
sed -i '/ssim/d' applications/_plugins/common/CMakeLists.txt
- '' + lib.optionalString stdenv.isAarch64 ''
+ '' + lib.optionalString (!stdenv.hostPlatform.isx86) ''
# still plenty fast for our purposes
sed -i '/Core SIMD/,/target_link_libraries/d' \
{build/sdk/,}cmp_core/CMakeLists.txt
@@ -37,11 +47,11 @@ stdenv.mkDerivation rec {
mv lib $out/
mv ../cmp_compressonatorlib/compressonator.h $out/include/
'';
-
+
meta = {
homepage = src.url;
description = "Tool suite for Texture and 3D Model Compression, Optimization and Analysis using CPUs, GPUs and APUs";
license = with lib.licenses; [ mit asl20 ];
platforms = lib.platforms.unix;
};
-} \ No newline at end of file
+}