1#!/usr/bin/python3 2# 3# Copyright 2016-2022 The Khronos Group Inc. 4# 5# SPDX-License-Identifier: Apache-2.0 6 7import argparse 8import subprocess 9import sys 10 11from genspec import * 12 13# Eventually, these may be defined by the extdependency module 14Version1_3 = [ 'VK_VERSION_1_0', 'VK_VERSION_1_1', 'VK_VERSION_1_2', 'VK_VERSION_1_3' ] 15Version1_2 = [ 'VK_VERSION_1_0', 'VK_VERSION_1_1', 'VK_VERSION_1_2' ] 16Version1_1 = [ 'VK_VERSION_1_0', 'VK_VERSION_1_1' ] 17Version1_0 = [ 'VK_VERSION_1_0' ] 18 19if __name__ == '__main__': 20 parser = argparse.ArgumentParser() 21 22 parser.add_argument('-internal', action='store_true', 23 help='Generate internal build, not public') 24 parser.add_argument('-norefpages', action='store_true', 25 help='Do not generate refpages') 26 parser.add_argument('-singlerefpage', action='store_true', 27 help='Generate single-page refpage - NOT SUPPORTED') 28 parser.add_argument('-chunked', action='store_true', 29 help='Generate chunked HTML outputs') 30 parser.add_argument('-pdf', action='store_true', 31 help='Generate PDF outputs') 32 33 parser.add_argument('-nov13', action='store_false', dest='v13', 34 help='Suppress Vulkan 1.3 targets') 35 parser.add_argument('-v12', action='store_true', 36 help='Generate Vulkan 1.2 targets') 37 parser.add_argument('-v11', action='store_true', 38 help='Generate Vulkan 1.1 targets') 39 parser.add_argument('-v10', action='store_true', 40 help='Generate Vulkan 1.0 targets') 41 42 parser.add_argument('-nocorespec', action='store_false', dest='corespec', 43 help='Do not generate core API-only targets') 44 parser.add_argument('-nokhrspec', action='store_false', dest='khrspec', 45 help='Do not generate core API + KHR extensions-only targets') 46 parser.add_argument('-noallspec', action='store_false', dest='allspec', 47 help='Do not generate full API + all extensions targets') 48 49 parser.add_argument('-registry', action='store', 50 default=None, 51 help='Path to API XML registry file specifying version and extension dependencies') 52 parser.add_argument('-apiname', action='store', 53 default=None, 54 help='API name to generate') 55 56 parser.add_argument('-repodir', action='store', dest='repoDir', 57 default=None, 58 help='Set the repository directory to build from (overrides defaults)') 59 parser.add_argument('-outdir', action='store', dest='outDir', 60 default=None, 61 help='Set the output directory to build into (overrides defaults)') 62 63 args = parser.parse_args() 64 65 # Look for scripts/extdependency.py 66 # This requires makeSpec to be invoked from the repository root, but we 67 # could derive that path. 68 sys.path.insert(0, 'scripts') 69 from extdependency import ApiDependencies 70 71 deps = ApiDependencies(args.registry, args.apiname) 72 73 allExts = deps.allExtensions() 74 khrExts = deps.khrExtensions() 75 76 if args.internal: 77 # For internal build & pseudo-release 78 if args.repoDir == None: 79 args.repoDir = '/home/tree/git/vulkan' 80 if args.outDir == None: 81 args.outDir = '/home/tree/git/vulkan/out' 82 else: 83 # For public release 84 if args.repoDir == None: 85 args.repoDir = '/home/tree/git/Vulkan-Docs' 86 if args.outDir == None: 87 args.outDir = '/home/tree/git/registry/vulkan/specs' 88 89 refPageTargets = '' 90 91 if not args.norefpages: 92 # Generate separate reference pages 93 refPageTargets += ' manhtmlpages' 94 95 if args.singlerefpage: 96 # Generate single-page refpage. 97 refPageTargets += ' manhtml' 98 if args.pdf: 99 refPageTargets += ' manpdf' 100 print('echo Info: single-page refpage targets are NOT SUPPORTED') 101 102 specTargets = ' html' 103 if args.chunked: 104 specTargets += ' chunked' 105 if args.pdf: 106 specTargets += ' pdf' 107 108 print('echo Info: Building release from', args.repoDir, 'to', args.outDir) 109 print('echo Info: Building spec targets', specTargets) 110 print('') 111 112 # Current Vulkan 1.3 specs 113 if args.v13: 114 if args.allspec: 115 # Build ref pages and validusage targets only for 1.3 + all exts 116 # Formerly set xmlTargets = 'clobber install', but we no longer 117 # generate headers in the registry tree. 118 buildBranch(targetDir = '1.3-extensions', 119 versions = Version1_3, 120 extensions = allExts, 121 ratified = False, 122 apititle = '(with all registered Vulkan extensions)', 123 specTargets = specTargets + ' validusage' + refPageTargets, 124 repoDir = args.repoDir, 125 outDir = args.outDir) 126 127 if args.khrspec: 128 buildBranch(targetDir = '1.3-khr-extensions', 129 versions = Version1_3, 130 extensions = khrExts, 131 ratified = True, 132 apititle = '(with KHR extensions)', 133 specTargets = specTargets, 134 repoDir = args.repoDir, 135 outDir = args.outDir) 136 137 if args.corespec: 138 # Build style guide and registry documentation targets only for 1.3 139 # + no extensions. 140 buildBranch(targetDir = '1.3', 141 versions = Version1_3, 142 extensions = None, 143 ratified = True, 144 apititle = None, 145 specTargets = specTargets + ' styleguide registry', 146 repoDir = args.repoDir, 147 outDir = args.outDir, 148 needRefSources = True) 149 150 # Vulkan 1.2 specs 151 if args.v12: 152 if args.allspec: 153 buildBranch(targetDir = '1.2-extensions', 154 versions = Version1_2, 155 extensions = allExts, 156 ratified = False, 157 apititle = '(with all registered Vulkan extensions)', 158 specTargets = specTargets, 159 repoDir = args.repoDir, 160 outDir = args.outDir) 161 162 if args.khrspec: 163 buildBranch(targetDir = '1.2-khr-extensions', 164 versions = Version1_2, 165 extensions = khrExts, 166 ratified = True, 167 apititle = '(with KHR extensions)', 168 specTargets = specTargets, 169 repoDir = args.repoDir, 170 outDir = args.outDir) 171 172 if args.corespec: 173 # Build style guide and registry documentation targets only for 1.2 174 # + no extensions. 175 buildBranch(targetDir = '1.2', 176 versions = Version1_2, 177 extensions = None, 178 ratified = True, 179 apititle = None, 180 specTargets = specTargets + ' styleguide registry', 181 repoDir = args.repoDir, 182 outDir = args.outDir, 183 needRefSources = True) 184 185 # Vulkan 1.1 specs 186 if args.v11: 187 if args.allspec: 188 buildBranch(targetDir = '1.1-extensions', 189 versions = Version1_1, 190 extensions = allExts, 191 ratified = False, 192 apititle = '(with all registered Vulkan extensions)', 193 specTargets = specTargets, 194 repoDir = args.repoDir, 195 outDir = args.outDir) 196 197 if args.khrspec: 198 buildBranch(targetDir = '1.1-khr-extensions', 199 versions = Version1_1, 200 extensions = khrExts, 201 ratified = True, 202 apititle = '(with KHR extensions)', 203 specTargets = specTargets, 204 repoDir = args.repoDir, 205 outDir = args.outDir) 206 207 if args.corespec: 208 buildBranch(targetDir = '1.1', 209 versions = Version1_1, 210 extensions = None, 211 ratified = True, 212 apititle = None, 213 specTargets = specTargets, 214 repoDir = args.repoDir, 215 outDir = args.outDir) 216 else: 217 print('echo Info: Not building 1.1 specs yet') 218 219 220 # Vulkan 1.0 specs. 221 if args.v10: 222 if args.allspec: 223 buildBranch(targetDir = '1.0-extensions', 224 versions = Version1_0, 225 extensions = allExts, 226 ratified = False, 227 apititle = '(with all registered Vulkan extensions)', 228 specTargets = specTargets, 229 repoDir = args.repoDir, 230 outDir = args.outDir) 231 232 if args.khrspec: 233 buildBranch(targetDir = '1.0-wsi_extensions', 234 versions = Version1_0, 235 extensions = khrExts, 236 ratified = True, 237 apititle = '(with KHR extensions)', 238 specTargets = specTargets, 239 repoDir = args.repoDir, 240 outDir = args.outDir) 241 242 if args.corespec: 243 buildBranch(targetDir = '1.0', 244 versions = Version1_0, 245 extensions = None, 246 ratified = True, 247 apititle = None, 248 specTargets = specTargets, 249 repoDir = args.repoDir, 250 outDir = args.outDir) 251 else: 252 print('echo Info: Not building 1.0 specs yet') 253 254 print('echo Info: post-generation cleanup') 255 createTags(releaseNum(), buildOnFriday()) 256