Skip to content

Commit 866d167

Browse files
committed
Merge remote-tracking branch 'real-origin/main' into asudarsa/add_fp_max_error_support
2 parents 9bebe86 + 8e2ad27 commit 866d167

File tree

21 files changed

+570
-175
lines changed

21 files changed

+570
-175
lines changed

.github/workflows/presubmit.yml

Lines changed: 87 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
name: Presubmit
22
on: [push, pull_request]
33

4+
permissions:
5+
contents: read
6+
47
jobs:
58
build:
69
name: Build ${{ matrix.os }}
@@ -9,7 +12,7 @@ jobs:
912
matrix:
1013
os: [ubuntu-latest, macos-latest, windows-latest]
1114
steps:
12-
- uses: actions/checkout@v2
15+
- uses: actions/checkout@v3
1316
- name: Install Ubuntu packages
1417
if: matrix.os == 'ubuntu-latest'
1518
run: sudo apt install -y dos2unix
@@ -35,3 +38,86 @@ jobs:
3538
./bin/makeHeaders
3639
- name: Check generated headers
3740
run: git diff --exit-code
41+
42+
test_cmake_min_required:
43+
runs-on: ubuntu-latest
44+
steps:
45+
- uses: actions/checkout@v3
46+
- uses: lukka/get-cmake@latest
47+
with:
48+
cmakeVersion: 3.14.0
49+
- name: CMake build
50+
run: |
51+
cmake -S . -B build/ -D CMAKE_BUILD_TYPE=Debug -G "Ninja" -D CMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/build/install/
52+
cmake --build build --target install
53+
54+
test_cmake_latest:
55+
runs-on: ubuntu-latest
56+
steps:
57+
- uses: actions/checkout@v3
58+
- uses: lukka/get-cmake@latest
59+
- name: CMake build
60+
run: |
61+
cmake -S . -B build/ -D CMAKE_BUILD_TYPE=Debug -G "Ninja"
62+
cmake --install build/ --prefix build/install
63+
64+
add_subdirectory:
65+
runs-on: ubuntu-latest
66+
steps:
67+
- uses: actions/checkout@v3
68+
- uses: lukka/get-cmake@latest
69+
with:
70+
cmakeVersion: 3.15.0
71+
- name: Build spirv-headers with testing enabled
72+
run: |
73+
cmake -S . -B build/ -D BUILD_TESTS=ON -D CMAKE_BUILD_TYPE=Debug -G "Ninja"
74+
cmake --build build
75+
76+
find_package:
77+
runs-on: ubuntu-latest
78+
steps:
79+
- uses: actions/checkout@v3
80+
- uses: lukka/get-cmake@latest
81+
with:
82+
cmakeVersion: 3.15.0
83+
- name: Install spirv-headers
84+
run: |
85+
cmake -S . -B build/
86+
cmake --install build/ --prefix build/install
87+
- name: Check spirv-headers find_package support
88+
run: |
89+
cmake -S tests/find_package -B tests/find_package/build/ -D CMAKE_PREFIX_PATH=${GITHUB_WORKSPACE}/build/install
90+
cmake --build tests/find_package/build/
91+
92+
find_pkg_config:
93+
runs-on: ubuntu-latest
94+
steps:
95+
- uses: actions/checkout@v3
96+
- uses: lukka/get-cmake@latest
97+
with:
98+
cmakeVersion: 3.15.0
99+
- name: Install spirv-headers
100+
run: |
101+
cmake -S . -B build/ -D CMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/build/install/
102+
cmake --install build/
103+
- name: Check spirv-headers pkg_config support
104+
run: |
105+
cmake -S tests/pkg_config -B tests/pkg_config/build/ -D CMAKE_PREFIX_PATH=${GITHUB_WORKSPACE}/build/install
106+
cmake --build tests/pkg_config/build/
107+
108+
# https://github.com/KhronosGroup/SPIRV-Headers/issues/282
109+
find_pkg_config_absolute:
110+
runs-on: ubuntu-latest
111+
steps:
112+
- uses: actions/checkout@v3
113+
- uses: lukka/get-cmake@latest
114+
with:
115+
cmakeVersion: 3.15.0
116+
- name: Install spirv-headers with CMAKE_INSTALL_INCLUDEDIR being absolute
117+
run: |
118+
cmake -S . -B build/ -D CMAKE_INSTALL_INCLUDEDIR=${GITHUB_WORKSPACE}/build/install/include -D CMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/build/install/
119+
cmake --install build/
120+
- name: Check spirv-headers pkg_config support
121+
run: |
122+
cmake -S tests/pkg_config -B tests/pkg_config/build/ -D CMAKE_PREFIX_PATH=${GITHUB_WORKSPACE}/build/install
123+
cmake --build tests/pkg_config/build/

