Commit 633c317b authored by Florian Klink's avatar Florian Klink
Browse files

or-tools: enable SCIP support

This adds a new argument, withScip, defaulting to true, which will
configure or-tools with SCIP support.

or-tools usually is built with SCIP support, and only tested like this,
see https://github.com/google/or-tools/pull/4745.

However, SCIP only was introduced to nixpkgs March 2025, that's probably
why or-tools in nixpkgs came without it so far.

If built with SCIP support, we need to propagate scip itself, otherwise
downstream cmake consumers need to set SCIP_ROOT explicitly.
parent 99a29533
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -20,6 +20,9 @@
  swig,
  unzip,
  zlib,

  scipopt-scip,
  withScip ? true,
}:

let
@@ -87,9 +90,13 @@ stdenv.mkDerivation (finalAttrs: {
    (lib.cmakeFeature "CMAKE_INSTALL_LIBDIR" "lib")
    (lib.cmakeBool "FETCH_PYTHON_DEPS" false)
    (lib.cmakeBool "USE_GLPK" true)
    (lib.cmakeBool "USE_SCIP" false)
    (lib.cmakeBool "USE_SCIP" withScip)
    (lib.cmakeFeature "Python3_EXECUTABLE" "${python3.pythonOnBuildForHost.interpreter}")
  ]
  ++ lib.optionals withScip [
    # scip code parts require setting this unfortunately…
    (lib.cmakeFeature "CMAKE_CXX_FLAGS" "-Wno-error=format-security")
  ]
  ++ lib.optionals stdenv.hostPlatform.isDarwin [
    (lib.cmakeBool "CMAKE_MACOSX_RPATH" false)
  ];
@@ -137,7 +144,12 @@ stdenv.mkDerivation (finalAttrs: {
    python3.pkgs.immutabledict
    python3.pkgs.numpy
    python3.pkgs.pandas
  ]
  ++ lib.optionals withScip [
    # Needed for downstream cmake consumers to not need to set SCIP_ROOT explicitly
    scipopt-scip
  ];

  nativeCheckInputs = [
    python3.pkgs.matplotlib
    python3.pkgs.pandas