lol
1{ lib, stdenv, mkDerivation, fetchFromGitHub, cmake, eigen, suitesparse, blas
2, lapack, libGLU, qtbase, libqglviewer, spdlog }:
3
4mkDerivation rec {
5 pname = "g2o";
6 version = "20230806";
7
8 src = fetchFromGitHub {
9 owner = "RainerKuemmerle";
10 repo = pname;
11 rev = "${version}_git";
12 hash = "sha256-9u1FFRWe7qvDhzSKdGTduuGBXmmgzcSriGFb/oCJjNA=";
13 };
14
15 # Removes a reference to gcc that is only used in a debug message
16 patches = [ ./remove-compiler-reference.patch ];
17
18 outputs = [ "out" "dev" ];
19 separateDebugInfo = true;
20
21 nativeBuildInputs = [ cmake ];
22 buildInputs = [ eigen suitesparse blas lapack libGLU qtbase libqglviewer ];
23 propagatedBuildInputs = [ spdlog ];
24
25 dontWrapQtApps = true;
26
27 cmakeFlags = [
28 # Detection script is broken
29 "-DQGLVIEWER_INCLUDE_DIR=${libqglviewer}/include/QGLViewer"
30 "-DG2O_BUILD_EXAMPLES=OFF"
31 ] ++ lib.optionals stdenv.isx86_64 [
32 "-DDO_SSE_AUTODETECT=OFF"
33 "-DDISABLE_SSE3=${ if stdenv.hostPlatform.sse3Support then "OFF" else "ON"}"
34 "-DDISABLE_SSE4_1=${if stdenv.hostPlatform.sse4_1Support then "OFF" else "ON"}"
35 "-DDISABLE_SSE4_2=${if stdenv.hostPlatform.sse4_2Support then "OFF" else "ON"}"
36 "-DDISABLE_SSE4_A=${if stdenv.hostPlatform.sse4_aSupport then "OFF" else "ON"}"
37 ];
38
39 meta = with lib; {
40 description = "A General Framework for Graph Optimization";
41 homepage = "https://github.com/RainerKuemmerle/g2o";
42 license = with licenses; [ bsd3 lgpl3 gpl3 ];
43 maintainers = with maintainers; [ lopsided98 ];
44 platforms = platforms.all;
45 # fatal error: 'qglviewer.h' file not found
46 broken = stdenv.isDarwin;
47 };
48}