CMakeLists.txt

Lines changed: 29 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2015-2016 The Khronos Group Inc.
1+
# Copyright (c) 2015-2023 The Khronos Group Inc.
22
#
33
# Permission is hereby granted, free of charge, to any person obtaining a
44
# copy of this software and/or associated documentation files (the
@@ -23,115 +23,43 @@
2323
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
2424
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
2525
# MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
26+
cmake_minimum_required(VERSION 3.14)
27+
project(SPIRV-Headers LANGUAGES CXX VERSION 1.5.5)
2628

27-
#
28-
# The SPIR-V headers from the SPIR-V Registry
29-
# https://www.khronos.org/registry/spir-v/
30-
#
31-
cmake_minimum_required(VERSION 3.0)
32-
project(SPIRV-Headers VERSION 1.5.5)
33-
34-
# There are two ways to use this project.
35-
#
36-
# Using this source tree directly from a CMake-based project:
37-
# 1. Add an add_subdirectory directive to include this sub directory.
38-
# 2. Use ${SPIRV-Headers_SOURCE_DIR}/include} in a target_include_directories
39-
# command.
40-
#
41-
# Installing the headers first, then using them with an implicit include
42-
# directory. To install the headers:
43-
# 1. mkdir build ; cd build
44-
# 2. cmake ..
45-
# 3. cmake --build . --target install
46-
47-
option(SPIRV_HEADERS_SKIP_EXAMPLES "Skip building examples"
48-
${SPIRV_HEADERS_SKIP_EXAMPLES})
49-
50-
option(SPIRV_HEADERS_SKIP_INSTALL "Skip install"
51-
${SPIRV_HEADERS_SKIP_INSTALL})
52-
53-
if(NOT ${SPIRV_HEADERS_SKIP_EXAMPLES})
54-
set(SPIRV_HEADERS_ENABLE_EXAMPLES ON)
29+
if (CMAKE_VERSION VERSION_LESS "3.21")
30+
# https://cmake.org/cmake/help/latest/variable/PROJECT_IS_TOP_LEVEL.html
31+
string(COMPARE EQUAL ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR} PROJECT_IS_TOP_LEVEL)
5532
endif()
5633

