1#
2# Copyright 2016 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#      http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17LOCAL_PATH := $(call my-dir)
18
19# Prevent the HAL from building on devices not specifically
20# requesting to use it.
21ifeq ($(USE_CAMERA_V4L2_HAL), true)
22
23v4l2_shared_libs := \
24  libbase \
25  libchrome \
26  libcamera_client \
27  libcamera_metadata \
28  libcutils \
29  libexif \
30  libhardware \
31  liblog \
32  libsync \
33  libutils \
34
35v4l2_static_libs := \
36  libyuv_static \
37  libjpeg_static_ndk \
38
39v4l2_cflags := -fno-short-enums -Wall -Wextra -Werror -fvisibility=hidden -DHAVE_JPEG
40
41v4l2_c_includes := $(call include-path-for, camera) \
42  external/libyuv/files/include \
43
44v4l2_src_files := \
45  arc/cached_frame.cpp \
46  arc/exif_utils.cpp \
47  arc/frame_buffer.cpp \
48  arc/image_processor.cpp \
49  arc/jpeg_compressor.cpp \
50  camera.cpp \
51  capture_request.cpp \
52  format_metadata_factory.cpp \
53  metadata/boottime_state_delegate.cpp \
54  metadata/enum_converter.cpp \
55  metadata/metadata.cpp \
56  metadata/metadata_reader.cpp \
57  request_tracker.cpp \
58  static_properties.cpp \
59  stream_format.cpp \
60  v4l2_camera.cpp \
61  v4l2_camera_hal.cpp \
62  v4l2_metadata_factory.cpp \
63  v4l2_wrapper.cpp \
64
65v4l2_test_files := \
66  format_metadata_factory_test.cpp \
67  metadata/control_test.cpp \
68  metadata/default_option_delegate_test.cpp \
69  metadata/enum_converter_test.cpp \
70  metadata/ignored_control_delegate_test.cpp \
71  metadata/map_converter_test.cpp \
72  metadata/menu_control_options_test.cpp \
73  metadata/metadata_reader_test.cpp \
74  metadata/metadata_test.cpp \
75  metadata/no_effect_control_delegate_test.cpp \
76  metadata/partial_metadata_factory_test.cpp \
77  metadata/property_test.cpp \
78  metadata/ranged_converter_test.cpp \
79  metadata/slider_control_options_test.cpp \
80  metadata/state_test.cpp \
81  metadata/tagged_control_delegate_test.cpp \
82  metadata/tagged_control_options_test.cpp \
83  metadata/v4l2_control_delegate_test.cpp \
84  request_tracker_test.cpp \
85  static_properties_test.cpp \
86
87# V4L2 Camera HAL.
88# ==============================================================================
89include $(CLEAR_VARS)
90LOCAL_MODULE := camera.v4l2
91LOCAL_MODULE_RELATIVE_PATH := hw
92LOCAL_CFLAGS += $(v4l2_cflags)
93LOCAL_SHARED_LIBRARIES := $(v4l2_shared_libs)
94LOCAL_STATIC_LIBRARIES := \
95  libgtest_prod \
96  $(v4l2_static_libs) \
97
98LOCAL_C_INCLUDES += $(v4l2_c_includes)
99LOCAL_SRC_FILES := $(v4l2_src_files)
100include $(BUILD_SHARED_LIBRARY)
101
102# Unit tests for V4L2 Camera HAL.
103# ==============================================================================
104include $(CLEAR_VARS)
105LOCAL_MODULE := camera.v4l2_test
106LOCAL_CFLAGS += $(v4l2_cflags)
107LOCAL_SHARED_LIBRARIES := $(v4l2_shared_libs)
108LOCAL_STATIC_LIBRARIES := \
109  libgmock \
110  $(v4l2_static_libs) \
111
112LOCAL_C_INCLUDES += $(v4l2_c_includes)
113LOCAL_SRC_FILES := \
114  $(v4l2_src_files) \
115  $(v4l2_test_files) \
116
117include $(BUILD_NATIVE_TEST)
118
119endif # USE_CAMERA_V4L2_HAL
120