From cb2ab764d164234f9f8d1780459fd5ce1fbed504 Mon Sep 17 00:00:00 2001 From: Laurent Perron Date: Thu, 2 Jan 2025 18:47:57 +0100 Subject: [PATCH] fix soplex deps; add boost dependency; add cc_binary target (#3515) Fix soplex: - move zstr as a deps as it leaks on the client build file otherwise (not an issue as it is a header only library) - add missing multiprecision option - add cc_binary rule to build the soplex binary (and verify the compilation went well) --- modules/soplex/7.1.2.bcr.1/MODULE.bazel | 36 +++++++++++++++ .../soplex/7.1.2.bcr.1/overlay/BUILD.bazel | 46 +++++++++++++++++++ .../soplex/7.1.2.bcr.1/overlay/MODULE.bazel | 1 + .../patches/add_config_dot_h.patch | 24 ++++++++++ .../patches/add_git_hash_dot_cpp.patch | 7 +++ .../7.1.2.bcr.1/patches/fmt_dot_hpp.patch | 15 ++++++ .../7.1.2.bcr.1/patches/spxfileio_dot_h.patch | 13 ++++++ modules/soplex/7.1.2.bcr.1/presubmit.yml | 17 +++++++ modules/soplex/7.1.2.bcr.1/source.json | 16 +++++++ modules/soplex/metadata.json | 7 +-- 10 files changed, 179 insertions(+), 3 deletions(-) create mode 100644 modules/soplex/7.1.2.bcr.1/MODULE.bazel create mode 100644 modules/soplex/7.1.2.bcr.1/overlay/BUILD.bazel create mode 120000 modules/soplex/7.1.2.bcr.1/overlay/MODULE.bazel create mode 100644 modules/soplex/7.1.2.bcr.1/patches/add_config_dot_h.patch create mode 100644 modules/soplex/7.1.2.bcr.1/patches/add_git_hash_dot_cpp.patch create mode 100644 modules/soplex/7.1.2.bcr.1/patches/fmt_dot_hpp.patch create mode 100644 modules/soplex/7.1.2.bcr.1/patches/spxfileio_dot_h.patch create mode 100644 modules/soplex/7.1.2.bcr.1/presubmit.yml create mode 100644 modules/soplex/7.1.2.bcr.1/source.json diff --git a/modules/soplex/7.1.2.bcr.1/MODULE.bazel b/modules/soplex/7.1.2.bcr.1/MODULE.bazel new file mode 100644 index 00000000000..3c52a03cc15 --- /dev/null +++ b/modules/soplex/7.1.2.bcr.1/MODULE.bazel @@ -0,0 +1,36 @@ +module( + name = "soplex", + version = "7.1.2.bcr.1", + compatibility_level = 1, +) + +bazel_dep( + name = "platforms", + version = "0.0.10", +) + +bazel_dep( + name = "fmt", + version = "11.1.1", +) + +bazel_dep( + name = "boost.multiprecision", + version = "1.83.0.bcr.1", +) + +bazel_dep( + name = "boost.serialization", + version = "1.83.0.bcr.1", +) + +bazel_dep( + name = "zlib", + version = "1.3.1.bcr.3", +) + +bazel_dep( + name = "zstr", + version = "1.0.7", +) + diff --git a/modules/soplex/7.1.2.bcr.1/overlay/BUILD.bazel b/modules/soplex/7.1.2.bcr.1/overlay/BUILD.bazel new file mode 100644 index 00000000000..4ddb070d763 --- /dev/null +++ b/modules/soplex/7.1.2.bcr.1/overlay/BUILD.bazel @@ -0,0 +1,46 @@ +# Description: +# Soplex is a LP solver, a common tool in Operations Research. + +cc_library( + name = "soplex", + srcs = glob( + ["src/soplex/*.cpp"], + exclude = ["src/git_hash.cpp"], + ), + hdrs = glob( + [ + "src/soplex/*.h", + "src/soplex/*.hpp", + ], + ) + [ + "src/soplex.h", + "src/soplex.hpp", + "src/soplex/git_hash.cpp", + ], + copts = select({ + "@platforms//os:windows": ["/utf-8"], + "//conditions:default": [], + }), + includes = ["src"], + visibility = ["//visibility:public"], + deps = [ + "@boost.multiprecision", + "@boost.serialization", + "@fmt", + "@zstr", + ], +) + +cc_binary( + name = "soplex_interactive", + srcs = ["src/soplexmain.cpp"], + copts = select({ + "@platforms//os:windows": ["/utf-8"], + "//conditions:default": [], + }), + deps = [ + ":soplex", + "@boost.multiprecision", + "@zlib", + ], +) diff --git a/modules/soplex/7.1.2.bcr.1/overlay/MODULE.bazel b/modules/soplex/7.1.2.bcr.1/overlay/MODULE.bazel new file mode 120000 index 00000000000..9b599e3ad9c --- /dev/null +++ b/modules/soplex/7.1.2.bcr.1/overlay/MODULE.bazel @@ -0,0 +1 @@ +../MODULE.bazel \ No newline at end of file diff --git a/modules/soplex/7.1.2.bcr.1/patches/add_config_dot_h.patch b/modules/soplex/7.1.2.bcr.1/patches/add_config_dot_h.patch new file mode 100644 index 00000000000..a9165675618 --- /dev/null +++ b/modules/soplex/7.1.2.bcr.1/patches/add_config_dot_h.patch @@ -0,0 +1,24 @@ +diff --git a/src/soplex/config.h b/src/soplex/config.h +new file mode 100644 +index 00000000..e465106c +--- /dev/null ++++ b/src/soplex/config.h +@@ -0,0 +1,18 @@ ++#ifndef __SPXCONFIG_H__ ++#define __SPXCONFIG_H__ ++ ++#define CMAKE_BUILD_TYPE "Release" ++ ++#define SOPLEX_VERSION_MAJOR 7 ++#define SOPLEX_VERSION_MINOR 1 ++#define SOPLEX_VERSION_PATCH 2 ++#define SOPLEX_VERSION_SUB 0 ++#define SOPLEX_WITH_BOOST ++#define SOPLEX_WITH_CPPMPF ++/* #undef SOPLEX_WITH_FLOAT128 */ ++/* #undef SOPLEX_WITH_GMP */ ++/* #undef SOPLEX_WITH_MPFR */ ++/* #undef SOPLEX_WITH_PAPILO */ ++#define SOPLEX_WITH_ZLIB ++ ++#endif diff --git a/modules/soplex/7.1.2.bcr.1/patches/add_git_hash_dot_cpp.patch b/modules/soplex/7.1.2.bcr.1/patches/add_git_hash_dot_cpp.patch new file mode 100644 index 00000000000..51c4e80064e --- /dev/null +++ b/modules/soplex/7.1.2.bcr.1/patches/add_git_hash_dot_cpp.patch @@ -0,0 +1,7 @@ +diff --git a/src/soplex/git_hash.cpp b/src/soplex/git_hash.cpp +new file mode 100644 +index 00000000..bc2d689d +--- /dev/null ++++ b/src/soplex/git_hash.cpp +@@ -0,0 +1 @@ ++#define SPX_GITHASH "b040369c" diff --git a/modules/soplex/7.1.2.bcr.1/patches/fmt_dot_hpp.patch b/modules/soplex/7.1.2.bcr.1/patches/fmt_dot_hpp.patch new file mode 100644 index 00000000000..30de05ac12e --- /dev/null +++ b/modules/soplex/7.1.2.bcr.1/patches/fmt_dot_hpp.patch @@ -0,0 +1,15 @@ +diff --git a/src/soplex/fmt.hpp b/src/soplex/fmt.hpp +index 934cb085..c3a31bb8 100644 +--- a/src/soplex/fmt.hpp ++++ b/src/soplex/fmt.hpp +@@ -49,8 +49,8 @@ + + /* to provide backwards compatibility use fmt of PaPILO <= 2.3 due to breaking changes in fmt 7 */ + #if !defined(SOPLEX_WITH_PAPILO) || PAPILO_VERSION_MAJOR > 2 || (PAPILO_VERSION_MAJOR == 2 && PAPILO_VERSION_MINOR > 3) +-#include "soplex/external/fmt/format.h" +-#include "soplex/external/fmt/ostream.h" ++#include "fmt/format.h" ++#include "fmt/ostream.h" + #else + #include "papilo/external/fmt/format.h" + #include "papilo/external/fmt/ostream.h" diff --git a/modules/soplex/7.1.2.bcr.1/patches/spxfileio_dot_h.patch b/modules/soplex/7.1.2.bcr.1/patches/spxfileio_dot_h.patch new file mode 100644 index 00000000000..e32a7459235 --- /dev/null +++ b/modules/soplex/7.1.2.bcr.1/patches/spxfileio_dot_h.patch @@ -0,0 +1,13 @@ +diff --git a/src/soplex/spxfileio.h b/src/soplex/spxfileio.h +index 035b30e0..4bff223c 100644 +--- a/src/soplex/spxfileio.h ++++ b/src/soplex/spxfileio.h +@@ -41,7 +41,7 @@ + *----------------------------------------------------------------------------- + */ + #ifdef SOPLEX_WITH_ZLIB +-#include "soplex/external/zstr/zstr.hpp" ++#include "zstr.hpp" + #endif // WITH_GSZSTREAM + + namespace soplex diff --git a/modules/soplex/7.1.2.bcr.1/presubmit.yml b/modules/soplex/7.1.2.bcr.1/presubmit.yml new file mode 100644 index 00000000000..4414b24cd53 --- /dev/null +++ b/modules/soplex/7.1.2.bcr.1/presubmit.yml @@ -0,0 +1,17 @@ +matrix: + platform: + - debian10 + - ubuntu2004 + - macos + - macos_arm64 + - windows + bazel: + - 8.x + - 7.x +tasks: + verify_targets: + name: Verify build targets + platform: ${{ platform }} + bazel: ${{ bazel }} + build_targets: + - '@soplex//...' diff --git a/modules/soplex/7.1.2.bcr.1/source.json b/modules/soplex/7.1.2.bcr.1/source.json new file mode 100644 index 00000000000..70bda97319a --- /dev/null +++ b/modules/soplex/7.1.2.bcr.1/source.json @@ -0,0 +1,16 @@ +{ + "url": "https://github.com/scipopt/soplex/archive/refs/tags/release-712.tar.gz", + "integrity": "sha256-oafX9+MNHbZVSLMvddby7ZvQvyifY560SB09FBxnozI=", + "strip_prefix": "soplex-release-712", + "patches": { + "add_config_dot_h.patch": "sha256-b7x5Pyms8oDiaXQc1u7BLgo33kbDyAXJPsf0XGVfv6s=", + "add_git_hash_dot_cpp.patch": "sha256-dr5ytJPP3IfeKS/F5fnGp37XRvb3HyADwp4TIx7aiXE=", + "fmt_dot_hpp.patch": "sha256-l3uQmHQOXJhsyGfBArkMIUI0n3t1BsvGD2r3d0CtVrc=", + "spxfileio_dot_h.patch": "sha256-g3qdN7pcA2Ef64Kx3vb2xjyNJrKRjLIPJCI6dLkj/N8=" + }, + "patch_strip": 1, + "overlay": { + "BUILD.bazel": "sha256-xFOmYj3tIpHXZOeEhuPEMYrKo8AEOZvgv0lYcKchBY0=", + "MODULE.bazel": "sha256-JSEr3bYeVvq0K35PrwOYgKqGixoRZiH7pZQetttBs5M=" + } +} diff --git a/modules/soplex/metadata.json b/modules/soplex/metadata.json index bcc2e336b04..b38a55c1a72 100644 --- a/modules/soplex/metadata.json +++ b/modules/soplex/metadata.json @@ -2,15 +2,16 @@ "homepage": "https://github.com/scipopt/soplex", "maintainers": [ { - "email": "bcr-maintainers@bazel.build", - "name": "No Maintainer Specified" + "email": "lperron@google.com", + "name": "Laurent Perron" } ], "repository": [ "github:scipopt/soplex" ], "versions": [ - "7.1.2" + "7.1.2", + "7.1.2.bcr.1" ], "yanked_versions": {} }