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 19project( 20 'perfetto', 21 ['cpp'], 22) 23 24fs = import('fs') 25 26if not fs.is_dir('sdk') 27 error('sdk dir not found, please checkout a release tag, e.g. v14.0') 28endif 29 30cpp = meson.get_compiler('cpp') 31 32deps_perfetto = [dependency('threads')] 33 34if host_machine.system() == 'android' 35 deps_perfetto += cpp.find_library('log') 36endif 37 38lib_perfetto = static_library( 39 'perfetto', 40 sources: 'sdk/perfetto.cc', 41 dependencies: deps_perfetto, 42 install: true, 43 cpp_args: '-std=c++17', 44) 45 46inc_perfetto = include_directories('sdk') 47 48dir_perfetto_trace = join_paths(meson.current_source_dir(), 49 'protos/perfetto/trace') 50 51install_data(dir_perfetto_trace / 'perfetto_trace.proto') 52 53dep_perfetto = declare_dependency( 54 link_with: lib_perfetto, 55 include_directories: inc_perfetto, 56 variables: { 57 'pkgdatadir': dir_perfetto_trace, 58 } 59) 60