57-
if(NOT ${SPIRV_HEADERS_SKIP_INSTALL})
58-
set(SPIRV_HEADERS_ENABLE_INSTALL ON)
59-
# legacy
60-
add_custom_target(install-headers
61-
COMMAND cmake -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/include/spirv
62-
$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/include/spirv)
63-
endif()
64-
65-
if (SPIRV_HEADERS_ENABLE_EXAMPLES)
66-
message(STATUS "Building SPIRV-Header examples")
67-
add_subdirectory(example)
68-
endif()
34+
add_library(SPIRV-Headers INTERFACE)
35+
add_library(SPIRV-Headers::SPIRV-Headers ALIAS SPIRV-Headers)
36+
target_include_directories(SPIRV-Headers INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
6937

70-
include(GNUInstallDirs)
71-
add_library(${PROJECT_NAME} INTERFACE)
72-
target_include_directories(${PROJECT_NAME} INTERFACE
73-
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
74-
)
75-
76-
# Installation
77-
78-
if (SPIRV_HEADERS_ENABLE_INSTALL)
79-
message(STATUS "Installing SPIRV-Header")
80-
81-
set(config_install_dir "${CMAKE_INSTALL_DATADIR}/cmake/${PROJECT_NAME}")
82-
83-
set(generated_dir "${CMAKE_CURRENT_BINARY_DIR}/generated")
84-
85-
set(version_config "${generated_dir}/${PROJECT_NAME}ConfigVersion.cmake")
86-
set(project_config "${generated_dir}/${PROJECT_NAME}Config.cmake")
87-
set(TARGETS_EXPORT_NAME "${PROJECT_NAME}Targets")
88-
set(namespace "${PROJECT_NAME}::")
89-
90-
include(CMakePackageConfigHelpers)
91-
92-
if (NOT CMAKE_VERSION VERSION_LESS 3.14)
93-
set(arch_independent_str ARCH_INDEPENDENT)
38+
if (PROJECT_IS_TOP_LEVEL)
39+
option(BUILD_TESTS "Build the tests")
40+
if (BUILD_TESTS)
41+
add_subdirectory(tests)
9442
endif()
95-
write_basic_package_version_file(
96-
"${version_config}"
97-
COMPATIBILITY SameMajorVersion
98-
${arch_independent_str}
99-
)
10043

101-
configure_package_config_file(
102-
"cmake/Config.cmake.in"
103-
"${project_config}"
104-
INSTALL_DESTINATION "${config_install_dir}"
105-
)
44+
include(GNUInstallDirs)
45+
include(CMakePackageConfigHelpers)
10646

107-
install(
108-
TARGETS ${PROJECT_NAME}
109-
EXPORT "${TARGETS_EXPORT_NAME}"
110-
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
111-
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
112-
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
113-
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
114-
)
47+
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/spirv DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
11548

116-
install(
117-
DIRECTORY include/spirv
118-
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
119-
)
49+
set(cmake_install_dir "${CMAKE_INSTALL_DATADIR}/cmake/SPIRV-Headers")
50+
set(version_config "${CMAKE_CURRENT_BINARY_DIR}/generated/SPIRV-HeadersConfigVersion.cmake")
12051

121-
install(
122-
FILES "${project_config}" "${version_config}"
123-
DESTINATION "${config_install_dir}"
124-
)
52+
write_basic_package_version_file("${version_config}" COMPATIBILITY SameMajorVersion ARCH_INDEPENDENT)
53+
install(FILES "${version_config}" DESTINATION "${cmake_install_dir}")
12554

126-
install(
127-
EXPORT "${TARGETS_EXPORT_NAME}"
128-
NAMESPACE "${namespace}"
129-
DESTINATION "${config_install_dir}"
130-
)
55+
install(TARGETS SPIRV-Headers EXPORT "SPIRV-HeadersConfig" INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
56+
install(EXPORT "SPIRV-HeadersConfig" NAMESPACE "SPIRV-Headers::" DESTINATION "${cmake_install_dir}")
13157

132-
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/SPIRV-Headers.pc.in ${CMAKE_BINARY_DIR}/SPIRV-Headers.pc @ONLY)
133-
install(
134-
FILES "${CMAKE_BINARY_DIR}/SPIRV-Headers.pc"
135-
DESTINATION ${CMAKE_INSTALL_DATADIR}/pkgconfig
136-
)
58+
if (IS_ABSOLUTE ${CMAKE_INSTALL_INCLUDEDIR})
59+
set(SPIRV_HEADERS_PKGCONFIG_INCLUDE_DIR ${CMAKE_INSTALL_INCLUDEDIR})
60+
else()
61+
set(SPIRV_HEADERS_PKGCONFIG_INCLUDE_DIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR})
62+
endif()
63+
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/SPIRV-Headers.pc.in ${CMAKE_CURRENT_BINARY_DIR}/SPIRV-Headers.pc @ONLY)
64+
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/SPIRV-Headers.pc" DESTINATION ${CMAKE_INSTALL_DATADIR}/pkgconfig)
13765
endif()

cmake/Config.cmake.in

Lines changed: 0 additions & 4 deletions
This file was deleted.

SPIRV-Headers.pc.in renamed to cmake/SPIRV-Headers.pc.in

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
prefix=@CMAKE_INSTALL_PREFIX@
2-
includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
1+
includedir=@SPIRV_HEADERS_PKGCONFIG_INCLUDE_DIR@
32

43
Name: SPIRV-Headers
54
Description: Header files from the SPIR-V registry

example/CMakeLists.txt

Lines changed: 0 additions & 4 deletions
This file was deleted.

