Antonio Caggiano | 5ec0f86 | 2021-03-26 13:16:01 +0100 | [diff] [blame] | 1 | # Copyright (C) 2021 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 | # This meson project only supports the Perfetto SDK |
| 16 | # available from release branches. |
| 17 | # https://perfetto.dev/docs/instrumentation/tracing-sdk |
| 18 | |
| 19 | project( |
| 20 | 'perfetto', |
Chia-I Wu | 2ed2e2d | 2022-10-02 10:54:23 -0700 | [diff] [blame] | 21 | ['cpp'], |
Lalit Maganti | 03d178e | 2022-11-03 16:18:51 +0000 | [diff] [blame] | 22 | default_options: ['cpp_std=c++17'] |
Antonio Caggiano | 5ec0f86 | 2021-03-26 13:16:01 +0100 | [diff] [blame] | 23 | ) |
| 24 | |
| 25 | fs = import('fs') |
| 26 | |
| 27 | if not fs.is_dir('sdk') |
Primiano Tucci | d399a65 | 2021-04-01 13:29:31 +0100 | [diff] [blame] | 28 | error('sdk dir not found, please checkout a release tag, e.g. v14.0') |
Antonio Caggiano | 5ec0f86 | 2021-03-26 13:16:01 +0100 | [diff] [blame] | 29 | endif |
| 30 | |
Chia-I Wu | 2ed2e2d | 2022-10-02 10:54:23 -0700 | [diff] [blame] | 31 | cpp = meson.get_compiler('cpp') |
| 32 | |
| 33 | deps_perfetto = [dependency('threads')] |
| 34 | |
| 35 | if host_machine.system() == 'android' |
| 36 | deps_perfetto += cpp.find_library('log') |
| 37 | endif |
Antonio Caggiano | 5ec0f86 | 2021-03-26 13:16:01 +0100 | [diff] [blame] | 38 | |
| 39 | lib_perfetto = static_library( |
| 40 | 'perfetto', |
| 41 | sources: 'sdk/perfetto.cc', |
Chia-I Wu | 2ed2e2d | 2022-10-02 10:54:23 -0700 | [diff] [blame] | 42 | dependencies: deps_perfetto, |
Antonio Caggiano | 749909b | 2021-10-28 12:36:01 +0200 | [diff] [blame] | 43 | install: true, |
Antonio Caggiano | 5ec0f86 | 2021-03-26 13:16:01 +0100 | [diff] [blame] | 44 | ) |
| 45 | |
| 46 | inc_perfetto = include_directories('sdk') |
| 47 | |
Chia-I Wu | aa5bc7d | 2022-10-01 22:40:40 -0700 | [diff] [blame] | 48 | dir_perfetto_trace = join_paths(meson.current_source_dir(), |
| 49 | 'protos/perfetto/trace') |
| 50 | |
| 51 | install_data(dir_perfetto_trace / 'perfetto_trace.proto') |
| 52 | |
Antonio Caggiano | 5ec0f86 | 2021-03-26 13:16:01 +0100 | [diff] [blame] | 53 | dep_perfetto = declare_dependency( |
| 54 | link_with: lib_perfetto, |
| 55 | include_directories: inc_perfetto, |
Chia-I Wu | aa5bc7d | 2022-10-01 22:40:40 -0700 | [diff] [blame] | 56 | variables: { |
| 57 | 'pkgdatadir': dir_perfetto_trace, |
| 58 | } |
Antonio Caggiano | 5ec0f86 | 2021-03-26 13:16:01 +0100 | [diff] [blame] | 59 | ) |