1# Copyright (C) 2016 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#      http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15LOCAL_PATH := $(call my-dir)
16
17include $(CLEAR_VARS)
18
19# Emulator camera module########################################################
20
21emulator_camera_module_relative_path := hw
22emulator_camera_cflags := -fno-short-enums $(VSOC_VERSION_CFLAGS)
23emulator_camera_cflags += \
24    -std=gnu++17 \
25    -Wall \
26    -Werror
27
28emulator_camera_shared_libraries := \
29    libbase \
30    libbinder \
31    libexif \
32    liblog \
33    libutils \
34    libcutils \
35    libui \
36    libdl \
37    libjpeg \
38    libcamera_metadata \
39    libhardware
40
41ifeq (0, $(shell test $(PLATFORM_SDK_VERSION) -lt 27; echo $$?))
42emulator_camera_shared_libraries += libcamera_client
43else
44emulator_camera_static_libraries += android.hardware.camera.common@1.0-helper
45endif
46
47ifeq (0, $(shell test $(PLATFORM_SDK_VERSION) -le 22; echo $$?))
48emulator_camera_shared_libraries += libjsoncpp
49else
50emulator_camera_static_libraries += libjsoncpp
51endif
52
53
54emulator_camera_static_libraries += android.hardware.camera.common@1.0-helper
55
56ifeq (0, $(shell test $(PLATFORM_SDK_VERSION) -le 26; echo $$?))
57emulator_camera_static_libraries += libyuv_static
58else
59emulator_camera_static_libraries += libyuv
60endif
61
62emulator_camera_c_includes := \
63    device/google/cuttlefish \
64    frameworks/native/include/media/hardware \
65    $(call include-path-for, camera) \
66
67emulator_camera_src := \
68	CameraConfiguration.cpp \
69	EmulatedCameraHal.cpp \
70	EmulatedCameraFactory.cpp \
71	EmulatedBaseCamera.cpp \
72	EmulatedCamera.cpp \
73		EmulatedCameraDevice.cpp \
74		EmulatedFakeCamera.cpp \
75		EmulatedFakeCameraDevice.cpp \
76		Exif.cpp \
77		Thumbnail.cpp \
78		Converters.cpp \
79		PreviewWindow.cpp \
80		CallbackNotifier.cpp \
81		JpegCompressor.cpp
82emulated_camera2_src := \
83	VSoCEmulatedCameraHotplugThread.cpp \
84	EmulatedCamera2.cpp \
85		EmulatedFakeCamera2.cpp \
86		fake-pipeline2/Scene.cpp \
87		fake-pipeline2/Sensor.cpp \
88		fake-pipeline2/JpegCompressor.cpp
89emulated_camera3_src := \
90	EmulatedCamera3.cpp \
91		EmulatedFakeCamera3.cpp
92
93
94emulated_camera2_stub_src := \
95	StubEmulatedCamera2.cpp \
96		StubEmulatedFakeCamera2.cpp
97
98enable_emulated_camera3 = $(shell test $(PLATFORM_SDK_VERSION) -ge 23 && echo yes)
99enable_emulated_camera2 = $(shell test $(PLATFORM_SDK_VERSION) -ge 19 && echo yes)
100
101# Emulated camera - cuttlefish / vbox_x86 build###################################
102#
103ifeq (0, $(shell test $(PLATFORM_SDK_VERSION) -ge 24; echo $$?))
104emulator_camera_c_includes += external/libjpeg-turbo
105else
106emulator_camera_c_includes += external/jpeg
107endif
108
109ifeq (0, $(shell test $(PLATFORM_SDK_VERSION) -ge 21; echo $$?))
110LOCAL_MODULE_RELATIVE_PATH := ${emulator_camera_module_relative_path}
111else
112LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/${emulator_camera_module_relative_path}
113endif
114ifeq (true, $(TARGET_TRANSLATE_2ND_ARCH))
115LOCAL_MULTILIB := first
116endif
117LOCAL_CFLAGS := ${emulator_camera_cflags}
118LOCAL_CLANG_CFLAGS += ${emulator_camera_clang_flags}
119
120LOCAL_SHARED_LIBRARIES := ${emulator_camera_shared_libraries}
121LOCAL_STATIC_LIBRARIES := ${emulator_camera_static_libraries}
122LOCAL_C_INCLUDES += ${emulator_camera_c_includes}
123LOCAL_SRC_FILES := ${emulator_camera_src} ${emulator_camera_ext_src} \
124	$(if $(enable_emulated_camera2),$(emulated_camera2_src),) \
125	$(if $(enable_emulated_camera3),$(emulated_camera3_src),)
126
127LOCAL_MODULE := camera.cutf
128LOCAL_MODULE_TAGS := optional
129LOCAL_VENDOR_MODULE := true
130
131include $(BUILD_SHARED_LIBRARY)
132
133# JPEG stub#####################################################################
134
135include $(CLEAR_VARS)
136
137jpeg_module_relative_path := hw
138jpeg_cflags := \
139    -fno-short-enums \
140    -Wall \
141    -Werror
142
143jpeg_shared_libraries := \
144    libcutils \
145    libexif \
146    liblog \
147    libjpeg \
148
149jpeg_c_includes := external/libexif \
150                   frameworks/native/include
151ifeq (0, $(shell test $(PLATFORM_SDK_VERSION) -ge 24; echo $$?))
152jpeg_c_includes += external/libjpeg-turbo
153else
154jpeg_c_includes += external/jpeg
155endif
156
157jpeg_src := \
158    Compressor.cpp \
159    JpegStub.cpp \
160
161# JPEG stub - cuttlefish build####################################################
162
163ifeq (true, $(TARGET_TRANSLATE_2ND_ARCH))
164LOCAL_MULTILIB := first
165endif
166
167LOCAL_C_INCLUDES += ${jpeg_c_includes}
168LOCAL_SRC_FILES := ${jpeg_src}
169
170LOCAL_MODULE_RELATIVE_PATH := ${jpeg_module_relative_path}
171LOCAL_CFLAGS += ${jpeg_cflags}
172
173LOCAL_SHARED_LIBRARIES := ${jpeg_shared_libraries}
174
175LOCAL_C_INCLUDES += ${jpeg_c_includes}
176LOCAL_SRC_FILES := ${jpeg_src}
177
178LOCAL_MODULE := camera.cutf.jpeg
179LOCAL_MODULE_TAGS := optional
180LOCAL_VENDOR_MODULE := true
181
182include $(BUILD_SHARED_LIBRARY)
183