Skip to content

Commit

Permalink
fix soplex deps; add boost dependency; add cc_binary target (#3515)
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
lperron authored Jan 2, 2025
1 parent fe04071 commit cb2ab76
Show file tree
Hide file tree
Showing 10 changed files with 179 additions and 3 deletions.
36 changes: 36 additions & 0 deletions modules/soplex/7.1.2.bcr.1/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -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",
)

46 changes: 46 additions & 0 deletions modules/soplex/7.1.2.bcr.1/overlay/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -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",
],
)
1 change: 1 addition & 0 deletions modules/soplex/7.1.2.bcr.1/overlay/MODULE.bazel
24 changes: 24 additions & 0 deletions modules/soplex/7.1.2.bcr.1/patches/add_config_dot_h.patch
Original file line number Diff line number Diff line change
@@ -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
7 changes: 7 additions & 0 deletions modules/soplex/7.1.2.bcr.1/patches/add_git_hash_dot_cpp.patch
Original file line number Diff line number Diff line change
@@ -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"
15 changes: 15 additions & 0 deletions modules/soplex/7.1.2.bcr.1/patches/fmt_dot_hpp.patch
Original file line number Diff line number Diff line change
@@ -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"
13 changes: 13 additions & 0 deletions modules/soplex/7.1.2.bcr.1/patches/spxfileio_dot_h.patch
Original file line number Diff line number Diff line change
@@ -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
17 changes: 17 additions & 0 deletions modules/soplex/7.1.2.bcr.1/presubmit.yml
Original file line number Diff line number Diff line change
@@ -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//...'
16 changes: 16 additions & 0 deletions modules/soplex/7.1.2.bcr.1/source.json
Original file line number Diff line number Diff line change
@@ -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="
}
}
7 changes: 4 additions & 3 deletions modules/soplex/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {}
}

0 comments on commit cb2ab76

Please sign in to comment.