summaryrefslogtreecommitdiff
path: root/registry/vulkan/scripts/genRelease
blob: f3c4a2ab12006dc4586294d857b1dbd81527ad48 (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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
#!/usr/bin/python3
#
# Copyright 2016-2021 The Khronos Group Inc.
#
# SPDX-License-Identifier: Apache-2.0

import argparse
import subprocess
import sys

from genspec import *

# Eventually, these may be defined by extDependency.py
allVersions = [ 'VK_VERSION_1_0', 'VK_VERSION_1_1', 'VK_VERSION_1_2' ]
Version1_1 = [ 'VK_VERSION_1_0', 'VK_VERSION_1_1' ]
Version1_0 = [ 'VK_VERSION_1_0' ]

if __name__ == '__main__':
    parser = argparse.ArgumentParser()

    parser.add_argument('-internal', action='store_true',
                        help='Generate internal build, not public')
    parser.add_argument('-norefpages', action='store_true',
                        help='Do not generate refpages')
    parser.add_argument('-singlerefpage', action='store_true',
                        help='Generate single-page refpage - NOT SUPPORTED')
    parser.add_argument('-chunked', action='store_true',
                        help='Generate chunked HTML outputs')
    parser.add_argument('-pdf', action='store_true',
                        help='Generate PDF outputs')

    parser.add_argument('-nov12', action='store_false', dest='v12',
                        help='Suppress Vulkan 1.2 targets')
    parser.add_argument('-v11', action='store_true',
                        help='Generate Vulkan 1.1 targets')
    parser.add_argument('-v10', action='store_true',
                        help='Generate Vulkan 1.0 targets')

    parser.add_argument('-nocorespec', action='store_false', dest='corespec',
                        help='Do not generate core API-only targets')
    parser.add_argument('-nokhrspec', action='store_false', dest='khrspec',
                        help='Do not generate core API + KHR extensions-only targets')
    parser.add_argument('-noallspec', action='store_false', dest='allspec',
                        help='Do not generate full API + all extensions targets')

    parser.add_argument('-genpath', action='store',
                        default='gen',
                        help='Path to directory containing generated files')
    parser.add_argument('-repodir', action='store', dest='repoDir',
                        default=None,
                        help='Set the repository directory to build from (overrides defaults)')
    parser.add_argument('-outdir', action='store', dest='outDir',
                        default=None,
                        help='Set the output directory to build into (overrides defaults)')

    args = parser.parse_args()

    # Ensure gen/extDependency.py is up-to-date before we import it.
    # If it is up to date, 'make' will print a useless warning without '-s'.
    subprocess.check_call(['make', '-s', 'GENERATED=' + args.genpath, 'extDependency'])

    # Alter sys.path to import extDependency.py
    sys.path.insert(0, args.genpath)

    from extDependency import allExts, khrExts

    if args.internal:
        # For internal build & pseudo-release
        if args.repoDir == None:
            args.repoDir = '/home/tree/git/vulkan'
        if args.outDir == None:
            args.outDir = '/home/tree/git/vulkan/out'
    else:
        # For public release
        if args.repoDir == None:
            args.repoDir = '/home/tree/git/Vulkan-Docs'
        if args.outDir == None:
            args.outDir = '/home/tree/git/registry/vulkan/specs'

    refPageTargets = ''

    if not args.norefpages:
        # Generate separate reference pages
        refPageTargets += ' manhtmlpages'

    if args.singlerefpage:
        # Generate single-page refpage.
        refPageTargets += ' manhtml'
        if args.pdf:
            refPageTargets += ' manpdf'
        print('echo Info: single-page refpage targets are NOT SUPPORTED')

    specTargets = ' html'
    if args.chunked:
        specTargets += ' chunked'
    if args.pdf:
        specTargets += ' pdf'

    print('echo Info: Building release from', args.repoDir, 'to', args.outDir)
    print('echo Info: Building spec targets', specTargets)
    print('')

    # Current Vulkan 1.2 specs
    if args.v12:
        if args.allspec:
            # Build ref pages and validusage targets only for 1.2 + all exts
            # Formerly set xmlTargets = 'clobber install', but we no longer
            # generate headers in the registry tree.
            buildBranch(targetDir = '1.2-extensions',
                        versions = allVersions,
                        extensions = allExts,
                        ratified = False,
                        apititle = '(with all registered Vulkan extensions)',
                        specTargets = specTargets + ' validusage' + refPageTargets,
                        repoDir = args.repoDir,
                        outDir = args.outDir)

        if args.khrspec:
            buildBranch(targetDir = '1.2-khr-extensions',
                        versions = allVersions,
                        extensions = khrExts,
                        ratified = True,
                        apititle = '(with KHR extensions)',
                        specTargets = specTargets,
                        repoDir = args.repoDir,
                        outDir = args.outDir)

        if args.corespec:
            # Build style guide and registry documentation targets only for 1.2
            # + no extensions.
            buildBranch(targetDir = '1.2',
                        versions = allVersions,
                        extensions = None,
                        ratified = True,
                        apititle = None,
                        specTargets = specTargets + ' styleguide registry',
                        repoDir = args.repoDir,
                        outDir = args.outDir,
                        needRefSources = True)

    # Vulkan 1.1 specs
    if args.v11:
        if args.allspec:
            buildBranch(targetDir = '1.1-extensions',
                        versions = Version1_1,
                        extensions = allExts,
                        ratified = False,
                        apititle = '(with all registered Vulkan extensions)',
                        specTargets = specTargets,
                        repoDir = args.repoDir,
                        outDir = args.outDir)

        if args.khrspec:
            buildBranch(targetDir = '1.1-khr-extensions',
                        versions = Version1_1,
                        extensions = khrExts,
                        ratified = True,
                        apititle = '(with KHR extensions)',
                        specTargets = specTargets,
                        repoDir = args.repoDir,
                        outDir = args.outDir)

        if args.corespec:
            buildBranch(targetDir = '1.1',
                        versions = Version1_1,
                        extensions = None,
                        ratified = True,
                        apititle = None,
                        specTargets = specTargets,
                        repoDir = args.repoDir,
                        outDir = args.outDir)
    else:
        print('echo Info: Not building 1.1 specs yet')


    # Vulkan 1.0 specs.
    if args.v10:
        if args.allspec:
            buildBranch(targetDir = '1.0-extensions',
                        versions = Version1_0,
                        extensions = allExts,
                        ratified = False,
                        apititle = '(with all registered Vulkan extensions)',
                        specTargets = specTargets,
                        repoDir = args.repoDir,
                        outDir = args.outDir)

        if args.khrspec:
            buildBranch(targetDir = '1.0-wsi_extensions',
                        versions = Version1_0,
                        extensions = khrExts,
                        ratified = True,
                        apititle = '(with KHR extensions)',
                        specTargets = specTargets,
                        repoDir = args.repoDir,
                        outDir = args.outDir)

        if args.corespec:
            buildBranch(targetDir = '1.0',
                        versions = Version1_0,
                        extensions = None,
                        ratified = True,
                        apititle = None,
                        specTargets = specTargets,
                        repoDir = args.repoDir,
                        outDir = args.outDir)
    else:
        print('echo Info: Not building 1.0 specs yet')

    print('echo Info: post-generation cleanup')
    createTags(releaseNum(), buildOnFriday())