1#!/usr/bin/python3 2# 3# Copyright (c) 2016-2020 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 extDependency.py 14allVersions = [ 'VK_VERSION_1_0', 'VK_VERSION_1_1', 'VK_VERSION_1_2' ] 15Version1_1 = [ 'VK_VERSION_1_0', 'VK_VERSION_1_1' ] 16Version1_0 = [ 'VK_VERSION_1_0' ] 17 18if __name__ == '__main__': 19 parser = argparse.ArgumentParser() 20 21 parser.add_argument('-internal', action='store_true', 22 help='Generate internal build, not public') 23 parser.add_argument('-norefpages', action='store_true', 24 help='Do not generate refpages') 25 parser.add_argument('-singlerefpage', action='store_true', 26 help='Generate single-page refpage - NOT SUPPORTED') 27 parser.add_argument('-chunked', action='store_true', 28 help='Generate chunked HTML outputs') 29 parser.add_argument('-pdf', action='store_true', 30 help='Generate PDF outputs') 31 32 parser.add_argument('-nov12', action='store_false', dest='v12', 33 help='Suppress Vulkan 1.2 targets') 34 parser.add_argument('-v11', action='store_true', 35 help='Generate Vulkan 1.1 targets') 36 parser.add_argument('-v10', action='store_true', 37 help='Generate Vulkan 1.0 targets') 38 39 parser.add_argument('-nocorespec', action='store_false', dest='corespec', 40 help='Do not generate core API-only targets') 41 parser.add_argument('-nokhrspec', action='store_false', dest='khrspec', 42 help='Do not generate core API + KHR extensions-only targets') 43 parser.add_argument('-noallspec', action='store_false', dest='allspec', 44 help='Do not generate full API + all extensions targets') 45 46 parser.add_argument('-genpath', action='store', 47 default='gen', 48 help='Path to directory containing generated files') 49 parser.add_argument('-repodir', action='store', dest='repoDir', 50 default=None, 51 help='Set the repository directory to build from (overrides defaults)') 52 parser.add_argument('-outdir', action='store', dest='outDir', 53 default=None, 54 help='Set the output directory to build into (overrides defaults)') 55 56 args = parser.parse_args() 57 58 # Ensure gen/extDependency.py is up-to-date before we import it. 59 # If it is up to date, 'make' will print a useless warning without '-s'. 60 subprocess.check_call(['make', '-s', 'GENERATED=' + args.genpath, 'extDependency']) 61 62 # Alter sys.path to import extDependency.py 63 sys.path.insert(0, args.genpath) 64 65 from extDependency import allExts, khrExts 66 67 if args.internal: 68 # For internal build & pseudo-release 69 if args.repoDir == None: 70 args.repoDir = '/home/tree/git/vulkan' 71 if args.outDir == None: 72 args.outDir = '/home/tree/git/vulkan/out' 73 else: 74 # For public release 75 if args.repoDir == None: 76 args.repoDir = '/home/tree/git/Vulkan-Docs' 77 if args.outDir == None: 78 args.outDir = '/home/tree/git/registry/vulkan/specs' 79 80 refPageTargets = '' 81 82 if not args.norefpages: 83 # Generate separate reference pages 84 refPageTargets += ' manhtmlpages' 85 86 if args.singlerefpage: 87 # Generate single-page refpage. 88 refPageTargets += ' manhtml' 89 if args.pdf: 90 refPageTargets += ' manpdf' 91 print('echo Info: single-page refpage targets are NOT SUPPORTED') 92 93 specTargets = ' html' 94 if args.chunked: 95 specTargets += ' chunked' 96 if args.pdf: 97 specTargets += ' pdf' 98 99 print('echo Info: Building release from', args.repoDir, 'to', args.outDir) 100 print('echo Info: Building spec targets', specTargets) 101 print('') 102 103 # Current Vulkan 1.2 specs 104 if args.v12: 105 if args.allspec: 106 # Build ref pages and validusage targets only for 1.2 + all exts 107 # Formerly set xmlTargets = 'clobber install', but we no longer 108 # generate headers in the registry tree. 109 buildBranch(targetDir = '1.2-extensions', 110 versions = allVersions, 111 extensions = allExts, 112 ratified = False, 113 apititle = '(with all registered Vulkan extensions)', 114 specTargets = specTargets + ' validusage' + refPageTargets, 115 repoDir = args.repoDir, 116 outDir = args.outDir) 117 118 if args.khrspec: 119 buildBranch(targetDir = '1.2-khr-extensions', 120 versions = allVersions, 121 extensions = khrExts, 122 ratified = True, 123 apititle = '(with KHR extensions)', 124 specTargets = specTargets, 125 repoDir = args.repoDir, 126 outDir = args.outDir) 127 128 if args.corespec: 129 # Build style guide and registry documentation targets only for 1.2 130 # + no extensions. 131 buildBranch(targetDir = '1.2', 132 versions = allVersions, 133 extensions = None, 134 ratified = True, 135 apititle = None, 136 specTargets = specTargets + ' styleguide registry', 137 repoDir = args.repoDir, 138 outDir = args.outDir, 139 needRefSources = True) 140 141 # Vulkan 1.1 specs 142 if args.v11: 143 if args.allspec: 144 buildBranch(targetDir = '1.1-extensions', 145 versions = Version1_1, 146 extensions = allExts, 147 ratified = False, 148 apititle = '(with all registered Vulkan extensions)', 149 specTargets = specTargets, 150 repoDir = args.repoDir, 151 outDir = args.outDir) 152 153 if args.khrspec: 154 buildBranch(targetDir = '1.1-khr-extensions', 155 versions = Version1_1, 156 extensions = khrExts, 157 ratified = True, 158 apititle = '(with KHR extensions)', 159 specTargets = specTargets, 160 repoDir = args.repoDir, 161 outDir = args.outDir) 162 163 if args.corespec: 164 buildBranch(targetDir = '1.1', 165 versions = Version1_1, 166 extensions = None, 167 ratified = True, 168 apititle = None, 169 specTargets = specTargets, 170 repoDir = args.repoDir, 171 outDir = args.outDir) 172 else: 173 print('echo Info: Not building 1.1 specs yet') 174 175 176 # Vulkan 1.0 specs. 177 if args.v10: 178 if args.allspec: 179 buildBranch(targetDir = '1.0-extensions', 180 versions = Version1_0, 181 extensions = allExts, 182 ratified = False, 183 apititle = '(with all registered Vulkan extensions)', 184 specTargets = specTargets, 185 repoDir = args.repoDir, 186 outDir = args.outDir) 187 188 if args.khrspec: 189 buildBranch(targetDir = '1.0-wsi_extensions', 190 versions = Version1_0, 191 extensions = khrExts, 192 ratified = True, 193 apititle = '(with KHR extensions)', 194 specTargets = specTargets, 195 repoDir = args.repoDir, 196 outDir = args.outDir) 197 198 if args.corespec: 199 buildBranch(targetDir = '1.0', 200 versions = Version1_0, 201 extensions = None, 202 ratified = True, 203 apititle = None, 204 specTargets = specTargets, 205 repoDir = args.repoDir, 206 outDir = args.outDir) 207 else: 208 print('echo Info: Not building 1.0 specs yet') 209 210 print('echo Info: post-generation cleanup') 211 createTags(releaseNum(), buildOnFriday()) 212