Skip to content

Commit

Permalink
add new SCIP patch with both sequential and parallel scip libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
lperron committed Dec 3, 2024
1 parent d122297 commit d205d87
Show file tree
Hide file tree
Showing 10 changed files with 598 additions and 10 deletions.
18 changes: 18 additions & 0 deletions modules/scip/9.2.0.bcr.1/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module(
name = "scip",
version = "9.2.0.bcr.1",
compatibility_level = 1,
)

bazel_dep(
name = "bliss",
version = "0.73",
)
bazel_dep(
name = "platforms",
version = "0.0.9",
)
bazel_dep(
name = "zlib",
version = "1.2.13",
)
196 changes: 196 additions & 0 deletions modules/scip/9.2.0.bcr.1/patches/add_build_file.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
Diff --git a/BUILD.bazel b/BUILD.bazel
new file mode 100644
index 0000000000..0c3f1853b4
--- /dev/null
+++ b/BUILD.bazel
@@ -0,0 +1,190 @@
+# Copyright 2010-2024 Google LLC
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+exports_files(
+ ["src/lpi/lpi_glop.cpp"],
+)
+
+config_setting(
+ name = "on_linux",
+ constraint_values = [
+ "@platforms//os:linux",
+ ],
+)
+
+config_setting(
+ name = "on_macos",
+ constraint_values = [
+ "@platforms//os:macos",
+ ],
+)
+
+config_setting(
+ name = "on_windows",
+ constraint_values = [
+ "@platforms//os:windows",
+ ],
+)
+
+PLATFORM_FLAGS = select({
+ "on_linux": [
+ "-Wunknown-pragmas",
+ "-fexceptions",
+ "-DSYM=bliss",
+ ],
+ "on_macos": [
+ "-Wunknown-pragmas",
+ "-fexceptions",
+ "-DSYM=bliss",
+ ],
+ "on_windows": [
+ "/DSYM=none",
+ "/DSCIP_NO_SIGACTION",
+ "/DSCIP_NO_STRTOK_R",
+ ],
+ "//conditions:default": [],
+})
+
+PLATFORM_DEPS = select({
+ "on_linux": ["@bliss"],
+ "on_macos": ["@bliss"],
+ "on_windows": [],
+ "//conditions:default": [],
+})
+
+BLISS_FILE = select({
+ "on_linux": ["src/symmetry/compute_symmetry_bliss.cpp"],
+ "on_macos": ["src/symmetry/compute_symmetry_bliss.cpp"],
+ "on_windows": ["src/symmetry/compute_symmetry_none.cpp"],
+ "//conditions:default": ["src/symmetry/compute_symmetry_none.cpp"],
+})
+
+cc_library(
+ name = "scip",
+ srcs = glob(
+ [
+ "src/*/*.c",
+ ],
+ exclude = [
+ "src/lpi/lpi_*.c",
+ "src/nauty/*",
+ "src/scip/exprinterpret_*.c",
+ "src/scip/nlpi_filtersqp.c",
+ "src/scip/nlpi_worhp.c",
+ "src/scip/*_xyz.c",
+ "src/scip/sorttpl.c",
+ "src/symmetry/compute_symmetry_*.cpp",
+ "src/symmetry/*nauty*",
+ "src/tpi/tpi_*.c",
+ ],
+ ) + BLISS_FILE + [
+ "src/scip/exprinterpret_none.c",
+ "src/tpi/tpi_none.c",
+ ],
+ hdrs = glob(
+ [
+ "src/*/*.h",
+ "src/*/*.hpp",
+ "src/scip/githash.c",
+ "src/scip/sorttpl.c",
+ "src/scip/buildflags.c",
+ ],
+ exclude =
+ [
+ "src/scip/*_xyz.h",
+ ],
+ ),
+ copts = [
+ "$(STACK_FRAME_UNLIMITED)", # src/scip/reader_cnf.c
+ "-DTPI_NONE",
+ "-DNPARASCIP",
+ ] + PLATFORM_FLAGS,
+ defines = [
+ # We need every library and binary that depends on SCIP libraries to
+ # define this macro. That is why we use `defines' here instead of
+ # `copts' or `local_defines'.
+ "NO_CONFIG_HEADER",
+ ],
+ features = ["-parse_headers"],
+ includes = [
+ "src",
+ ],
+ visibility = ["//visibility:public"],
+ deps = [
+ "@zlib",
+ ] + PLATFORM_DEPS,
+)
+
+cc_library(
+ name = "parallel_scip",
+ srcs = glob(
+ [
+ "src/*/*.c",
+ ],
+ exclude = [
+ "src/lpi/lpi_*.c",
+ "src/nauty/*",
+ "src/scip/exprinterpret_*.c",
+ "src/scip/nlpi_filtersqp.c",
+ "src/scip/nlpi_worhp.c",
+ "src/scip/*_xyz.c",
+ "src/scip/sorttpl.c",
+ "src/symmetry/compute_symmetry_*.cpp",
+ "src/symmetry/*nauty*",
+ "src/tpi/tpi_*.c",
+ ],
+ ) + BLISS_FILE + [
+ "src/scip/exprinterpret_none.c",
+ "src/tpi/tpi_tnycthrd.c",
+ ],
+ hdrs = glob(
+ [
+ "src/*/*.h",
+ "src/*/*.hpp",
+ "src/scip/githash.c",
+ "src/scip/sorttpl.c",
+ "src/scip/buildflags.c",
+ ],
+ exclude =
+ [
+ "src/scip/*_xyz.h",
+ ],
+ ),
+ copts = [
+ "$(STACK_FRAME_UNLIMITED)", # src/scip/reader_cnf.c
+ "_DTPI_TNY", # src/tpi/type_tpi_tnycthrd.h
+ # Compile in thead-safe mode (required since we use TPI_TNYC). Note,
+ # one does not technically need to add this, as SCIP code always
+ # uses syntax like "#ifndef NPARASCIP". But let's be explicit here.
+ "-DPARASCIP",
+ "-Isrc",
+ "-Isrc/scip",
+ ] + PLATFORM_FLAGS,
+ defines = [
+ # Scip v800 and up optionally depends on scip/config.h and
+ # scip/scip_export.h that are generated by build system.
+ #
+ # We need every library and binary that depends on SCIP libraries to
+ # define this macro. That is why we use `defines' here instead of
+ # `copts' or `local_defines'.
+ "NO_CONFIG_HEADER",
+ ],
+ features = ["-parse_headers"],
+ includes = [
+ "src",
+ ],
+ visibility = ["//visibility:public"],
+ deps = [
+ "@zlib",
+ ] + PLATFORM_DEPS,
+)
132 changes: 132 additions & 0 deletions modules/scip/9.2.0.bcr.1/patches/add_build_file.patch~
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
Diff --git a/BUILD.bazel b/BUILD.bazel
new file mode 100644
index 0000000000..0c3f1853b4
--- /dev/null
+++ b/BUILD.bazel
@@ -0,0 +1,126 @@
+# Copyright 2010-2024 Google LLC
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+exports_files(
+ ["src/lpi/lpi_glop.cpp"],
+)
+
+config_setting(
+ name = "on_linux",
+ constraint_values = [
+ "@platforms//os:linux",
+ ],
+)
+
+config_setting(
+ name = "on_macos",
+ constraint_values = [
+ "@platforms//os:macos",
+ ],
+)
+
+config_setting(
+ name = "on_windows",
+ constraint_values = [
+ "@platforms//os:windows",
+ ],
+)
+
+PLATFORM_FLAGS = select({
+ "on_linux": [
+ "-Wunknown-pragmas",
+ "-fexceptions",
+ "-DSYM=bliss",
+ ],
+ "on_macos": [
+ "-Wunknown-pragmas",
+ "-fexceptions",
+ "-DSYM=bliss",
+ ],
+ "on_windows": [
+ "/DSYM=none",
+ "/DSCIP_NO_SIGACTION",
+ "/DSCIP_NO_STRTOK_R",
+ ],
+ "//conditions:default": [],
+})
+
+PLATFORM_DEPS = select({
+ "on_linux": ["@bliss"],
+ "on_macos": ["@bliss"],
+ "on_windows": [],
+ "//conditions:default": [],
+})
+
+BLISS_FILE = select({
+ "on_linux": ["src/symmetry/compute_symmetry_bliss.cpp"],
+ "on_macos": ["src/symmetry/compute_symmetry_bliss.cpp"],
+ "on_windows": ["src/symmetry/compute_symmetry_none.cpp"],
+ "//conditions:default": ["src/symmetry/compute_symmetry_none.cpp"],
+})
+
+cc_library(
+ name = "scip",
+ srcs = glob(
+ [
+ "src/*/*.c",
+ ],
+ exclude = [
+ "src/lpi/lpi_*.c",
+ "src/nauty/*",
+ "src/scip/exprinterpret_*.c",
+ "src/scip/nlpi_filtersqp.c",
+ "src/scip/nlpi_worhp.c",
+ "src/scip/*_xyz.c",
+ "src/scip/sorttpl.c",
+ "src/symmetry/compute_symmetry_*.cpp",
+ "src/symmetry/*nauty*",
+ "src/tpi/tpi_*.c",
+ ],
+ ) + BLISS_FILE + [
+ "src/scip/exprinterpret_none.c",
+ "src/tpi/tpi_none.c",
+ ],
+ hdrs = glob(
+ [
+ "src/*/*.h",
+ "src/*/*.hpp",
+ "src/scip/githash.c",
+ "src/scip/sorttpl.c",
+ "src/scip/buildflags.c",
+ ],
+ exclude =
+ [
+ "src/scip/*_xyz.h",
+ ],
+ ),
+ copts = [
+ "$(STACK_FRAME_UNLIMITED)", # src/scip/reader_cnf.c
+ "-DTPI_NONE",
+ "-DNPARASCIP",
+ ] + PLATFORM_FLAGS,
+ defines = [
+ # We need every library and binary that depends on SCIP libraries to
+ # define this macro. That is why we use `defines' here instead of
+ # `copts' or `local_defines'.
+ "NO_CONFIG_HEADER",
+ ],
+ features = ["-parse_headers"],
+ includes = [
+ "src",
+ ],
+ visibility = ["//visibility:public"],
+ deps = [
+ "@zlib",
+ ] + PLATFORM_DEPS,
+)
21 changes: 21 additions & 0 deletions modules/scip/9.2.0.bcr.1/patches/module_dot_bazel.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
--- a/MODULE.bazel
+++ a/MODULE.bazel
@@ -0,0 +1,18 @@
+module(
+ name = "scip",
+ version = "9.2.0.bcr.1",
+ compatibility_level = 1,
+)
+
+bazel_dep(
+ name = "bliss",
+ version = "0.73",
+)
+bazel_dep(
+ name = "platforms",
+ version = "0.0.9",
+)
+bazel_dep(
+ name = "zlib",
+ version = "1.2.13",
+)
Loading

0 comments on commit d205d87

Please sign in to comment.