about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/g2o
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/g2o')
-rw-r--r--nixpkgs/pkgs/development/libraries/g2o/default.nix49
-rw-r--r--nixpkgs/pkgs/development/libraries/g2o/remove-compiler-reference.patch25
2 files changed, 74 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/g2o/default.nix b/nixpkgs/pkgs/development/libraries/g2o/default.nix
new file mode 100644
index 000000000000..0536ec95c6ff
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/g2o/default.nix
@@ -0,0 +1,49 @@
+{ lib, stdenv, mkDerivation, fetchFromGitHub, cmake, eigen, suitesparse, blas
+, lapack, libGLU, qtbase, libqglviewer, makeWrapper }:
+
+mkDerivation rec {
+  pname = "g2o";
+  version = "20201223";
+
+  src = fetchFromGitHub {
+    owner = "RainerKuemmerle";
+    repo = pname;
+    rev = "${version}_git";
+    sha256 = "sha256-Ik6uBz4Z4rc5+mPNdT8vlNZSBom4Tvt8Y6myBC/s0m8=";
+  };
+
+  # 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 blas lapack libGLU qtbase libqglviewer ];
+
+  # Silence noisy warning
+  CXXFLAGS = "-Wno-deprecated-copy";
+
+  dontWrapQtApps = true;
+
+  cmakeFlags = [
+    # Detection script is broken
+    "-DQGLVIEWER_INCLUDE_DIR=${libqglviewer}/include/QGLViewer"
+    "-DG2O_BUILD_EXAMPLES=OFF"
+  ] ++ lib.optionals stdenv.isx86_64 [
+    "-DDO_SSE_AUTODETECT=OFF"
+    "-DDISABLE_SSE3=${  if stdenv.hostPlatform.sse3Support   then "OFF" else "ON"}"
+    "-DDISABLE_SSE4_1=${if stdenv.hostPlatform.sse4_1Support then "OFF" else "ON"}"
+    "-DDISABLE_SSE4_2=${if stdenv.hostPlatform.sse4_2Support then "OFF" else "ON"}"
+    "-DDISABLE_SSE4_A=${if stdenv.hostPlatform.sse4_aSupport then "OFF" else "ON"}"
+  ];
+
+  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;
+    # fatal error: 'qglviewer.h' file not found
+    broken = stdenv.isDarwin;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/g2o/remove-compiler-reference.patch b/nixpkgs/pkgs/development/libraries/g2o/remove-compiler-reference.patch
new file mode 100644
index 000000000000..347c57802403
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/g2o/remove-compiler-reference.patch
@@ -0,0 +1,25 @@
+From b9bfed09e4e3c481b7eb36bee1ff4202ccf69dee Mon Sep 17 00:00:00 2001
+From: Ben Wolsieffer <benwolsieffer@gmail.com>
+Date: Fri, 17 May 2019 19:05:36 -0400
+Subject: [PATCH] Remove reference to compiler.
+
+---
+ CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index a3f66dd..bb05bd0 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -371,7 +371,7 @@ set(G2O_HAVE_CHOLMOD ${CHOLMOD_FOUND})
+ set(G2O_HAVE_CSPARSE ${CSPARSE_FOUND})
+ set(G2O_SHARED_LIBS ${BUILD_SHARED_LIBS})
+ set(G2O_LGPL_SHARED_LIBS ${BUILD_LGPL_SHARED_LIBS})
+-set(G2O_CXX_COMPILER "${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER}")
++set(G2O_CXX_COMPILER "${CMAKE_CXX_COMPILER_ID} unknown")
+ 
+ configure_file(config.h.in "${PROJECT_BINARY_DIR}/g2o/config.h")
+ install(FILES ${PROJECT_BINARY_DIR}/g2o/config.h DESTINATION ${INCLUDES_DESTINATION}/g2o)
+-- 
+2.21.0
+