From 7db40fa5d52ae4b7aaf3e145d006dd27cec2028e Mon Sep 17 00:00:00 2001 From: Daniel Nagy Date: Wed, 24 Feb 2021 21:56:27 +0100 Subject: [PATCH] python3Packages.dlib: support sse4 instructions My understanding of the line that is removed is, that the logic is wrong. According to the setup.py file[0] it says that: > To exclude certain options in the cmake config use --no: > for example: > --no USE_AVX_INSTRUCTIONS: will set -DUSE_AVX_INSTRUCTIONS=no This means, that a true value of `avxSupport` will deactivate it in the setup, which is not what we want. [0]: https://github.com/davisking/dlib/blob/v19.21/setup.py#L22 --- pkgs/development/python-modules/dlib/default.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkgs/development/python-modules/dlib/default.nix b/pkgs/development/python-modules/dlib/default.nix index 204c1a98542..58ceb16870a 100644 --- a/pkgs/development/python-modules/dlib/default.nix +++ b/pkgs/development/python-modules/dlib/default.nix @@ -1,4 +1,5 @@ { buildPythonPackage, stdenv, lib, dlib, python, pytest, more-itertools +, sse4Support ? stdenv.hostPlatform.sse4_1Support , avxSupport ? stdenv.hostPlatform.avxSupport }: @@ -12,7 +13,10 @@ buildPythonPackage { ${python.interpreter} nix_run_setup test --no USE_AVX_INSTRUCTIONS ''; - setupPyBuildFlags = lib.optional avxSupport "--no USE_AVX_INSTRUCTIONS"; + setupPyBuildFlags = [ + "--set USE_SSE4_INSTRUCTIONS=${if sse4Support then "yes" else "no"}" + "--set USE_AVX_INSTRUCTIONS=${if avxSupport then "yes" else "no"}" + ]; patches = [ ./build-cores.patch ];