# Description:
#    FLANN is a library for performing fast approximate nearest neighbor
#    searches in high dimensional spaces. It contains a collection of
#    algorithms we found to work best for nearest neighbor search and a system
#    for automatically choosing the best algorithm and optimum parameters
#    depending on the dataset.

licenses(["notice"])  # BSD

package(
    default_visibility = ["//visibility:public"],
    features = [
        "-layering_check",
        "-parse_headers",
    ],
)

FLANN_COPTS = [
    "-fopenmp",
    "-fexceptions",
    "-Wno-non-virtual-dtor",
    "-Wno-unknown-pragmas",
    "-Wno-conversion",
]

BOOST_TARGETS = [
    "@boost//:algorithm",
    "@boost//:align",
    "@boost//:any",
    "@boost//:archive",
    "@boost//:array",
    "@boost//:asio",
    "@boost//:assert",
    "@boost//:atomic",
    "@boost//:beast",
    "@boost//:bimap",
    "@boost//:bind",
    "@boost//:call_traits",
    "@boost//:callable_traits",
    "@boost//:cerrno",
    "@boost//:checked_delete",
    "@boost//:chrono",
    "@boost//:circular_buffer",
    # "@boost//:compute",
    "@boost//:concept",
    "@boost//:concept_archetype",
    "@boost//:concept_check",
    "@boost//:config",
    "@boost//:container",
    # "@boost//:context",
    "@boost//:conversion",
    "@boost//:core",
    # "@boost//:coroutine",
    "@boost//:cstdint",
    "@boost//:current_function",
    "@boost//:date_time",
    "@boost//:detail",
    "@boost//:dynamic_bitset",
    "@boost//:enable_shared_from_this",
    # "@boost//:endian",
    "@boost//:exception",
    "@boost//:exception_ptr",
    # "@boost//:fiber",
    "@boost//:filesystem",
    "@boost//:foreach",
    "@boost//:format",
    "@boost//:function",
    "@boost//:function_types",
    "@boost//:functional",
    "@boost//:fusion",
    "@boost//:get_pointer",
    "@boost//:heap",
    # "@boost//:icl",
    "@boost//:integer",
    "@boost//:interprocess",
    "@boost//:intrusive",
    "@boost//:intrusive_ptr",
    "@boost//:io",
    "@boost//:iostreams",
    "@boost//:is_placeholder",
    "@boost//:iterator",
    "@boost//:lexical_cast",
    "@boost//:limits",
    "@boost//:math",
    "@boost//:mem_fn",
    "@boost//:move",
    "@boost//:mp11",
    "@boost//:mpl",
    "@boost//:multi_index",
    # "@boost//:multiprecision",
    "@boost//:noncopyable",
    "@boost//:none",
    "@boost//:numeric",
    "@boost//:numeric_conversion",
    "@boost//:numeric_ublas",
    "@boost//:operators",
    "@boost//:optional",
    "@boost//:parameter",
    # "@boost//:pool",
    "@boost//:predef",
    "@boost//:preprocessor",
    "@boost//:process",
    "@boost//:program_options",
    "@boost//:property_tree",
    "@boost//:ptr_container",
    "@boost//:random",
    "@boost//:range",
    "@boost//:ratio",
    # "@boost//:rational",
    "@boost//:ref",
    "@boost//:regex",
    "@boost//:scope_exit",
    "@boost//:scoped_array",
    "@boost//:scoped_ptr",
    "@boost//:serialization",
    "@boost//:shared_array",
    "@boost//:shared_ptr",
    "@boost//:signals2",
    "@boost//:smart_ptr",
    "@boost//:spirit",
    "@boost//:static_assert",
    "@boost//:swap",
    "@boost//:system",
    "@boost//:thread",
    "@boost//:throw_exception",
    "@boost//:timer",
    "@boost//:tokenizer",
    # "@boost//:tribool",
    "@boost//:tuple",
    "@boost//:type",
    "@boost//:type_index",
    "@boost//:type_traits",
    "@boost//:typeof",
    "@boost//:unordered",
    "@boost//:utility",
    "@boost//:uuid",
    "@boost//:variant",
    "@boost//:version",
    "@boost//:visit_each",
]

FLANN_DEPS = BOOST_TARGETS + [
    "@hdf5//:hdf5",
]

cc_library(
    name = "flann",
    srcs = glob([
        "src/**/*.cpp",
    ]),
    hdrs = glob([
        "src/**/*.h",
        "src/**/*.hpp",
    ]),
    copts = FLANN_COPTS,
    includes = [
        "src/cpp",
    ],
    linkopts = ["-lgomp"],
    deps = FLANN_DEPS,
)
