blob: 8b3dbeb8b1222278f3ef7cdd36872a441ea67572 [file] [log] [blame]
Paul Duffin1c6c1c72020-02-21 10:28:43 +00001// Copyright 2020 Google Inc. All rights reserved.
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
15package cc
16
17import "android/soong/android"
18
19func init() {
20 RegisterLibraryHeadersBuildComponents(android.InitRegistrationContext)
Paul Duffin91756d22020-02-21 16:29:57 +000021
22 // Register sdk member types.
23 android.RegisterSdkMemberType(headersLibrarySdkMemberType)
24}
25
26var headersLibrarySdkMemberType = &librarySdkMemberType{
27 SdkMemberTypeBase: android.SdkMemberTypeBase{
Martin Stjernholmcaa47d72020-07-11 04:52:24 +010028 PropertyName: "native_header_libs",
29 SupportsSdk: true,
30 HostOsDependent: true,
Paul Duffin91756d22020-02-21 16:29:57 +000031 },
32 prebuiltModuleType: "cc_prebuilt_library_headers",
Martin Stjernholmcd07bce2020-03-10 22:37:59 +000033 noOutputFiles: true,
Paul Duffin1c6c1c72020-02-21 10:28:43 +000034}
35
36func RegisterLibraryHeadersBuildComponents(ctx android.RegistrationContext) {
37 ctx.RegisterModuleType("cc_library_headers", LibraryHeaderFactory)
Paul Duffinf5ea9e12020-02-21 10:57:00 +000038 ctx.RegisterModuleType("cc_prebuilt_library_headers", prebuiltLibraryHeaderFactory)
Paul Duffin1c6c1c72020-02-21 10:28:43 +000039}
40
41// cc_library_headers contains a set of c/c++ headers which are imported by
42// other soong cc modules using the header_libs property. For best practices,
43// use export_include_dirs property or LOCAL_EXPORT_C_INCLUDE_DIRS for
44// Make.
45func LibraryHeaderFactory() android.Module {
46 module, library := NewLibrary(android.HostAndDeviceSupported)
47 library.HeaderOnly()
Paul Duffin91756d22020-02-21 16:29:57 +000048 module.sdkMemberTypes = []android.SdkMemberType{headersLibrarySdkMemberType}
Paul Duffin1c6c1c72020-02-21 10:28:43 +000049 return module.Init()
50}
Paul Duffinf5ea9e12020-02-21 10:57:00 +000051
52// cc_prebuilt_library_headers is a prebuilt version of cc_library_headers
53func prebuiltLibraryHeaderFactory() android.Module {
54 module, library := NewPrebuiltLibrary(android.HostAndDeviceSupported)
55 library.HeaderOnly()
56 return module.Init()
57}