File: meson.build

package info (click to toggle)
trace-cmd 3.3.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,056 kB
  • sloc: ansic: 33,750; makefile: 966; sh: 762; python: 604
file content (41 lines) | stat: -rw-r--r-- 1,549 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# SPDX-License-Identifier: GPL-2.0
#
# Copyright (c) 2023 Daniel Wagner, SUSE LLC

want_python = get_option('python')
if want_python != 'false'
    python3 = import('python').find_installation('python3')
    py3_dep = python3.dependency(required: want_python == 'true')
    swig = find_program('swig', required: want_python == 'true')
    header_found = cc.has_header('Python.h', dependencies: py3_dep)
    have_python_support = py3_dep.found() and swig.found() and header_found
else
    have_python_support = false
endif

if have_python_support
    pymod_swig = custom_target(
        'ctracecmd.py',
        input:   ['ctracecmd.i'],
        output:  ['ctracecmd.py', 'ctracecmd_wrap.c'],
        command: [
            swig,
            '-python',
            '-I' + meson.current_source_dir() + '/../include/trace-cmd',
            '-I' + meson.current_source_dir() + '/../lib/trace-cmd/include/private',
            '-I' + libtraceevent_dep.get_pkgconfig_variable('prefix') + '/include/traceevent',
            '-o', '@OUTPUT1@',
            '@INPUT0@'],
        install: true,
        install_dir: [ python3.get_install_dir(pure: false, subdir: 'trace-cmd'), false])

    incdir_py = include_directories(['.', '../include/trace-cmd', '../lib/trace-cmd/include/private'])

    pyctracecmd_clib = python3.extension_module(
        '_ctracecmd',
        pymod_swig[1],
        dependencies : [libtraceevent_dep, libtracefs_dep, py3_dep],
        include_directories: [incdir, incdir_py],
        install: true,
        subdir: 'trace-cmd')
endif