Garfield Tan | 50dd597 | 2017-10-12 12:38:16 -0700 | [diff] [blame] | 1 | // Copyright (C) 2017 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 | |
Lloyd Pique | 016680d | 2017-11-29 17:54:29 -0800 | [diff] [blame] | 15 | // Build and use the "wayland_protocol_codegen" extension. |
| 16 | bootstrap_go_package { |
| 17 | name: "soong-wayland-protocol-codegen", |
| 18 | pkgPath: "android/soong/external/wayland-protocol", |
| 19 | deps: [ |
| 20 | "blueprint", |
| 21 | "blueprint-proptools", |
| 22 | "soong-android", |
| 23 | "soong-genrule", |
| 24 | ], |
| 25 | srcs: [ |
| 26 | "wayland_protocol_codegen.go", |
| 27 | ], |
| 28 | pluginFor: ["soong_build"], |
Garfield Tan | 50dd597 | 2017-10-12 12:38:16 -0700 | [diff] [blame] | 29 | } |
| 30 | |
Lloyd Pique | 016680d | 2017-11-29 17:54:29 -0800 | [diff] [blame] | 31 | filegroup { |
| 32 | name: "wayland_extension_protocols", |
| 33 | srcs: [ |
| 34 | "freedesktop.org/**/*.xml", |
| 35 | "chromium.org/**/*.xml", |
| 36 | ], |
| 37 | } |
| 38 | |
| 39 | // Generate protocol source files used by both client and server |
| 40 | wayland_protocol_codegen { |
| 41 | name: "wayland_extension_protocol_sources", |
Garfield Tan | 50dd597 | 2017-10-12 12:38:16 -0700 | [diff] [blame] | 42 | cmd: "$(location wayland_scanner) code < $(in) > $(out)", |
Lloyd Pique | 016680d | 2017-11-29 17:54:29 -0800 | [diff] [blame] | 43 | suffix: ".c", |
| 44 | srcs: [":wayland_extension_protocols"], |
Garfield Tan | 50dd597 | 2017-10-12 12:38:16 -0700 | [diff] [blame] | 45 | tools: ["wayland_scanner"], |
| 46 | } |
| 47 | |
Lloyd Pique | 016680d | 2017-11-29 17:54:29 -0800 | [diff] [blame] | 48 | // Generate protocol header files used by the client |
| 49 | wayland_protocol_codegen { |
| 50 | name: "wayland_extension_client_protocol_headers", |
| 51 | cmd: "$(location wayland_scanner) client-header < $(in) > $(out)", |
| 52 | suffix: "-client-protocol.h", |
| 53 | srcs: [":wayland_extension_protocols"], |
Garfield Tan | 50dd597 | 2017-10-12 12:38:16 -0700 | [diff] [blame] | 54 | tools: ["wayland_scanner"], |
Garfield Tan | 50dd597 | 2017-10-12 12:38:16 -0700 | [diff] [blame] | 55 | } |
| 56 | |
Sharif Elcott | c3e7775 | 2018-07-25 11:33:44 +0900 | [diff] [blame] | 57 | // Generate protocol header files used by the server |
| 58 | wayland_protocol_codegen { |
| 59 | name: "wayland_extension_server_protocol_headers", |
| 60 | cmd: "$(location wayland_scanner) server-header < $(in) > $(out)", |
| 61 | suffix: "-server-protocol.h", |
| 62 | srcs: [":wayland_extension_protocols"], |
| 63 | tools: ["wayland_scanner"], |
| 64 | } |
| 65 | |
Lloyd Pique | 016680d | 2017-11-29 17:54:29 -0800 | [diff] [blame] | 66 | // Generate a library with the protocol files, configured to export the client |
| 67 | // header files |
Garfield Tan | 50dd597 | 2017-10-12 12:38:16 -0700 | [diff] [blame] | 68 | cc_library_static { |
Lloyd Pique | 016680d | 2017-11-29 17:54:29 -0800 | [diff] [blame] | 69 | name: "libwayland_extension_client_protocols", |
Ben Lin | b7442f2 | 2018-04-25 10:36:04 -0700 | [diff] [blame] | 70 | vendor_available: true, |
Garfield Tan | 50dd597 | 2017-10-12 12:38:16 -0700 | [diff] [blame] | 71 | cflags: [ |
| 72 | "-Wall", |
| 73 | "-Wextra", |
Chih-Hung Hsieh | ae3135a | 2017-10-30 11:02:33 -0700 | [diff] [blame] | 74 | "-Werror", |
Garfield Tan | 50dd597 | 2017-10-12 12:38:16 -0700 | [diff] [blame] | 75 | "-g", |
| 76 | "-fvisibility=hidden" |
| 77 | ], |
| 78 | static_libs: ["libwayland_client"], |
Lloyd Pique | 016680d | 2017-11-29 17:54:29 -0800 | [diff] [blame] | 79 | generated_sources: ["wayland_extension_protocol_sources"], |
| 80 | generated_headers: ["wayland_extension_client_protocol_headers"], |
| 81 | export_generated_headers: ["wayland_extension_client_protocol_headers"], |
Garfield Tan | 50dd597 | 2017-10-12 12:38:16 -0700 | [diff] [blame] | 82 | } |
Garfield Tan | 541e354 | 2017-10-16 16:43:21 -0700 | [diff] [blame] | 83 | |
Jason Macnak | 8b68a95 | 2019-11-20 14:49:18 -0800 | [diff] [blame] | 84 | // Generate a library with the protocol files, configured to export the server |
| 85 | // header files |
| 86 | cc_library_static { |
| 87 | name: "libwayland_extension_server_protocols", |
| 88 | vendor_available: true, |
| 89 | host_supported: true, |
| 90 | cflags: [ |
| 91 | "-Wall", |
| 92 | "-Wextra", |
| 93 | "-Werror", |
| 94 | "-g", |
| 95 | "-fvisibility=hidden" |
| 96 | ], |
| 97 | static_libs: ["libwayland_server"], |
| 98 | generated_sources: ["wayland_extension_protocol_sources"], |
| 99 | generated_headers: ["wayland_extension_server_protocol_headers"], |
| 100 | export_generated_headers: ["wayland_extension_server_protocol_headers"], |
| 101 | } |
| 102 | |
Garfield Tan | 541e354 | 2017-10-16 16:43:21 -0700 | [diff] [blame] | 103 | subdirs = ["flinger_headers"] |