Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{
2 lib,
3 stdenv,
4 mkDerivation,
5 fetchFromGitHub,
6 cmake,
7 eigen,
8 suitesparse,
9 blas,
10 lapack,
11 libGLU,
12 qtbase,
13 libqglviewer,
14 spdlog,
15}:
16
17mkDerivation rec {
18 pname = "g2o";
19 version = "20241228";
20
21 src = fetchFromGitHub {
22 owner = "RainerKuemmerle";
23 repo = pname;
24 rev = "${version}_git";
25 hash = "sha256-MW1IO1P2e3KgurOW5ZfHlxK0m5sF0JhdLmvQNEHWEtI=";
26 };
27
28 # Removes a reference to gcc that is only used in a debug message
29 patches = [ ./remove-compiler-reference.patch ];
30
31 outputs = [
32 "out"
33 "dev"
34 ];
35 separateDebugInfo = true;
36
37 nativeBuildInputs = [ cmake ];
38 buildInputs = [
39 eigen
40 suitesparse
41 blas
42 lapack
43 libGLU
44 qtbase
45 libqglviewer
46 ];
47 propagatedBuildInputs = [ spdlog ];
48
49 dontWrapQtApps = true;
50
51 cmakeFlags = [
52 # Detection script is broken
53 "-DQGLVIEWER_INCLUDE_DIR=${libqglviewer}/include/QGLViewer"
54 "-DG2O_BUILD_EXAMPLES=OFF"
55 ]
56 ++ lib.optionals stdenv.hostPlatform.isx86_64 [
57 "-DDO_SSE_AUTODETECT=OFF"
58 "-DDISABLE_SSE3=${if stdenv.hostPlatform.sse3Support then "OFF" else "ON"}"
59 "-DDISABLE_SSE4_1=${if stdenv.hostPlatform.sse4_1Support then "OFF" else "ON"}"
60 "-DDISABLE_SSE4_2=${if stdenv.hostPlatform.sse4_2Support then "OFF" else "ON"}"
61 "-DDISABLE_SSE4_A=${if stdenv.hostPlatform.sse4_aSupport then "OFF" else "ON"}"
62 ];
63
64 meta = with lib; {
65 description = "General Framework for Graph Optimization";
66 homepage = "https://github.com/RainerKuemmerle/g2o";
67 license = with licenses; [
68 bsd3
69 lgpl3
70 gpl3
71 ];
72 maintainers = with maintainers; [ lopsided98 ];
73 platforms = platforms.all;
74 # fatal error: 'qglviewer.h' file not found
75 broken = stdenv.hostPlatform.isDarwin;
76 };
77}