# -*- python -*-

load(
    "//tools:fbstab.bzl",
    "fbstab_cc_googletest",
    "fbstab_cc_library",
)

package(default_visibility = ["//visibility:public"])

# libraries
fbstab_cc_library(
    name = "fbstab_dense",
    srcs = [
        "fbstab_dense.cc",
    ],
    hdrs = ["fbstab_dense.h"],
    deps = [
        ":fbstab_algorithm",
        "//fbstab/components:dense_cholesky_solver",
        "//fbstab/components:dense_data",
        "//fbstab/components:full_feasibility",
        "//fbstab/components:full_residual",
        "//fbstab/components:full_variable",
        "//tools:essential",
        "@eigen",
    ],
)

fbstab_cc_library(
    name = "fbstab_mpc",
    srcs = [
        "fbstab_mpc.cc",
    ],
    hdrs = ["fbstab_mpc.h"],
    deps = [
        ":fbstab_algorithm",
        "//fbstab/components:full_feasibility",
        "//fbstab/components:full_residual",
        "//fbstab/components:full_variable",
        "//fbstab/components:mpc_data",
        "//fbstab/components:riccati_linear_solver",
        "//tools:essential",
        "@eigen",
    ],
)

fbstab_cc_library(
    name = "fbstab_algorithm",
    hdrs = ["fbstab_algorithm.h","fbstab_algorithm-impl.h"],
    deps = [
        "//tools:essential",
    ],
)

# test libraries
fbstab_cc_library(
    name = "ocp_generator",
    srcs = [
        "test/ocp_generator.cc",
    ],
    hdrs = ["test/ocp_generator.h"],
    deps = [
        ":fbstab_mpc",
        "//tools:essential",
        "@eigen",
    ],
)


# tests
fbstab_cc_googletest(
    name = "dense_unit_tests",
    srcs = ["test/fbstab_dense_unit_tests.cc"],
    deps = [
        ":fbstab_dense",
        "@eigen",
    ],
)

fbstab_cc_googletest(
    name = "mpc_unit_tests",
    srcs = ["test/fbstab_mpc_unit_tests.cc"],
    deps = [
        ":fbstab_mpc",
        ":ocp_generator",
        "@eigen",
    ],
)

fbstab_cc_googletest(
    name = "eigen_tests",
    srcs = ["test/eigen_tests.cc"],
    deps = [
        "@eigen",
    ],
)
