From 18ff9fc476a6389bfab4c5b392238f676f2bfc39 Mon Sep 17 00:00:00 2001 From: Matthieu MOREL Date: Mon, 6 May 2024 13:05:34 +0200 Subject: [PATCH] chore(bazel): add MODULE.bazel files for bzlmod Signed-off-by: Matthieu MOREL --- .gitignore | 1 - BUILD.bazel | 45 ++++++++++++++++++++++++--------------------- MODULE.bazel | 17 +++++++++++++++++ 3 files changed, 41 insertions(+), 22 deletions(-) create mode 100644 MODULE.bazel diff --git a/.gitignore b/.gitignore index ee3e66a161..c5661c1a27 100644 --- a/.gitignore +++ b/.gitignore @@ -272,7 +272,6 @@ qjh.mps *.whl bazel* -MODULE.bazel MODULE.bazel.lock # webdemo diff --git a/BUILD.bazel b/BUILD.bazel index d8a34c71b5..c8b6070d03 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -1,5 +1,5 @@ -load("@rules_cc//cc:defs.bzl", "cc_library", "cc_binary", "cc_test") load("@bazel_skylib//rules:copy_file.bzl", "copy_file") +load("@rules_cc//cc:defs.bzl", "cc_library", "cc_binary", "cc_test") copy_file( name = "highs-config", @@ -20,21 +20,21 @@ cc_library( "extern/filereaderlp/*.cpp", "extern/zlib/*.cpp", "src/interfaces/highs_c_api.cpp", - "src/io/*.cpp", - "src/ipm/*.cpp", - "src/ipm/ipx/*.cc", - "src/ipm/basiclu/*.c", - "src/lp_data/*.cpp", - "src/mip/*.cpp", - "src/model/*.cpp", - "src/parallel/*.cpp", - "src/pdlp/*.cpp", - "src/pdlp/cupdlp/*.c", - "src/presolve/*.cpp", - "src/qpsolver/*.cpp", - "src/simplex/*.cpp", - "src/test/*.cpp", - "src/util/*.cpp", + "src/io/*.cpp", + "src/ipm/*.cpp", + "src/ipm/ipx/*.cc", + "src/ipm/basiclu/*.c", + "src/lp_data/*.cpp", + "src/mip/*.cpp", + "src/model/*.cpp", + "src/parallel/*.cpp", + "src/pdlp/*.cpp", + "src/pdlp/cupdlp/*.c", + "src/presolve/*.cpp", + "src/qpsolver/*.cpp", + "src/simplex/*.cpp", + "src/test/*.cpp", + "src/util/*.cpp", ]), hdrs = glob([ "HConfig.h", @@ -42,7 +42,8 @@ cc_library( "src/qpsolver/*.hpp", "src/Highs.h", "extern/filereaderlp/*.hpp", - "extern/zstr/*.hpp"]), + "extern/zstr/*.hpp", + ]), copts = [ "-Wno-unused-variable", "-Wno-unused-but-set-variable", @@ -64,9 +65,11 @@ cc_library( # "src/simplex", # "src/test", # "src/util", - "bazel-bin"], + "bazel-bin", + ], + linkopts = ["-lpthread"], visibility = ["//visibility:public"], - deps = [ + deps = [ "//:config", "@zlib", ], @@ -74,11 +77,11 @@ cc_library( cc_binary( name = "call-highs-example", - srcs= ["examples/call_highs_from_cpp.cpp"], + srcs = ["examples/call_highs_from_cpp.cpp"], + visibility = ["//visibility:public"], deps = [ "//:highs", ], - visibility = ["//visibility:public"] ) ## Add tests diff --git a/MODULE.bazel b/MODULE.bazel new file mode 100644 index 0000000000..369d3002f0 --- /dev/null +++ b/MODULE.bazel @@ -0,0 +1,17 @@ +module( + name = "highs", + version = "0.0.0", +) + +bazel_dep( + name = "bazel_skylib", + version = "1.6.1", +) +bazel_dep( + name = "rules_cc", + version = "0.0.9", +) +bazel_dep( + name = "zlib", + version = "1.3.1.bcr.1", +)