summaryrefslogtreecommitdiff
path: root/modules/qdldl/0.1.7/patches/add_build_file.patch
blob: 6176f376b7ef3ab9e86073e1bf1cd2d424cbf6c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
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",
+    ],
+)