Skip to content

Commit

Permalink
feat: add qdldl (#1421)
Browse files Browse the repository at this point in the history
* feat: add qdldl

Signed-off-by: wep21 <[email protected]>

* update MODULE.bazel

Signed-off-by: wep21 <[email protected]>

* add cmake configure file patch

Signed-off-by: wep21 <[email protected]>

* update build file

Signed-off-by: wep21 <[email protected]>

* update MODULE.bazel

Signed-off-by: wep21 <[email protected]>

* remove linkstatic

Signed-off-by: wep21 <[email protected]>

---------

Signed-off-by: wep21 <[email protected]>
  • Loading branch information
wep21 authored Feb 3, 2024
1 parent 6fa13b2 commit 6cbcb18
Show file tree
Hide file tree
Showing 7 changed files with 471 additions and 0 deletions.
8 changes: 8 additions & 0 deletions modules/qdldl/0.1.7/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module(
name = "qdldl",
version = "0.1.7",
compatibility_level = 1,
)

bazel_dep(name = "platforms", version = "0.0.8")
bazel_dep(name = "rules_cc", version = "0.0.9")
70 changes: 70 additions & 0 deletions modules/qdldl/0.1.7/patches/add_build_file.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
diff --git BUILD.bazel BUILD.bazel
new file mode 100644
index 0000000..aabba4f
--- /dev/null
+++ BUILD.bazel
@@ -0,0 +1,64 @@
+load("@rules_cc//cc:defs.bzl", "cc_library")
+
+load(
+ "//bazel:cmake_configure_file.bzl",
+ "cmake_configure_file",
+)
+
+licenses(["notice"])
+
+package(
+ default_visibility = ["//visibility:public"],
+)
+
+cmake_configure_file(
+ name = "configure_file_types",
+ src = "configure/qdldl_types.h.in",
+ out = "include/qdldl_types.h",
+ # https://github.com/osqp/qdldl/blob/v0.1.6/README.md#custom-types-for-integer-floats-and-booleans
+ defines = [
+ "QDLDL_BOOL_TYPE=unsigned char",
+ # Keep the `int` type sync'd with the build of @osqp_internal and
+ # @scs_internal. See drake/tools/workspace/qdldl_internal/README.md.
+ "QDLDL_INT_TYPE=int",
+ "QDLDL_LONG=0",
+ # Keep the `int` type sync'd with the build of @osqp_internal and
+ # @scs_internal. See drake/tools/workspace/qdldl_internal/README.md.
+ "QDLDL_FLOAT_TYPE=double",
+ "QDLDL_FLOAT=0",
+ # Match this to QDLDL_INT_TYPE above.
+ "QDLDL_INT_TYPE_MAX=INT_MAX",
+ ],
+ visibility = ["//visibility:private"],
+)
+
+cmake_configure_file(
+ name = "configure_file_version",
+ src = "configure/qdldl_version.h.in",
+ out = "include/qdldl_version.h",
+ cmakelists = [
+ "CMakeLists.txt",
+ ],
+ visibility = ["//visibility:private"],
+)
+
+cc_library(
+ name = "qdldl",
+ hdrs = [
+ "include/qdldl.h",
+ ":include/qdldl_types.h",
+ ":include/qdldl_version.h",
+ ],
+ srcs = [
+ "src/qdldl.c",
+ ],
+ copts = [
+ "-fvisibility=hidden",
+ ] + select({
+ "@platforms//os:windows": [],
+ "//conditions:default": ["-Werror=incompatible-pointer-types"],
+ }),
+ includes = [
+ "include",
+ ],
+)
Loading

0 comments on commit 6cbcb18

Please sign in to comment.