blob: 8276eff0907debfc069b163430e2c6b665ea670d [file] [log] [blame]
Austin Schuhd9e9dea2022-02-20 19:54:42 -08001genrule(
2 name = "make_osqp_configure",
3 outs = ["include/osqp_configure.h"],
4 cmd = "echo > $@",
5)
6
7genrule(
8 name = "make_qdldl_version",
9 outs = ["lin_sys/direct/qdldl/qdldl_sources/include/qdldl_version.h"],
10 cmd = "echo > $@",
11)
12
13genrule(
14 name = "make_qdldl_types",
15 outs = ["lin_sys/direct/qdldl/qdldl_sources/include/qdldl_types.h"],
16 cmd = """cat << EOF > $@
17#ifndef QDLDL_TYPES_H
18# define QDLDL_TYPES_H
19
20# ifdef __cplusplus
21extern "C" {
22# endif /* ifdef __cplusplus */
23
24#include <limits.h> //for the QDLDL_INT_TYPE_MAX
25
26// QDLDL integer and float types
27
28typedef int QDLDL_int; /* for indices */
29typedef double QDLDL_float; /* for numerical values */
30typedef unsigned char QDLDL_bool; /* for boolean values */
31
32//Maximum value of the signed type QDLDL_int.
33#define QDLDL_INT_MAX LLONG_MAX
34
35# ifdef __cplusplus
36}
37# endif /* ifdef __cplusplus */
38
39#endif /* ifndef QDLDL_TYPES_H */
40EOF""",
41)
42
43cc_library(
44 name = "osqp_includes",
45 hdrs = [
46 "include/auxil.h",
47 "include/constants.h",
48 "include/cs.h",
49 "include/ctrlc.h",
50 "include/glob_opts.h",
51 "include/kkt.h",
52 "include/lin_alg.h",
53 "include/lin_sys.h",
54 "include/osqp.h",
55 "include/osqp_configure.h",
56 "include/osqp_error.h",
57 "include/polish.h",
58 "include/proj.h",
59 "include/scaling.h",
60 "include/types.h",
61 "include/util.h",
62 "include/version.h",
63 "lin_sys/lib_handler.h",
64 ],
65 defines = [
66 "IS_LINUX",
67 #"PRINTING",
68 "PROFILING",
69 "CTRLC",
70 # TODO(austin): Use floats instead
71 #"DFLOAT",
72 #"DLONG",
73 "ENABLE_MKL_PARDISO",
74 ],
75 includes = [
76 "include",
77 "lin_sys",
78 ],
79)
80
81cc_library(
82 name = "osqp",
83 srcs = [
84 "lin_sys/direct/pardiso/pardiso_interface.c",
85 "lin_sys/direct/pardiso/pardiso_loader.c",
86 "lin_sys/direct/qdldl/amd/src/SuiteSparse_config.c",
87 "lin_sys/direct/qdldl/amd/src/amd_1.c",
88 "lin_sys/direct/qdldl/amd/src/amd_2.c",
89 "lin_sys/direct/qdldl/amd/src/amd_aat.c",
90 "lin_sys/direct/qdldl/amd/src/amd_control.c",
91 "lin_sys/direct/qdldl/amd/src/amd_defaults.c",
92 "lin_sys/direct/qdldl/amd/src/amd_info.c",
93 "lin_sys/direct/qdldl/amd/src/amd_order.c",
94 "lin_sys/direct/qdldl/amd/src/amd_post_tree.c",
95 "lin_sys/direct/qdldl/amd/src/amd_postorder.c",
96 "lin_sys/direct/qdldl/amd/src/amd_preprocess.c",
97 "lin_sys/direct/qdldl/amd/src/amd_valid.c",
98 "lin_sys/direct/qdldl/qdldl_interface.c",
99 "lin_sys/direct/qdldl/qdldl_sources/src/qdldl.c",
100 "lin_sys/lib_handler.c",
101 "src/auxil.c",
102 "src/cs.c",
103 "src/ctrlc.c",
104 "src/error.c",
105 "src/kkt.c",
106 "src/lin_alg.c",
107 "src/lin_sys.c",
108 "src/osqp.c",
109 "src/polish.c",
110 "src/proj.c",
111 "src/scaling.c",
112 "src/util.c",
113 ],
114 hdrs = [
115 "lin_sys/direct/pardiso/pardiso_interface.h",
116 "lin_sys/direct/pardiso/pardiso_loader.h",
117 "lin_sys/direct/qdldl/amd/include/SuiteSparse_config.h",
118 "lin_sys/direct/qdldl/amd/include/amd.h",
119 "lin_sys/direct/qdldl/amd/include/amd_internal.h",
120 "lin_sys/direct/qdldl/qdldl_interface.h",
121 "lin_sys/direct/qdldl/qdldl_sources/include/qdldl.h",
122 "lin_sys/direct/qdldl/qdldl_sources/include/qdldl_types.h",
123 "lin_sys/direct/qdldl/qdldl_sources/include/qdldl_version.h",
124 ],
125 copts = [
126 "-Wno-cast-qual",
127 ],
128 defines = [
129 'QDLDL_VERSION_MAJOR="0"',
130 'QDLDL_VERSION_MINOR="1"',
131 'QDLDL_VERSION_PATCH="6"',
132 'QDLDL_VERSION="0.1.6"',
133 ],
134 includes = [
135 "lin_sys/direct/pardiso",
136 "lin_sys/direct/qdldl",
137 "lin_sys/direct/qdldl/amd/include",
138 "lin_sys/direct/qdldl/qdldl_sources/include",
139 ],
140 linkopts = ["-ldl"],
141 target_compatible_with = ["@platforms//os:linux"],
142 visibility = ["//visibility:public"],
143 deps = [
144 ":osqp_includes",
145 ],
146)