mirror of
https://git.savannah.gnu.org/git/guix.git
synced 2025-02-01 07:16:39 +01:00
gnu: faiss: Fix building on non-Intel architectures.
* gnu/packages/graph.scm (faiss)[source]: Add snippet to wrap Intel specific headers. [arguments]: Adjust custom 'prepare-build phase to adjust compile flags for different architectures.
This commit is contained in:
parent
4774677228
commit
3776dc094c
1 changed files with 13 additions and 3 deletions
|
@ -2,6 +2,7 @@
|
|||
;;; Copyright © 2017, 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
|
||||
;;; Copyright © 2018 Joshua Sierles, Nextjournal <joshua@nextjournal.com>
|
||||
;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
|
||||
;;; Copyright © 2019 Efraim Flashner <efraim@flashner.co.il>
|
||||
;;;
|
||||
;;; This file is part of GNU Guix.
|
||||
;;;
|
||||
|
@ -256,7 +257,14 @@ (define-public faiss
|
|||
(file-name (git-file-name name version))
|
||||
(sha256
|
||||
(base32
|
||||
"0pk15jfa775cy2pqmzq62nhd6zfjxmpvz5h731197c28aq3zw39w"))))
|
||||
"0pk15jfa775cy2pqmzq62nhd6zfjxmpvz5h731197c28aq3zw39w"))
|
||||
(modules '((guix build utils)))
|
||||
(snippet
|
||||
'(begin
|
||||
(substitute* "utils.cpp"
|
||||
(("#include <immintrin.h>")
|
||||
"#ifdef __SSE__\n#include <immintrin.h>\n#endif"))
|
||||
#t))))
|
||||
(build-system cmake-build-system)
|
||||
(arguments
|
||||
`(#:configure-flags
|
||||
|
@ -270,12 +278,14 @@ (define-public faiss
|
|||
(%current-system))))
|
||||
(cond
|
||||
((string-prefix? "x86_64" system)
|
||||
'("-mavx" "-msse2"))
|
||||
'("-mavx" "-msse2" "-mpopcnt"))
|
||||
((string-prefix? "i686" system)
|
||||
'("-msse2"))
|
||||
'("-msse2" "-mpopcnt"))
|
||||
(else
|
||||
'()))))))
|
||||
(substitute* "CMakeLists.txt"
|
||||
(("-m64") "")
|
||||
(("-mpopcnt") "") ; only some architectures
|
||||
(("-msse4")
|
||||
(string-append
|
||||
(string-join features)
|
||||
|
|
Loading…
Reference in a new issue