aboutsummaryrefslogtreecommitdiff
path: root/nixpkgs/pkgs/development/libraries/g2o/default.nix
blob: 7167112b6bd193b15d621ddf7eb4cf4efab9cb74 (plain)
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
{ lib, stdenv, mkDerivation, fetchFromGitHub, cmake, eigen, suitesparse, libGLU
, qtbase, libqglviewer, makeWrapper }:

mkDerivation rec {
  pname = "g2o";
  version = "20200410";

  src = fetchFromGitHub {
    owner = "RainerKuemmerle";
    repo = pname;
    rev = "${version}_git";
    sha256 = "11rgj2g9mmwajlr69pjkjvxjyn88afa0r4bchjyvmxswjccizlg2";
  };

  # Removes a reference to gcc that is only used in a debug message
  patches = [ ./remove-compiler-reference.patch ];

  separateDebugInfo = true;

  nativeBuildInputs = [ cmake makeWrapper ];
  buildInputs = [ eigen suitesparse libGLU qtbase libqglviewer ];

  # Silence noisy warning
  CXXFLAGS = "-Wno-deprecated-copy";

  cmakeFlags = [
    # Detection script is broken
    "-DQGLVIEWER_INCLUDE_DIR=${libqglviewer}/include/QGLViewer"
    "-DG2O_BUILD_EXAMPLES=OFF"
  ] ++ lib.optionals stdenv.isx86_64 ([ "-DDO_SSE_AUTODETECT=OFF" ] ++ {
    default        = [ "-DDISABLE_SSE3=ON" "-DDISABLE_SSE4_1=ON" "-DDISABLE_SSE4_2=ON" "-DDISABLE_SSE4_A=ON" ];
    westmere       = [                                                                 "-DDISABLE_SSE4_A=ON" ];
    sandybridge    = [                                                                 "-DDISABLE_SSE4_A=ON" ];
    ivybridge      = [                                                                 "-DDISABLE_SSE4_A=ON" ];
    haswell        = [                                                                 "-DDISABLE_SSE4_A=ON" ];
    broadwell      = [                                                                 "-DDISABLE_SSE4_A=ON" ];
    skylake        = [                                                                 "-DDISABLE_SSE4_A=ON" ];
    skylake-avx512 = [                                                                 "-DDISABLE_SSE4_A=ON" ];
  }.${stdenv.hostPlatform.platform.gcc.arch or "default"});

  meta = with lib; {
    description = "A General Framework for Graph Optimization";
    homepage = "https://github.com/RainerKuemmerle/g2o";
    license = with licenses; [ bsd3 lgpl3 gpl3 ];
    maintainers = with maintainers; [ lopsided98 ];
    platforms = platforms.all;
  };
}