blob: 106a23ca82a201737860e9c5ac1c66eefee4bdc4 [file] [log] [blame]
# Copyright 2021 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//camera/build/cc_embed_data.gni")
import("//common-mk/mojom_bindings_generator.gni")
import("//common-mk/pkg_config.gni")
group("all") {
deps = [
":cros_camera_algo",
":libcros_camera",
":libcros_camera_pkg_config",
]
if (use.test) {
deps += [
":camera_face_detection_test",
":camera_hal3_helpers_test",
":cbm_test",
":embed_file_toc_test",
":future_test",
"//camera/features/zsl:zsl_helper_test",
]
}
}
pkg_config("target_defaults") {
configs = [ "//camera/build:cros_camera_common" ]
pkg_deps = [
"libcros_camera_android_deps",
"libdrm",
]
defines = [
"USE_CAMERA_FEATURE_HDRNET=${use.camera_feature_hdrnet}",
"USE_CAMERA_FEATURE_PORTRAIT_MODE=${use.camera_feature_portrait_mode}",
]
}
generate_mojom_bindings("libcros_camera_mojom") {
deps = [ "//iioservice/libiioservice_ipc:libiioservice_ipc_mojom" ]
sources = [
"//camera/mojo/algorithm/camera_algorithm.mojom",
"//camera/mojo/camera3.mojom",
"//camera/mojo/camera_common.mojom",
"//camera/mojo/camera_metadata.mojom",
"//camera/mojo/camera_metadata_tags.mojom",
"//camera/mojo/cros_camera_enum.mojom",
"//camera/mojo/cros_camera_service.mojom",
"//camera/mojo/gpu/dmabuf.mojom",
"//camera/mojo/gpu/jpeg_encode_accelerator.mojom",
"//camera/mojo/gpu/mjpeg_decode_accelerator.mojom",
"//camera/mojo/unguessable_token.mojom",
]
mojo_root = "${platform2_root}"
use_pic = true
standalone = true
}
pkg_config("pkg_config_base") {
pkg_deps = [
"gbm",
"libbrillo",
"libexif",
"libsync",
"libudev",
"libyuv",
]
}
source_set("base") {
sources = [
"//camera/common/camera_buffer_manager_impl.cc",
"//camera/common/camera_buffer_manager_internal.cc",
"//camera/common/camera_buffer_utils.cc",
"//camera/common/camera_hal3_helpers.cc",
"//camera/common/embed_file_toc.cc",
"//camera/common/exif_utils.cc",
"//camera/common/future.cc",
"//camera/common/ipc_util.cc",
"//camera/common/metadata_logger.cc",
"//camera/common/timezone.cc",
"//camera/common/udev_watcher.cc",
"//camera/common/utils/camera_config_impl.cc",
]
public_configs = [
":pkg_config_base",
":target_defaults",
]
# -fPIC needed by the libcros_camera.so shared library.
configs += [ "//common-mk:pic" ]
}
pkg_config("pkg_config_mojo_base") {
pkg_deps = [
"libmetrics",
"libmojo",
]
}
source_set("mojo_base") {
sources = [
"//camera/common/camera_metrics_impl.cc",
"//camera/common/camera_mojo_channel_manager_impl.cc",
]
public_configs = [
":pkg_config_mojo_base",
":target_defaults",
]
# -fPIC needed by the libcros_camera.so shared library.
configs += [ "//common-mk:pic" ]
public_deps = [
":base",
":libcros_camera_mojom",
]
}
source_set("camera_algo_bridge") {
sources = [
"//camera/common/camera_algorithm_bridge_impl.cc",
"//camera/common/camera_algorithm_callback_ops_impl.cc",
]
public_configs = [ ":target_defaults" ]
# -fPIC needed by the libcros_camera.so shared library.
configs += [ "//common-mk:pic" ]
public_deps = [
":base",
":mojo_base",
]
}
source_set("sensor_client") {
sources = [
"//camera/common/sensor_hal_client_impl.cc",
"//camera/common/sensor_reader.cc",
]
public_configs = [ ":target_defaults" ]
# -fPIC needed by the libcros_camera.so shared library.
configs += [ "//common-mk:pic" ]
public_deps = [
":base",
":mojo_base",
]
}
source_set("face_detection") {
sources = [ "//camera/common/camera_face_detection.cc" ]
libs = [ "facessd_cros" ]
public_configs = [ ":target_defaults" ]
# -fPIC needed by the libcros_camera.so shared library.
configs += [ "//common-mk:pic" ]
public_deps = [ ":base" ]
}
source_set("jpeg") {
sources = [
"//camera/common/jpeg/jpeg_decode_accelerator_impl.cc",
"//camera/common/jpeg/jpeg_encode_accelerator_impl.cc",
"//camera/common/jpeg_compressor_impl.cc",
]
libs = [ "jpeg" ]
public_configs = [ ":target_defaults" ]
# -fPIC needed by the libcros_camera.so shared library.
configs += [ "//common-mk:pic" ]
public_deps = [
":base",
":mojo_base",
]
}
source_set("camera_connector") {
sources = [
"//camera/common/libcamera_connector/camera_client.cc",
"//camera/common/libcamera_connector/camera_client_ops.cc",
"//camera/common/libcamera_connector/camera_metadata_utils.cc",
"//camera/common/libcamera_connector/camera_module_callbacks.cc",
"//camera/common/libcamera_connector/camera_service_connector.cc",
"//camera/common/libcamera_connector/camera_service_connector_impl.cc",
"//camera/common/libcamera_connector/stream_buffer_manager.cc",
"//camera/common/libcamera_connector/supported_formats.cc",
]
public_configs = [ ":target_defaults" ]
# -fPIC needed by the libcros_camera.so shared library.
configs += [ "//common-mk:pic" ]
public_deps = [
":base",
":mojo_base",
]
}
source_set("v4l2_device") {
sources = [
"//camera/common/v4l2_device/v4l2_device.cc",
"//camera/common/v4l2_device/v4l2_subdevice.cc",
"//camera/common/v4l2_device/v4l2_video_node.cc",
]
public_configs = [ ":target_defaults" ]
# -fPIC needed by the libcros_camera.so shared library.
configs += [ "//common-mk:pic" ]
public_deps = [ ":base" ]
}
source_set("camera_gpu_algorithm") {
sources = [ "//camera/common/camera_gpu_algorithm.cc" ]
libs = [ "portrait_cros" ]
public_configs = [ ":target_defaults" ]
# -fPIC needed by the libcros_camera.so shared library.
configs += [ "//common-mk:pic" ]
public_deps = [ ":base" ]
}
source_set("stream_manipulator") {
sources = [
"//camera/common/still_capture_processor_impl.cc",
"//camera/common/stream_manipulator.cc",
]
public_configs = [ ":target_defaults" ]
# -fPIC needed by the libcros_camera.so shared library.
configs += [ "//common-mk:pic" ]
public_deps = [
":base",
":mojo_base",
]
}
shared_library("libcros_camera") {
output_name = "libcros_camera"
configs += [ ":target_defaults" ]
deps = [
":base",
":camera_algo_bridge",
":camera_connector",
":face_detection",
":jpeg",
":mojo_base",
":sensor_client",
":stream_manipulator",
":v4l2_device",
"//camera/features/zsl",
]
if (use.camera_feature_hdrnet) {
deps += [ "//camera/features/hdrnet" ]
}
if (use.camera_feature_portrait_mode) {
deps += [ ":camera_gpu_algorithm" ]
}
}
generate_pkg_config("libcros_camera_pkg_config") {
name = "libcros_camera"
description = "cros-camera common libraries"
version = getenv("PV")
requires_private = [ "libchrome" ]
requires = [ "libmojo" ]
cflags = [ "-I/usr/include/cros-camera/mojo" ]
libs = [
"-lcros_camera",
"-lcros_camera_mojom",
]
}
executable("cros_camera_algo") {
sources = [
"//camera/common/camera_algorithm_adapter.cc",
"//camera/common/camera_algorithm_main.cc",
"//camera/common/camera_algorithm_ops_impl.cc",
"//camera/common/ipc_util.cc",
]
configs += [ ":target_defaults" ]
libs = [ "dl" ]
pkg_deps = [
"libbrillo",
"libmojo",
]
deps = [
":libcros_camera",
# We only need //camera/mojo/algorithm/camera_algorithm.mojom,
# libcros_camera_mojom provides a superset mojom library containing it.
":libcros_camera_mojom",
]
}
# Build configs for unit tests.
config("target_defaults_test") {
configs = [
"//common-mk:test",
":target_defaults",
]
}
if (use.test) {
executable("camera_face_detection_test") {
sources = [
"//camera/common/camera_face_detection.cc",
"//camera/common/camera_face_detection_test.cc",
]
configs += [ ":target_defaults_test" ]
}
executable("camera_hal3_helpers_test") {
sources = [
"//camera/common/camera_hal3_helpers.cc",
"//camera/common/camera_hal3_helpers_test.cc",
]
configs += [ ":target_defaults_test" ]
}
executable("cbm_test") {
sources = [
"//camera/common/camera_buffer_manager_impl.cc",
"//camera/common/camera_buffer_manager_impl_test.cc",
]
configs += [ ":target_defaults_test" ]
}
executable("future_test") {
sources = [
"//camera/common/future.cc",
"//camera/common/future_test.cc",
]
configs += [ ":target_defaults_test" ]
}
cc_embed_data("embed_file_toc_test_files") {
sources = [
"//camera/common/embed_file_toc.cc",
"//camera/common/embed_file_toc.h",
]
}
executable("embed_file_toc_test") {
sources = [
"//camera/common/embed_file_toc.cc",
"//camera/common/embed_file_toc_test.cc",
]
configs += [ ":target_defaults_test" ]
deps = [ ":embed_file_toc_test_files" ]
}
}