blob: 98533b2486694898d6cb5b2ea8dabab3a2eb3484 [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
Rupert Shuttleworth54e78412021-02-15 11:04:32 +000017import (
18 "android/soong/android"
Rupert Shuttleworth54e78412021-02-15 11:04:32 +000019)
Paul Duffin1c6c1c72020-02-21 10:28:43 +000020
21func init() {
22 RegisterLibraryHeadersBuildComponents(android.InitRegistrationContext)
Paul Duffin91756d22020-02-21 16:29:57 +000023
24 // Register sdk member types.
25 android.RegisterSdkMemberType(headersLibrarySdkMemberType)
Rupert Shuttleworth54e78412021-02-15 11:04:32 +000026
Paul Duffin91756d22020-02-21 16:29:57 +000027}
28
29var headersLibrarySdkMemberType = &librarySdkMemberType{
30 SdkMemberTypeBase: android.SdkMemberTypeBase{
Martin Stjernholmcaa47d72020-07-11 04:52:24 +010031 PropertyName: "native_header_libs",
32 SupportsSdk: true,
33 HostOsDependent: true,
Paul Duffin93b750e2019-11-19 19:44:10 +000034 Traits: []android.SdkMemberTrait{
35 nativeBridgeSdkTrait,
Paul Duffin12a0a312021-09-15 17:25:10 +010036 ramdiskImageRequiredSdkTrait,
Paul Duffin63696222021-09-06 10:28:34 +010037 recoveryImageRequiredSdkTrait,
Paul Duffin93b750e2019-11-19 19:44:10 +000038 },
Paul Duffin91756d22020-02-21 16:29:57 +000039 },
40 prebuiltModuleType: "cc_prebuilt_library_headers",
Martin Stjernholmcd07bce2020-03-10 22:37:59 +000041 noOutputFiles: true,
Paul Duffin1c6c1c72020-02-21 10:28:43 +000042}
43
44func RegisterLibraryHeadersBuildComponents(ctx android.RegistrationContext) {
45 ctx.RegisterModuleType("cc_library_headers", LibraryHeaderFactory)
Paul Duffinf5ea9e12020-02-21 10:57:00 +000046 ctx.RegisterModuleType("cc_prebuilt_library_headers", prebuiltLibraryHeaderFactory)
Paul Duffin1c6c1c72020-02-21 10:28:43 +000047}
48
49// cc_library_headers contains a set of c/c++ headers which are imported by
50// other soong cc modules using the header_libs property. For best practices,
51// use export_include_dirs property or LOCAL_EXPORT_C_INCLUDE_DIRS for
52// Make.
53func LibraryHeaderFactory() android.Module {
54 module, library := NewLibrary(android.HostAndDeviceSupported)
55 library.HeaderOnly()
Paul Duffin91756d22020-02-21 16:29:57 +000056 module.sdkMemberTypes = []android.SdkMemberType{headersLibrarySdkMemberType}
Paul Duffin1c6c1c72020-02-21 10:28:43 +000057 return module.Init()
58}
Paul Duffinf5ea9e12020-02-21 10:57:00 +000059
60// cc_prebuilt_library_headers is a prebuilt version of cc_library_headers
61func prebuiltLibraryHeaderFactory() android.Module {
Martin Stjernholme65c3ae2021-11-23 01:24:06 +000062 module, library := NewPrebuiltLibrary(android.HostAndDeviceSupported, "")
Paul Duffinf5ea9e12020-02-21 10:57:00 +000063 library.HeaderOnly()
64 return module.Init()
65}