include/spirv/spir-v.xml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,13 @@
8282
<id value="29" vendor="Mikkosoft Productions" tool="MSP Shader Compiler" comment="Contact Mikko Rasa, [email protected]"/>
8383
<id value="30" vendor="SpvGenTwo community" tool="SpvGenTwo SPIR-V IR Tools" comment="https://github.com/rAzoR8/SpvGenTwo"/>
8484
<id value="31" vendor="Google" tool="Skia SkSL" comment="Contact Ethan Nicholas, [email protected]"/>
85-
<id value="32" vendor="TornadoVM" tool="SPIRV Beehive Toolkit" comment="https://github.com/beehive-lab/spirv-beehive-toolkit"/>
85+
<id value="32" vendor="TornadoVM" tool="Beehive SPIRV Toolkit" comment="https://github.com/beehive-lab/beehive-spirv-toolkit"/>
8686
<id value="33" vendor="DragonJoker" tool="ShaderWriter" comment="Contact Sylvain Doremus, https://github.com/DragonJoker/ShaderWriter"/>
8787
<id value="34" vendor="Rayan Hatout" tool="SPIRVSmith" comment="Contact Rayan Hatout [email protected], Repo https://github.com/rayanht/SPIRVSmith"/>
8888
<id value="35" vendor="Saarland University" tool="Shady" comment="Contact Hugo Devillers [email protected], Repo https://github.com/Hugobros3/shady"/>
8989
<id value="36" vendor="Taichi Graphics" tool="Taichi" comment="Contact Rendong Liang [email protected], Repo https://github.com/taichi-dev/taichi"/>
90-
<unused start="37" end="0xFFFF" comment="Tool ID range reservable for future use by vendors"/>
90+
<id value="37" vendor="heroseh" tool="Hero C Compiler" comment="https://github.com/heroseh/hcc"/>
91+
<unused start="38" end="0xFFFF" comment="Tool ID range reservable for future use by vendors"/>
9192
</ids>
9293

9394
<!-- SECTION: SPIR-V Opcodes and Enumerants -->
@@ -140,13 +141,16 @@
140141
<ids type="opcode" start="6144" end="6271" vendor="Intel" comment="Contact [email protected]"/>
141142
<ids type="opcode" start="6272" end="6399" vendor="Huawei" comment="Contact [email protected]"/>
142143
<ids type="opcode" start="6400" end="6463" vendor="Intel" comment="Contact [email protected]"/>
144+
<ids type="opcode" start="6464" end="6527" vendor="N/A" comment="Blank range to keep alignment with non-opcodes"/>
145+
<ids type="opcode" start="6528" end="6591" vendor="Codeplay" comment="Contact [email protected]"/>
146+
<ids type="opcode" start="6592" end="6655" vendor="Saarland University" comment="Contact [email protected]"/>
143147
<!-- Opcode enumerants to reserve for future use. To get a block, allocate
144148
multiples of 64 starting at the lowest available point in this
145149
block and add a corresponding <ids> tag immediately above. Make
146150
sure to fill in the vendor attribute, and preferably add a contact
147151
person/address in a comment attribute. -->
148152
<!-- Example new block: <ids type="opcode" start="XXXX" end="XXXX+64n-1" vendor="Add vendor" comment="Contact TBD"/> -->
149-
<ids type="opcode" start="6464" end="65535" comment="Opcode range reservable for future use by vendors"/>
153+
<ids type="opcode" start="6656" end="65535" comment="Opcode range reservable for future use by vendors"/>
150154
<!-- End reservations of opcodes -->
151155

152156

@@ -170,13 +174,15 @@
170174
<ids type="enumerant" start="6272" end="6399" vendor="Huawei" comment="Contact [email protected]"/>
171175
<ids type="enumerant" start="6400" end="6463" vendor="Intel" comment="Contact [email protected]"/>
172176
<ids type="enumerant" start="6464" end="6527" vendor="Mikkosoft Productions" comment="Contact Mikko Rasa, [email protected]"/>
177+
<ids type="enumerant" start="6528" end="6591" vendor="Codeplay" comment="Contact [email protected]"/>
178+
<ids type="enumerant" start="6592" end="6655" vendor="Saarland University" comment="Contact [email protected]"/>
173179
<!-- Enumerants to reserve for future use. To get a block, allocate
174180
multiples of 64 starting at the lowest available point in this
175181
block and add a corresponding <ids> tag immediately above. Make
176182
sure to fill in the vendor attribute, and preferably add a contact
177183
person/address in a comment attribute. -->
178184
<!-- Example new block: <ids type="enumerant" start="XXXX" end="XXXX+64n-1" vendor="Add vendor" comment="Contact TBD"/> -->
179-
<ids type="enumerant" start="6528" end="4294967295" comment="Enumerant range reservable for future use by vendors"/>
185+
<ids type="enumerant" start="6656" end="4294967295" comment="Enumerant range reservable for future use by vendors"/>
180186
<!-- End reservations of enumerants -->
181187

182188

0 commit comments

Comments
 (0)