Merge pull request #58417 from andersk/ortools-7.0

or-tools: 6.10 -> 7.0, add Python bindings
This commit is contained in:
Mateusz Kowalczyk
2019-04-20 17:39:23 +09:00
committed by GitHub
5 changed files with 58 additions and 21 deletions
@@ -1,15 +1,17 @@
{ stdenv, fetchFromGitHub, cmake, google-gflags, which
, lsb-release, glog, protobuf, cbc, zlib, python3 }:
{ stdenv, fetchFromGitHub, cmake, abseil-cpp, google-gflags, which
, lsb-release, glog, protobuf, cbc, zlib
, ensureNewerSourcesForZipFilesHook, python, swig
, pythonProtobuf }:
stdenv.mkDerivation rec {
name = "or-tools-${version}";
version = "v6.10";
version = "v7.0";
src = fetchFromGitHub {
owner = "google";
repo = "or-tools";
rev = version;
sha256 = "11k3671rpv968dsglc6bgarr9yi8ijaaqm2wq3m0rn4wy8fj7za2";
sha256 = "09rs2j3w4ljw9qhhnsjlvfii297njjszwvkbgj1i6kns3wnlr7cp";
};
# The original build system uses cmake which does things like pull
@@ -18,6 +20,7 @@ stdenv.mkDerivation rec {
# dependencies straight from nixpkgs and use the make build method.
configurePhase = ''
cat <<EOF > Makefile.local
UNIX_ABSL_DIR=${abseil-cpp}
UNIX_GFLAGS_DIR=${google-gflags}
UNIX_GLOG_DIR=${glog}
UNIX_PROTOBUF_DIR=${protobuf}
@@ -25,23 +28,36 @@ stdenv.mkDerivation rec {
EOF
'';
makeFlags = [ "prefix=${placeholder "out"}" ];
buildFlags = [ "cc" ];
makeFlags = [
"prefix=${placeholder "out"}"
"PROTOBUF_PYTHON_DESC=${pythonProtobuf}/${python.sitePackages}/google/protobuf/descriptor_pb2.py"
];
buildFlags = [ "cc" "pypi_archive" ];
checkTarget = "test_cc";
doCheck = true;
installTargets = [ "install_cc" ];
# The upstream install_python target installs to $HOME.
postInstall = ''
mkdir -p "$python/${python.sitePackages}"
(cd temp_python/ortools; PYTHONPATH="$python/${python.sitePackages}:$PYTHONPATH" python setup.py install '--prefix=$python')
'';
nativeBuildInputs = [
cmake lsb-release which zlib python3
cmake lsb-release swig which zlib python
ensureNewerSourcesForZipFilesHook
python.pkgs.setuptools python.pkgs.wheel
];
propagatedBuildInputs = [
google-gflags glog protobuf cbc
abseil-cpp google-gflags glog protobuf cbc
pythonProtobuf python.pkgs.six
];
enableParallelBuilding = true;
outputs = [ "out" "python" ];
meta = with stdenv.lib; {
homepage = https://github.com/google/or-tools;
license = licenses.asl20;
@@ -1,12 +0,0 @@
diff --git a/ortools/data/jobshop_scheduling_parser.cc b/ortools/data/jobshop_scheduling_parser.cc
index cb0a360b..c2f055eb 100644
--- a/ortools/data/jobshop_scheduling_parser.cc
+++ b/ortools/data/jobshop_scheduling_parser.cc
@@ -14,6 +14,7 @@
#include "ortools/data/jobshop_scheduling_parser.h"
#include <cmath>
+#include <gflags/gflags.h>
#include "google/protobuf/wrappers.pb.h"
#include "ortools/base/filelineiter.h"