blob: fce13785296371990a4b3a4a840366f73787eb58 [file] [log] [blame]
Colin Cross45566ba2016-07-12 18:45:19 -07001//
2// Copyright (C) 2013 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
16cc_defaults {
17 name: "libziparchive_flags",
18 cflags: [
19 // ZLIB_CONST turns on const for input buffers, which is pretty standard.
20 "-DZLIB_CONST",
21 "-Werror",
22 "-Wall",
23 ],
24 cppflags: [
25 "-Wold-style-cast",
26 // Incorrectly warns when C++11 empty brace {} initializer is used.
27 // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61489
28 "-Wno-missing-field-initializers",
29 ],
30}
31
32cc_defaults {
33 name: "libziparchive_defaults",
34 srcs: [
35 "zip_archive.cc",
36 "zip_archive_stream_entry.cc",
37 "zip_writer.cc",
38 ],
39
40 target: {
41 windows: {
42 cflags: ["-mno-ms-bitfields"],
43
44 enabled: true,
45 },
46 },
47
48 shared_libs: [
49 "libbase",
50 "liblog",
51 ],
52}
53
54
55cc_library {
56 name: "libziparchive",
57 host_supported: true,
58 defaults: ["libziparchive_defaults", "libziparchive_flags"],
59 static_libs: ["libutils"],
60 shared_libs: ["liblog", "libbase"],
61 target: {
62 android: {
63 static_libs: ["libz"],
64 },
Dan Willemsenab34b472016-11-29 13:32:55 -080065 linux_bionic: {
66 static_libs: ["libz"],
67 enabled: true,
68 },
69 linux: {
70 shared_libs: ["libz-host"],
71 },
72 darwin: {
73 shared_libs: ["libz-host"],
74 },
75 windows: {
Colin Cross45566ba2016-07-12 18:45:19 -070076 shared_libs: ["libz-host"],
77 },
78 },
79}
80
81// Also provide libziparchive-host until everything is switched over to using libziparchive
82cc_library {
83 name: "libziparchive-host",
84 host_supported: true,
85 device_supported: false,
86 defaults: ["libziparchive_defaults", "libziparchive_flags"],
87 shared_libs: ["libz-host"],
88 static_libs: ["libutils"],
89}
90
91// Tests.
92cc_test {
93 name: "ziparchive-tests",
94 host_supported: true,
95 defaults: ["libziparchive_flags"],
96
97 srcs: [
98 "entry_name_utils_test.cc",
99 "zip_archive_test.cc",
100 "zip_writer_test.cc",
101 ],
102 shared_libs: [
103 "libbase",
104 "liblog",
105 ],
106
107 static_libs: [
108 "libziparchive",
109 "libz",
110 "libutils",
111 ],
112
113 target: {
114 host: {
115 cppflags: ["-Wno-unnamed-type-template-args"],
116 },
117 windows: {
118 enabled: true,
119 },
120 },
121}