Skip to content

Commit 055782a

Browse files
committed
Makefile to import generated scripts and headers when doing a spec update
Motivated by recent problems building the SC 1.0.15 spec update - will import to VulkanSC-Headers and tweak once it's proven out for Vulkan-Headers. The Makefile may need to be modified when directory structure is changed or new files are added.
1 parent e3c37e6 commit 055782a

File tree

2 files changed

+109
-1
lines changed

2 files changed

+109
-1
lines changed

Makefile

+108
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
# Copyright 2024 The Khronos Group Inc.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
# Makefile to update external files generated in other repositories when
5+
# a public specification update is done.
6+
7+
# Needed to get the right version of test, apparently
8+
SHELL = /bin/bash
9+
10+
REVISION = 999
11+
12+
# Location of other repository clones
13+
GIT = ..
14+
SPEC = $(GIT)/Vulkan-Docs
15+
HPP = $(GIT)/Vulkan-Hpp
16+
REGISTRY = $(GIT)/registry/vulkan
17+
18+
update: consistency-check create-branch update-files push-branch
19+
20+
# Working branch for the update, and a test if it exists
21+
BRANCH = update-$(REVISION)
22+
23+
# Switch to new branch which will contain the update
24+
create-branch: consistency-check
25+
git switch -q main
26+
git pull -q
27+
# If branch already exists, do nothing
28+
@if test `git branch -l $(BRANCH) | wc -l` == 1 ; then \
29+
echo "Branch $(BRANCH) already exists" ; \
30+
git switch $(BRANCH) ; \
31+
else \
32+
echo "Creating branch $(BRANCH)" ; \
33+
git switch -c $(BRANCH) ; \
34+
fi
35+
36+
# Update headers and scripts in the new branch
37+
update-files: remove-files update-headers update-scripts
38+
39+
# Vulkan SC Vulkan-Hpp headers not published in the Vulkan-Headers repository
40+
SCHPPFILES = \
41+
include/vulkan/vulkansc.hpp \
42+
include/vulkan/vulkansc.cppm \
43+
include/vulkan/vulkansc_*.hpp
44+
45+
update-headers:
46+
if test ! -d $(SPEC)/gen/include/ ; then \
47+
echo "No C header file source directory $(SPEC)/gen/include" ; \
48+
exit 1 ; \
49+
fi
50+
if test ! -d $(HPP)/vulkan ; then \
51+
echo "No C++ header file source directory $(HPP)/vulkan" ; \
52+
exit 1 ; \
53+
fi
54+
cp -r $(SPEC)/gen/include/* include/
55+
cp -r $(HPP)/vulkan/* include/vulkan/
56+
rm -f $(SCHPPFILES)
57+
58+
# Top-level scripts / XML
59+
SCRIPTS = \
60+
$(SPEC)/scripts/cgenerator.py \
61+
$(SPEC)/scripts/generator.py \
62+
$(SPEC)/scripts/parse_dependency.py \
63+
$(SPEC)/scripts/reg.py \
64+
$(SPEC)/scripts/stripAPI.py \
65+
$(SPEC)/scripts/apiconventions.py \
66+
$(SPEC)/scripts/vkconventions.py \
67+
$(SPEC)/xml/vk.xml \
68+
$(SPEC)/xml/video.xml \
69+
$(REGISTRY)/specs/1.3-extensions/validation/validusage.json
70+
71+
# Scripts in registry/spec_tools
72+
SCRIPT_TOOLS = \
73+
$(SPEC)/scripts/spec_tools/conventions.py \
74+
$(SPEC)/scripts/spec_tools/util.py
75+
76+
# Profiles
77+
PROFILES = \
78+
$(wildcard $(SPEC)/xml/profiles/*)
79+
80+
update-scripts:
81+
cp $(SCRIPTS) registry/
82+
cp $(PROFILES) registry/profiles/
83+
cp $(SCRIPT_TOOLS) registry/spec_tools/
84+
85+
# To ensure updates are caught, old versions of installed files are
86+
# removed.
87+
88+
# Files in include/ to keep
89+
HEADERS_KEEP = \
90+
include/vulkan/vk_icd.h \
91+
include/vulkan/vk_layer.h
92+
93+
remove-files:
94+
rm -rf $(filter-out $(HEADERS_KEEP), $(wildcard include/vulkan/*))
95+
rm -rf include/vk_video
96+
rm -rf registry
97+
mkdir include/vk_video registry registry/profiles registry/spec_tools
98+
99+
# Once the branch is updated, push it to upstream
100+
# This does not actually push it for safety reasons
101+
push-branch:
102+
@echo Verify that all new files are 'git add'ed and obsolete files removed, then:
103+
@echo git commit -m \"Update for Vulkan-Docs 1.3.$(REVISION)\"
104+
@echo git push --set-upstream origin $(BRANCH)
105+
@echo git switch main
106+
107+
consistency-check:
108+
@if test $(REVISION) = 999 ; then echo "Must specify explicit REVISION= in make invocation" ; exit 1 ; fi

registry/stripAPI.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/python3
22
#
3-
# Copyright 2023 The Khronos Group Inc.
3+
# Copyright 2023-2024 The Khronos Group Inc.
44
# SPDX-License-Identifier: Apache-2.0
55

66
import argparse

0 commit comments

Comments
 (0)