Unverified Commit 1135527d authored by Sandro Jäckel's avatar Sandro Jäckel Committed by GitHub
Browse files

or-tools: 9.14 → 9.15 (#484249)

parents e4c9a529 ab95d720
Loading
Loading
Loading
Loading
+0 −15
Original line number Diff line number Diff line
--- a/ortools/gscip/gscip.cc
+++ b/ortools/gscip/gscip.cc
@@ -48,7 +48,13 @@
 #include "scip/cons_indicator.h"
 #include "scip/cons_linear.h"
 #include "scip/cons_or.h"
+#if SCIP_VERSION_MAJOR >= 10
+#include "scip/cons_nonlinear.h"
+#define SCIPcreateConsBasicQuadratic SCIPcreateConsBasicQuadraticNonlinear
+#define SCIPcreateConsQuadratic SCIPcreateConsQuadraticNonlinear
+#else
 #include "scip/cons_quadratic.h"
+#endif  // SCIP_VERSION_MAJOR >= 10
 #include "scip/cons_sos1.h"
 #include "scip/cons_sos2.h"
+18 −37
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@
  lib,
  callPackage,

  abseil-cpp_202505,
  abseil-cpp_202508,
  bzip2,
  cbc,
  cmake,
@@ -16,7 +16,8 @@
  glpk,
  highs,
  pkg-config,
  protobuf_31,
  protobuf_32,
  protobuf-matchers,
  python3,
  re2,
  swig,
@@ -32,9 +33,14 @@ let
  # protobuf. Do not un-pin these, even if you're upgrading them to
  # what might happen to be the latest version at the current moment;
  # future upgrades *will* break the build.
  abseil-cpp' = abseil-cpp_202505;
  protobuf' = protobuf_31.override { abseil-cpp = abseil-cpp'; };
  python-protobuf' = python3.pkgs.protobuf5.override { protobuf = protobuf'; };
  abseil-cpp' = abseil-cpp_202508;
  gtest' = gtest.override {
    withAbseil = true;
    abseil-cpp = abseil-cpp';
  };
  protobuf' = protobuf_32.override { abseil-cpp = abseil-cpp'; };
  protobuf-matchers' = protobuf-matchers.override { protobuf = protobuf'; };
  python-protobuf' = python3.pkgs.protobuf6.override { protobuf = protobuf'; };

  pybind11' = callPackage ./pybind11-2.13.6.nix {
    inherit (python3.pkgs)
