# -*- mode: python -*-
# vi: set ft=python :

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

# TODO(calderpg-tri) This file is from the OpenCL C++ bindings, and is
# "Copyright (c) 2008-2015 The Khronos Group Inc." with a notice requirement in
# the license. Once voxelized_geometry_tools is used in production code, we
# will need to install that notice.
cc_library(
    name = "cl_hpp",
    hdrs = ["include/voxelized_geometry_tools/cl.hpp"],
    includes = ["include"],
    deps = ["@opencl"],
)

cc_library(
    name = "voxelized_geometry_tools",
    srcs = [
        "src/voxelized_geometry_tools/collision_map.cpp",
        "src/voxelized_geometry_tools/dynamic_spatial_hashed_collision_map.cpp",  # noqa
        "src/voxelized_geometry_tools/tagged_object_collision_map.cpp",
    ],
    hdrs = [
        "include/voxelized_geometry_tools/collision_map.hpp",
        "include/voxelized_geometry_tools/dynamic_spatial_hashed_collision_map.hpp",  # noqa
        "include/voxelized_geometry_tools/signed_distance_field.hpp",
        "include/voxelized_geometry_tools/signed_distance_field_generation.hpp",  # noqa
        "include/voxelized_geometry_tools/tagged_object_collision_map.hpp",
        "include/voxelized_geometry_tools/topology_computation.hpp",
    ],
    includes = ["include"],
    deps = [
        "@common_robotics_utilities",
        "@eigen",
        "@zlib",
    ],
)

cc_library(
    name = "cuda_voxelization_helpers",
    srcs = [
        "src/voxelized_geometry_tools/dummy_cuda_voxelization_helpers.cc",
    ],
    hdrs = [
        "include/voxelized_geometry_tools/cuda_voxelization_helpers.h",
        "include/voxelized_geometry_tools/device_voxelization_interface.hpp",
    ],
    includes = ["include"],
    deps = [
        "@common_robotics_utilities",
        "@eigen",
    ],
)

cc_library(
    name = "opencl_voxelization_helpers",
    srcs = [
        "src/voxelized_geometry_tools/opencl_voxelization_helpers.cc",
    ],
    hdrs = [
        "include/voxelized_geometry_tools/device_voxelization_interface.hpp",
        "include/voxelized_geometry_tools/opencl_voxelization_helpers.h",
    ],
    includes = ["include"],
    deps = [
        ":cl_hpp",
        "@common_robotics_utilities",
        "@eigen",
    ],
)

cc_library(
    name = "pointcloud_voxelization",
    srcs = [
        "src/voxelized_geometry_tools/cpu_pointcloud_voxelization.cpp",
        "src/voxelized_geometry_tools/device_pointcloud_voxelization.cpp",
        "src/voxelized_geometry_tools/pointcloud_voxelization.cpp",
    ],
    hdrs = [
        "include/voxelized_geometry_tools/cpu_pointcloud_voxelization.hpp",
        "include/voxelized_geometry_tools/cuda_voxelization_helpers.h",
        "include/voxelized_geometry_tools/device_pointcloud_voxelization.hpp",
        "include/voxelized_geometry_tools/device_voxelization_interface.hpp",
        "include/voxelized_geometry_tools/opencl_voxelization_helpers.h",
        "include/voxelized_geometry_tools/pointcloud_voxelization.hpp",
        "include/voxelized_geometry_tools/pointcloud_voxelization_interface.hpp",  # noqa
    ],
    includes = ["include"],
    deps = [
        ":voxelized_geometry_tools",
        ":cuda_voxelization_helpers",
        ":opencl_voxelization_helpers",
        "@common_robotics_utilities",
        "@eigen",
        "@zlib",
    ],
)

cc_test(
    name = "pointcloud_voxelization_test",
    srcs = ["test/pointcloud_voxelization_test.cpp"],
    deps = [
        ":voxelized_geometry_tools",
        ":cuda_voxelization_helpers",
        ":opencl_voxelization_helpers",
        ":pointcloud_voxelization",
        "@common_robotics_utilities",
        "@gtest//:without_main",
    ],
)
