File: generate_stubs.cmake

package info (click to toggle)
libtgowt 0~git20210627.91d836d%2Bdfsg-3~deb11u1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 121,624 kB
  • sloc: cpp: 1,001,903; ansic: 438,839; asm: 59,305; java: 38,075; python: 17,273; sh: 8,094; objc: 4,256; perl: 1,924; pascal: 1,103; makefile: 958; cs: 471; javascript: 286; xml: 276
file content (47 lines) | stat: -rw-r--r-- 1,652 bytes parent folder | download
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
42
43
44
45
46
47
# This file is part of Desktop App Toolkit,
# a set of libraries for developing nice desktop applications.
#
# For license and copyright information please follow this link:
# https://github.com/desktop-app/legal/blob/master/LEGAL

function(generate_stubs target_name extra_stub_header output_name sigs_file)
    find_package(Python REQUIRED)

    get_filename_component(sigs_file_name ${sigs_file} NAME_WLE)

    set(gen_dst ${CMAKE_CURRENT_BINARY_DIR}/gen)
    file(MAKE_DIRECTORY ${gen_dst})

    set(gen_timestamp ${gen_dst}/${sigs_file_name}_stubs.timestamp)
    set(gen_files
        ${gen_dst}/${output_name}.cc
        ${gen_dst}/modules/desktop_capture/linux/${output_name}.h
    )
    add_custom_command(
    OUTPUT
        ${gen_timestamp}
    BYPRODUCTS
        ${gen_files}
    COMMAND
        ${Python_EXECUTABLE}
        ${tools_loc}/generate_stubs/generate_stubs.py
        --intermediate_dir ${gen_dst}
        --output ${gen_dst}/modules/desktop_capture/linux
        --type posix_stubs
        --extra_stub_header ${extra_stub_header}
        --stubfile_name ${output_name}
        --path_from_source ${gen_dst}
        --path_from_source modules/desktop_capture/linux
        --logging-function "\"RTC_LOG(LS_VERBOSE)\""
        --logging-include "rtc_base/logging.h"
        ${sigs_file}
    COMMAND
        touch ${gen_timestamp}
    COMMENT "Generating stubs ${sigs_file} (${target_name})"
    DEPENDS
        ${tools_loc}/generate_stubs/generate_stubs.py
        ${extra_stub_header}
        ${sigs_file}
    )
    generate_target(${target_name} ${sigs_file_name}_stubs ${gen_timestamp} "${gen_files}" ${gen_dst})
endfunction()