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
15// Headers module is in frameworks/av/Android.bp because modules are not allowed
16// to refer to headers in parent directories and the headers live in
17// frameworks/av/include.
18
19package {
20    default_applicable_licenses: ["frameworks_av_camera_ndk_license"],
21}
22
23// Added automatically by a large-scale-change that took the approach of
24// 'apply every license found to every target'. While this makes sure we respect
25// every license restriction, it may not be entirely correct.
26//
27// e.g. GPL in an MIT project might only apply to the contrib/ directory.
28//
29// Please consider splitting the single license below into multiple licenses,
30// taking care not to lose any license_kind information, and overriding the
31// default license using the 'licenses: [...]' property on targets as needed.
32//
33// For unused files, consider creating a 'fileGroup' with "//visibility:private"
34// to attach the license to, and including a comment whether the files may be
35// used in the current project.
36// See: http://go/android-license-faq
37license {
38    name: "frameworks_av_camera_ndk_license",
39    visibility: [":__subpackages__"],
40    license_kinds: [
41        "SPDX-license-identifier-Apache-2.0",
42        "SPDX-license-identifier-MIT",
43        "SPDX-license-identifier-Unicode-DFS",
44    ],
45    license_text: [
46        "NOTICE",
47    ],
48}
49
50ndk_library {
51    name: "libcamera2ndk",
52    symbol_file: "libcamera2ndk.map.txt",
53    first_version: "24",
54    unversioned_until: "current",
55}
56
57ndk_headers {
58    name: "libcamera2ndk_headers",
59    from: "include/camera",
60    to: "camera",
61    srcs: ["include/camera/**/*.h"],
62    license: "NOTICE",
63}
64
65cc_library_shared {
66    name: "libcamera2ndk",
67    srcs: [
68        "NdkCameraManager.cpp",
69        "NdkCameraMetadata.cpp",
70        "NdkCameraDevice.cpp",
71        "NdkCaptureRequest.cpp",
72        "NdkCameraCaptureSession.cpp",
73        "impl/ACameraManager.cpp",
74        "impl/ACameraMetadata.cpp",
75        "impl/ACameraDevice.cpp",
76        "impl/ACameraCaptureSession.cpp",
77    ],
78    shared_libs: [
79        "libbinder",
80        "liblog",
81        "libgui",
82        "libutils",
83        "libandroid_runtime",
84        "libcamera_client",
85        "libstagefright_foundation",
86        "libcutils",
87        "libcamera_metadata",
88        "libmediandk",
89        "libnativewindow",
90    ],
91    header_libs: [
92        "jni_headers",
93    ],
94    cflags: [
95        "-fvisibility=hidden",
96        "-DEXPORT=__attribute__((visibility(\"default\")))",
97        "-Wall",
98        "-Wextra",
99        "-Werror",
100    ],
101    // TODO: jchowdhary@, use header_libs instead b/131165718
102    include_dirs: [
103        "system/media/private/camera/include",
104    ],
105    export_include_dirs: ["include"],
106    export_shared_lib_headers: [
107        "libnativewindow",
108    ],
109    version_script: "libcamera2ndk.map.txt",
110}
111
112cc_library_shared {
113    name: "libcamera2ndk_vendor",
114    vendor: true,
115    srcs: [
116        "ndk_vendor/impl/ACameraDevice.cpp",
117        "ndk_vendor/impl/ACameraManager.cpp",
118        "ndk_vendor/impl/utils.cpp",
119        "impl/ACameraMetadata.cpp",
120        "impl/ACameraCaptureSession.cpp",
121        "NdkCameraMetadata.cpp",
122        "NdkCameraCaptureSession.cpp",
123        "NdkCameraManager.cpp",
124        "NdkCameraDevice.cpp",
125        "NdkCaptureRequest.cpp",
126    ],
127
128    export_include_dirs: ["include"],
129    export_shared_lib_headers: [
130        "libcutils",
131    ],
132    local_include_dirs: [
133        ".",
134        "include",
135        "impl",
136    ],
137    cflags: [
138        "-fvisibility=hidden",
139        "-DEXPORT=__attribute__((visibility(\"default\")))",
140        "-D__ANDROID_VNDK__",
141    ],
142
143    shared_libs: [
144        "libfmq",
145        "libhidlbase",
146        "libhardware",
147        "libnativewindow",
148        "liblog",
149        "libutils",
150        "libstagefright_foundation",
151        "libcutils",
152        "libcamera_metadata",
153        "libmediandk",
154        "android.frameworks.cameraservice.device@2.0",
155        "android.frameworks.cameraservice.device@2.1",
156        "android.frameworks.cameraservice.common@2.0",
157        "android.frameworks.cameraservice.service@2.0",
158        "android.frameworks.cameraservice.service@2.1",
159        "android.frameworks.cameraservice.service@2.2",
160    ],
161    static_libs: [
162        "android.hardware.camera.common@1.0-helper",
163        "libarect",
164    ],
165    // TODO: jchowdhary@, use header_libs instead b/131165718
166    include_dirs: [
167        "system/media/private/camera/include",
168    ],
169    product_variables: {
170        pdk: {
171            enabled: false,
172        },
173    },
174}
175
176cc_test {
177    name: "ACameraNdkVendorTest",
178    vendor: true,
179    srcs: [
180        "ndk_vendor/tests/AImageReaderVendorTest.cpp",
181        "ndk_vendor/tests/ACameraManagerTest.cpp",
182    ],
183    shared_libs: [
184        "libcamera2ndk_vendor",
185        "libcamera_metadata",
186        "libmediandk",
187        "libnativewindow",
188        "libutils",
189        "libui",
190        "libcutils",
191        "liblog",
192    ],
193    static_libs: [
194        "android.hardware.camera.common@1.0-helper",
195    ],
196    cflags: [
197        "-D__ANDROID_VNDK__",
198    ],
199}
200