summaryrefslogtreecommitdiffstats
path: root/Telegram/cmake/generate_appdata_changelog.cmake
blob: 2d1ac0bbcd62b9c5fff1969fd8ae858fd6a3a986 (plain)
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
# This file is part of Telegram Desktop,
# the official desktop application for the Telegram messaging service.
#
# For license and copyright information please follow this link:
# https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL

function(generate_appdata_changelog target_name changelog_path appdata_path)
    find_package(Python3 REQUIRED)

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

    set(gen_timestamp ${gen_dst}/${target_name}_appdata_changelog.timestamp)
    set(gen_files ${appdata_path})

    add_custom_command(
    OUTPUT
        ${gen_timestamp}
    COMMAND
        ${Python3_EXECUTABLE}
        ${submodules_loc}/build/changelog2appdata.py
        -c "${changelog_path}"
        -a "${appdata_path}"
        -n 10
    COMMAND
        echo 1> ${gen_timestamp}
    COMMENT "Generating AppData changelog (${target_name})"
    DEPENDS
        ${submodules_loc}/build/changelog2appdata.py
        ${changelog_path}
        ${appdata_path}
    )
    generate_target(${target_name} appdata_changelog ${gen_timestamp} "${gen_files}" ${gen_dst})
endfunction()