• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/python3
2#
3# Copyright (c) 2016-2018 The Khronos Group Inc.
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9#     http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17# Ensure config/extDependency.py is up-to-date before we import it.
18# If it is up to date, 'make' will print a useless warning without '-s'.
19import argparse,subprocess,sys
20subprocess.check_call(['make', '-s', 'config/extDependency.py'])
21
22# Alter sys.path to import config/extDependency.py.
23sys.path = sys.path + [ 'config' ]
24
25from genspec import *
26from extDependency import allExts, khrExts
27
28# Eventually, these may be defined by extDependency.py
29allVersions = [ 'VK_VERSION_1_0', 'VK_VERSION_1_1' ]
30Version1_0 = [ 'VK_VERSION_1_0' ]
31
32if __name__ == '__main__':
33    parser = argparse.ArgumentParser()
34
35    parser.add_argument('-internal', action='store_true',
36                        help='Generate internal build, not public')
37    parser.add_argument('-norefpages', action='store_true',
38                        help='Do not generate refpages')
39    parser.add_argument('-pdf', action='store_true',
40                        help='Always generate PDF outputs')
41    parser.add_argument('-nov11', action='store_false', dest='v11',
42                        help='Suppress Vulkan 1.1 targets')
43    parser.add_argument('-v10', action='store_true',
44                        help='Generate Vulkan 1.0 targets')
45
46    args = parser.parse_args()
47
48    if args.internal:
49        # For internal build & pseudo-release
50        repoDir = '/home/tree/git/vulkan'
51        outDir = '/home/tree/git/vulkan/out'
52    else:
53        # For public release
54        repoDir = '/home/tree/git/Vulkan-Docs'
55        outDir = '/home/tree/git/registry/vulkan/specs'
56
57        # Always build PDF for public releases
58        args.pdf = True
59
60    if args.norefpages:
61        refPageTargets = ''
62    else:
63        # Just generate separate reference pages, not the single-page
64        # 'manhtml' and 'manpdf' refpage targets.
65        refPageTargets = ' manhtmlpages'
66        # refPageTargets += ' manhtml'
67        # if args.pdf:
68        #    refPageTargets += ' manpdf'
69
70    specTargets = ' html'
71    if args.pdf:
72        specTargets += ' pdf'
73
74    print('echo Info: Building release from', repoDir, 'to', outDir)
75    print('echo Info: Building spec targets', specTargets)
76    print('')
77
78    # Vulkan 1.1 specs
79    if args.v11:
80        # Build ref pages and validusage targets only for 1.1 + all
81        # extensions.
82        buildBranch('1.1-extensions',
83                    versions = allVersions,
84                    extensions = allExts,
85                    ratified = False,
86                    apititle = '(with all registered Vulkan extensions)',
87                    xmlTargets = 'clobber install',
88                    specTargets = specTargets + ' validusage' + refPageTargets,
89                    repoDir = repoDir,
90                    outDir = outDir)
91
92        buildBranch('1.1-khr-extensions',
93                    versions = allVersions,
94                    extensions = khrExts,
95                    ratified = True,
96                    apititle = '(with KHR extensions)',
97                    xmlTargets = 'clobber install',
98                    specTargets = specTargets,
99                    repoDir = repoDir,
100                    outDir = outDir)
101
102        # Build style guide and registry documentation targets only for 1.1
103        # + no extensions.
104        buildBranch('1.1',
105                    versions = allVersions,
106                    extensions = None,
107                    ratified = True,
108                    apititle = None,
109                    xmlTargets = 'clobber install',
110                    specTargets = specTargets + ' styleguide registry',
111                    repoDir = repoDir,
112                    outDir = outDir,
113                    needRefSources = True)
114
115    # Vulkan 1.0 specs. Only build the core spec now that 1.1 is out.
116    if args.v10:
117        buildBranch('1.0-extensions',
118                versions = Version1_0,
119                extensions = allExts,
120                ratified = False,
121                apititle = '(with all registered Vulkan extensions)',
122                xmlTargets = 'clobber install',
123                specTargets = specTargets,
124                repoDir = repoDir,
125                outDir = outDir)
126
127        buildBranch('1.0-wsi_extensions',
128                versions = Version1_0,
129                extensions = khrExts,
130                ratified = True,
131                apititle = '(with KHR extensions)',
132                xmlTargets = 'clobber install',
133                specTargets = specTargets,
134                repoDir = repoDir,
135                outDir = outDir)
136
137        buildBranch('1.0',
138                versions = Version1_0,
139                extensions = None,
140                ratified = True,
141                apititle = None,
142                xmlTargets = 'clobber install',
143                specTargets = specTargets,
144                repoDir = repoDir,
145                outDir = outDir)
146    else:
147        print('echo Info: Not building 1.0 specs yet')
148
149    print('echo Info: post-generation cleanup')
150    createTags(releaseNum(), buildOnFriday())
151