@@ -76,13 +82,13 @@ let
in
stdenv.mkDerivation (finalAttrs: {
  pname = "or-tools";
  version = "9.14";
  version = "9.15";

  src = fetchFromGitHub {
    owner = "google";
    repo = "or-tools";
    tag = "v${finalAttrs.version}";
    hash = "sha256-FxKe3uY4L33mavwC2aanji3fY9dPqpkwVqi6PNjovSA=";
    hash = "sha256-9+tvgP/+/VY6wu7lzTdP4xfiJIgPSLVR9lEdZjQCZkE=";
  };

  patches = [
@@ -94,40 +100,14 @@ stdenv.mkDerivation (finalAttrs: {
      hash = "sha256-BNB3KlgjpWcZtb9e68Jkc/4xC4K0c+Iisw0eS6ltYXE=";
    })
    ./0001-Fix-up-broken-CMake-rules-for-bundled-pybind-stuff.patch
    (fetchpatch {
      name = "math_opt-only-run-SCIP-tests-if-enabled.patch";
      url = "https://github.com/google/or-tools/commit/b5a2f8ac40dd4bfa4359c35570733171454ec72b.patch";
      hash = "sha256-h96zJkqTtwfBd+m7Lm9r/ks/n8uvY4iSPgxMZe8vtXI=";
    })
    # Fix tests on aarch64-linux
    # https://github.com/google/or-tools/issues/4746
    (fetchpatch {
      url = "https://github.com/google/or-tools/commit/8442c7b1c219b0c8d58ee96d266d81b7c3a19ad2.patch";
      hash = "sha256-HrV9wU3PFMdb3feGt8i5UJNgHuitMRBF9cNrH5RRENQ=";
    })
    # Fix compatibility with highs 1.12.0
    # https://github.com/google/or-tools/issues/4911
    (fetchpatch {
      url = "https://github.com/google/or-tools/commit/6c7c1e7cb5bab2701e5b3b00c0f8397273654d2b.patch";
      includes = [ "ortools/math_opt/solvers/highs_solver_test.cc" ];
      hash = "sha256-/dFk/F/3/BwH5IwIwNU4Ua+4sROPXYCjO8R6jpoZpgo=";
    })
    # Fix compatibility with SCIP 10.0
    # https://github.com/google/or-tools/issues/4912
    (fetchpatch {
      url = "https://github.com/google/or-tools/pull/4932.patch";
      includes = [ "ortools/linear_solver/proto_solver/scip_proto_solver.cc" ];
      hash = "sha256-1jw/r3yAjIpq9o8mqAbNorQgmT1E5nt809N+Gb+D9ZI=";
    })
    # Compatibility with SCIP 10.0 also needs the following patch adjusted for or-tools 9.14
    # https://github.com/google/or-tools/pull/4932/files#diff-9559febee3c6051bab4def3c102cb78cbf8a57fc2be4058ace32f89436c784a9
    ./gscip-scip10.patch
  ];

  # or-tools normally attempts to build Protobuf for the build platform when
  # cross-compiling. Instead, just tell it where to find protoc.
  postPatch = ''
    echo "set(PROTOC_PRG $(type -p protoc))" > cmake/host.cmake
    substituteInPlace CMakeLists.txt \
      --replace-fail 'set(BUILD_protobuf_matchers ON)' 'set(BUILD_protobuf_matchers OFF)'
  ''
  # Patches from OpenSUSE:
  # https://build.opensuse.org/projects/science/packages/google-or-tools/files/google-or-tools.spec?expand=1
@@ -147,7 +127,6 @@ stdenv.mkDerivation (finalAttrs: {
    (lib.cmakeFeature "CMAKE_INSTALL_LIBDIR" "lib")
    (lib.cmakeBool "FETCH_PYTHON_DEPS" false)
    # not packaged in nixpkgs
    (lib.cmakeBool "USE_fuzztest" false)
    (lib.cmakeBool "USE_GLPK" true)
    (lib.cmakeBool "USE_SCIP" withScip)
    (lib.cmakeFeature "Python3_EXECUTABLE" "${python3.pythonOnBuildForHost.interpreter}")
@@ -182,8 +161,9 @@ stdenv.mkDerivation (finalAttrs: {
    eigen
    glpk
    gbenchmark
    gtest
    gtest'
    highs
    protobuf-matchers'
    python3.pkgs.absl-py
    pybind11'
    pybind11-abseil'
@@ -222,6 +202,7 @@ stdenv.mkDerivation (finalAttrs: {
  doCheck = stdenv.hostPlatform.isLinux;

  preCheck = ''
    patchShebangs examples/python
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH''${LD_LIBRARY_PATH:+:}$PWD/lib
  '';

+2 −2
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@
  buildPythonPackage,
  fetchFromGitHub,
  cmake,
  abseil-cpp_202505,
  abseil-cpp_202508,
  protobuf,
  pybind11,
  zlib,
@@ -36,7 +36,7 @@ buildPythonPackage {
  nativeBuildInputs = [ cmake ];

  buildInputs = [
    abseil-cpp_202505
    abseil-cpp_202508
    protobuf
    pybind11
    zlib
+46 −0
Original line number Diff line number Diff line
{
  cmake,
  fetchFromGitHub,
  gtest,
  lib,
  protobuf,
  stdenv,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "protobuf-matchers";
  version = "0.1.1";

  src = fetchFromGitHub {
    owner = "inazarenko";
    repo = "protobuf-matchers";
    tag = "v${finalAttrs.version}";
    hash = "sha256-aIEqmA4JwnGHY80Ehr9tgyxzhAk1nAdiVtPbsI0P0Aw=";
  };

  postPatch = ''
    substituteInPlace CMakeLists.txt \
      --replace-fail \
      'target_include_directories(protobuf-matchers PUBLIC ''${CMAKE_CURRENT_SOURCE_DIR})' \
      'target_include_directories(protobuf-matchers PUBLIC $<BUILD_INTERFACE:''${CMAKE_CURRENT_SOURCE_DIR}> $<INSTALL_INTERFACE:include>)'
    echo 'target_sources(protobuf-matchers PUBLIC FILE_SET HEADERS
        FILES protobuf-matchers/protocol-buffer-matchers.h)' >> CMakeLists.txt
    echo 'install(TARGETS protobuf-matchers
        FILE_SET HEADERS DESTINATION include)' >> CMakeLists.txt
  '';

  nativeBuildInputs = [
    cmake
  ];
  buildInputs = [
    gtest
    protobuf
  ];

  meta = {
    description = "Protocol buffer matchers for gMock/gTest";
    homepage = "https://github.com/inazarenko/protobuf-matchers";
    license = lib.licenses.asl20;
    maintainers = with lib.maintainers; [ andersk ];
  };
})