1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
{ 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";
src = fetchFromGitHub {
owner = "GPUOpen-Tools";
repo = "compressonator";
rev = "V${version}";
hash = "sha256-Vehzdlx39LX3p3z+U1y/ZbKyyPNuye21+RHCY2BbNHg=";
};
nativeBuildInputs = [ cmake pkg-config ninja ];
buildInputs = [ glm ] ++ lib.optional withOpenEXR [ openexr ];
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.hostPlatform.isx86) ''
# still plenty fast for our purposes
sed -i '/Core SIMD/,/target_link_libraries/d' \
{build/sdk/,}cmp_core/CMakeLists.txt
sed -i '/CGU_BOOL useAVX512/,/return result;/d' \
cmp_core/shaders/bc1_cmp.h
'';
installPhase = ''
mkdir -p $out/include
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;
};
}
|