Vulkan packages (#8)
All checks were successful
Conan Packaging / Package lodepng/cci.20260210 (push) Successful in 19s
Conan Packaging / Package meshoptimizer/1.0 (push) Successful in 17s
Conan Packaging / Package assimp/6.0.4 (push) Successful in 2m40s
Conan Packaging / Package mimalloc/3.2.8 (push) Successful in 26s
Conan Packaging / Package stduuid/1.2.3 (push) Successful in 16s
Conan Packaging / Package vulkan-memory-allocator/3.3.0 (push) Successful in 20s
Conan Packaging / Package vulkan-utility-libraries/1.4.341.0 (push) Successful in 29s
Conan Packaging / Package spirv-tools/1.4.341.0 (push) Successful in 2m21s
Conan Packaging / Package vulkan-validationlayers/1.4.341.0 (push) Successful in 7m57s
Conan Packaging / Package cli11/2.6.1 (push) Successful in 21s
Conan Packaging / Package eabase/01082025 (push) Successful in 15s
Conan Packaging / Package flatbuffers/25.12.19 (push) Successful in 1m12s
Conan Packaging / Package pixelmatch-cpp17/1.0.3 (push) Successful in 20s
Conan Packaging / Package rapidhash/3.0 (push) Successful in 15s
Conan Packaging / Package spirv-headers/1.4.341.0 (push) Successful in 15s
Conan Packaging / Package sqlite3/3.51.2 (push) Successful in 36s
Conan Packaging / Package unordered_dense/4.8.1 (push) Successful in 16s
Conan Packaging / Package vulkan-headers/1.4.341.0 (push) Successful in 16s
Conan Packaging / Package eastl/3.27.01 (push) Successful in 18s
Conan Packaging / Package glslang/1.4.341.0 (push) Successful in 3m43s
Conan Packaging / Package shaderc/2026.1 (push) Successful in 3m41s
All checks were successful
Conan Packaging / Package lodepng/cci.20260210 (push) Successful in 19s
Conan Packaging / Package meshoptimizer/1.0 (push) Successful in 17s
Conan Packaging / Package assimp/6.0.4 (push) Successful in 2m40s
Conan Packaging / Package mimalloc/3.2.8 (push) Successful in 26s
Conan Packaging / Package stduuid/1.2.3 (push) Successful in 16s
Conan Packaging / Package vulkan-memory-allocator/3.3.0 (push) Successful in 20s
Conan Packaging / Package vulkan-utility-libraries/1.4.341.0 (push) Successful in 29s
Conan Packaging / Package spirv-tools/1.4.341.0 (push) Successful in 2m21s
Conan Packaging / Package vulkan-validationlayers/1.4.341.0 (push) Successful in 7m57s
Conan Packaging / Package cli11/2.6.1 (push) Successful in 21s
Conan Packaging / Package eabase/01082025 (push) Successful in 15s
Conan Packaging / Package flatbuffers/25.12.19 (push) Successful in 1m12s
Conan Packaging / Package pixelmatch-cpp17/1.0.3 (push) Successful in 20s
Conan Packaging / Package rapidhash/3.0 (push) Successful in 15s
Conan Packaging / Package spirv-headers/1.4.341.0 (push) Successful in 15s
Conan Packaging / Package sqlite3/3.51.2 (push) Successful in 36s
Conan Packaging / Package unordered_dense/4.8.1 (push) Successful in 16s
Conan Packaging / Package vulkan-headers/1.4.341.0 (push) Successful in 16s
Conan Packaging / Package eastl/3.27.01 (push) Successful in 18s
Conan Packaging / Package glslang/1.4.341.0 (push) Successful in 3m43s
Conan Packaging / Package shaderc/2026.1 (push) Successful in 3m41s
Reviewed-on: #8
This commit was merged in pull request #8.
This commit is contained in:
@@ -10,7 +10,7 @@ env:
|
||||
CCACHE_BASEDIR: ${{ github.workspace }}
|
||||
|
||||
jobs:
|
||||
conan-packages:
|
||||
conan-packages-tier1:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 120
|
||||
container:
|
||||
@@ -21,23 +21,23 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
package: [
|
||||
{ name: "eabase", version: "01082025", location: "all", needs_pkg: "" },
|
||||
{ name: "eastl", version: "3.27.01", location: "all", needs_pkg: "eabase" },
|
||||
{ name: "pixelmatch-cpp17", version: "1.0.3", location: "all", needs_pkg: "" },
|
||||
{ name: "lodepng", version: "cci.20260210", location: "all", needs_pkg: "" },
|
||||
{ name: "stduuid", version: "1.2.3", location: "all", needs_pkg: "" },
|
||||
{ name: "flatbuffers", version: "25.12.19", location: "all", needs_pkg: "" },
|
||||
{ name: "vulkan-memory-allocator", version: "3.3.0", location: "all", needs_pkg: "" },
|
||||
{ name: "vulkan-utility-libraries", version: "1.4.313.0", location: "all", needs_pkg: "" },
|
||||
{ name: "vulkan-validationlayers", version: "1.4.313.0", location: "all", needs_pkg: "vulkan-utility-libraries" },
|
||||
{ name: "shaderc", version: "2025.3", location: "all", needs_pkg: "" },
|
||||
{ name: "unordered_dense", version: "4.8.1", location: "all", needs_pkg: "" },
|
||||
{ name: "mimalloc", version: "3.2.8", location: "all", needs_pkg: "" },
|
||||
{ name: "meshoptimizer", version: "1.0", location: "all", needs_pkg: "" },
|
||||
{ name: "sqlite3", version: "3.51.2", location: "all", needs_pkg: "" },
|
||||
{ name: "rapidhash", version: "3.0", location: "all", needs_pkg: "" },
|
||||
{ name: "cli11", version: "2.6.1", location: "all", needs_pkg: "" },
|
||||
{ name: "assimp", version: "6.0.4", location: "5.x", needs_pkg: "" }
|
||||
{ name: "eabase", version: "01082025", location: "all" },
|
||||
|
||||
{ name: "vulkan-headers", version: "1.4.341.0", location: "all" },
|
||||
{ name: "spirv-headers", version: "1.4.341.0", location: "all" },
|
||||
|
||||
{ name: "pixelmatch-cpp17", version: "1.0.3", location: "all" },
|
||||
{ name: "lodepng", version: "cci.20260210", location: "all" },
|
||||
{ name: "stduuid", version: "1.2.3", location: "all" },
|
||||
{ name: "flatbuffers", version: "25.12.19", location: "all" },
|
||||
|
||||
{ name: "unordered_dense", version: "4.8.1", location: "all" },
|
||||
{ name: "mimalloc", version: "3.2.8", location: "all" },
|
||||
{ name: "meshoptimizer", version: "1.0", location: "all" },
|
||||
{ name: "sqlite3", version: "3.51.2", location: "all" },
|
||||
{ name: "rapidhash", version: "3.0", location: "all" },
|
||||
{ name: "cli11", version: "2.6.1", location: "all" },
|
||||
{ name: "assimp", version: "6.0.4", location: "5.x" },
|
||||
]
|
||||
name: "Package ${{matrix.package.name }}/${{ matrix.package.version }}"
|
||||
steps:
|
||||
@@ -74,3 +74,159 @@ jobs:
|
||||
|
||||
- name: Show ccache stats after
|
||||
run: ccache --show-stats
|
||||
|
||||
conan-packages-tier2:
|
||||
needs: conan-packages-tier1
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 120
|
||||
container:
|
||||
image: git.romainboullard.com/bigfootdev/linuxcppbuilder:main
|
||||
env:
|
||||
ARTIFACTORY_USER: ${{ secrets.ARTIFACTORY_USER }}
|
||||
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
|
||||
strategy:
|
||||
matrix:
|
||||
package: [
|
||||
{ name: "eastl", version: "3.27.01", location: "all", needs_pkg: "eabase" },
|
||||
|
||||
{ name: "vulkan-utility-libraries", version: "1.4.341.0", location: "all" },
|
||||
{ name: "spirv-tools", version: "1.4.341.0", location: "all" },
|
||||
|
||||
{ name: "vulkan-memory-allocator", version: "3.3.0", location: "all" },
|
||||
]
|
||||
name: "Package ${{matrix.package.name }}/${{ matrix.package.version }}"
|
||||
steps:
|
||||
- name: Set BRANCH_NAME
|
||||
run: echo "BRANCH_NAME=$(echo $GITHUB_REF_NAME | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
|
||||
|
||||
- name: Install Node.js
|
||||
run: apt-get update && apt-get install -y nodejs
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Show ccache stats before
|
||||
run: ccache --zero-stats
|
||||
|
||||
- name: Run Conan packaging
|
||||
run: |
|
||||
echo "Building ${{ matrix.package.name }}@${{ matrix.package.version }}"
|
||||
CONAN_LOGIN_USERNAME=${ARTIFACTORY_USER} \
|
||||
CONAN_PASSWORD=${ARTIFACTORY_PASSWORD} \
|
||||
conan create ./${{ matrix.package.name }}/${{ matrix.package.location }} \
|
||||
--version=${{ matrix.package.version }} \
|
||||
--user=bigfootdev \
|
||||
--channel=${{ env.BRANCH_NAME }} \
|
||||
-pr:b=./ConanProfiles/clang -pr:h=./ConanProfiles/clang \
|
||||
--build=missing --remote=bigfootpackages
|
||||
|
||||
CONAN_LOGIN_USERNAME=${ARTIFACTORY_USER} \
|
||||
CONAN_PASSWORD=${ARTIFACTORY_PASSWORD} \
|
||||
conan upload ${{ matrix.package.name }}/${{ matrix.package.version }}@bigfootdev/${{ env.BRANCH_NAME }} \
|
||||
--only-recipe --remote=bigfootpackages
|
||||
|
||||
- name: Show ccache stats after
|
||||
run: ccache --show-stats
|
||||
|
||||
conan-packages-tier3:
|
||||
needs: conan-packages-tier2
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 120
|
||||
container:
|
||||
image: git.romainboullard.com/bigfootdev/linuxcppbuilder:main
|
||||
env:
|
||||
ARTIFACTORY_USER: ${{ secrets.ARTIFACTORY_USER }}
|
||||
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
|
||||
strategy:
|
||||
matrix:
|
||||
package: [
|
||||
{ name: "glslang", version: "1.4.341.0", location: "all" },
|
||||
{ name: "vulkan-validationlayers", version: "1.4.341.0", location: "all" },
|
||||
]
|
||||
name: "Package ${{matrix.package.name }}/${{ matrix.package.version }}"
|
||||
steps:
|
||||
- name: Set BRANCH_NAME
|
||||
run: echo "BRANCH_NAME=$(echo $GITHUB_REF_NAME | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
|
||||
|
||||
- name: Install Node.js
|
||||
run: apt-get update && apt-get install -y nodejs
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Show ccache stats before
|
||||
run: ccache --zero-stats
|
||||
|
||||
- name: Run Conan packaging
|
||||
run: |
|
||||
echo "Building ${{ matrix.package.name }}@${{ matrix.package.version }}"
|
||||
CONAN_LOGIN_USERNAME=${ARTIFACTORY_USER} \
|
||||
CONAN_PASSWORD=${ARTIFACTORY_PASSWORD} \
|
||||
conan create ./${{ matrix.package.name }}/${{ matrix.package.location }} \
|
||||
--version=${{ matrix.package.version }} \
|
||||
--user=bigfootdev \
|
||||
--channel=${{ env.BRANCH_NAME }} \
|
||||
-pr:b=./ConanProfiles/clang -pr:h=./ConanProfiles/clang \
|
||||
--build=missing --remote=bigfootpackages
|
||||
|
||||
CONAN_LOGIN_USERNAME=${ARTIFACTORY_USER} \
|
||||
CONAN_PASSWORD=${ARTIFACTORY_PASSWORD} \
|
||||
conan upload ${{ matrix.package.name }}/${{ matrix.package.version }}@bigfootdev/${{ env.BRANCH_NAME }} \
|
||||
--only-recipe --remote=bigfootpackages
|
||||
|
||||
- name: Show ccache stats after
|
||||
run: ccache --show-stats
|
||||
|
||||
conan-packages-tier4:
|
||||
needs: conan-packages-tier3
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 120
|
||||
container:
|
||||
image: git.romainboullard.com/bigfootdev/linuxcppbuilder:main
|
||||
env:
|
||||
ARTIFACTORY_USER: ${{ secrets.ARTIFACTORY_USER }}
|
||||
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
|
||||
strategy:
|
||||
matrix:
|
||||
package: [
|
||||
{ name: "shaderc", version: "2026.1", location: "all" },
|
||||
]
|
||||
name: "Package ${{matrix.package.name }}/${{ matrix.package.version }}"
|
||||
steps:
|
||||
- name: Set BRANCH_NAME
|
||||
run: echo "BRANCH_NAME=$(echo $GITHUB_REF_NAME | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
|
||||
|
||||
- name: Install Node.js
|
||||
run: apt-get update && apt-get install -y nodejs
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Show ccache stats before
|
||||
run: ccache --zero-stats
|
||||
|
||||
- name: Run Conan packaging
|
||||
run: |
|
||||
echo "Building ${{ matrix.package.name }}@${{ matrix.package.version }}"
|
||||
CONAN_LOGIN_USERNAME=${ARTIFACTORY_USER} \
|
||||
CONAN_PASSWORD=${ARTIFACTORY_PASSWORD} \
|
||||
conan create ./${{ matrix.package.name }}/${{ matrix.package.location }} \
|
||||
--version=${{ matrix.package.version }} \
|
||||
--user=bigfootdev \
|
||||
--channel=${{ env.BRANCH_NAME }} \
|
||||
-pr:b=./ConanProfiles/clang -pr:h=./ConanProfiles/clang \
|
||||
--build=missing --remote=bigfootpackages
|
||||
|
||||
CONAN_LOGIN_USERNAME=${ARTIFACTORY_USER} \
|
||||
CONAN_PASSWORD=${ARTIFACTORY_PASSWORD} \
|
||||
conan upload ${{ matrix.package.name }}/${{ matrix.package.version }}@bigfootdev/${{ env.BRANCH_NAME }} \
|
||||
--only-recipe --remote=bigfootpackages
|
||||
|
||||
- name: Show ccache stats after
|
||||
run: ccache --show-stats
|
||||
16
glslang/all/CMakeLists.txt
Normal file
16
glslang/all/CMakeLists.txt
Normal file
@@ -0,0 +1,16 @@
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
project(cmake_wrapper)
|
||||
|
||||
# TODO:
|
||||
# - It should be find_package(SPIRV-Tools-opt REQUIRED CONFIG), but it can't be
|
||||
# modeled yet in spirv-tools recipe.
|
||||
# - Upstream CMakeLists is not very neat, and doesn't always link
|
||||
# Spirv-Tools-opt in all required targets. Keep in mind that it works thanks
|
||||
# to global injection of include dirs/interface definitions from
|
||||
# conan_basic_setup(). It won't work without patches when moving to
|
||||
# CMakeToolchain + CMakeDeps.
|
||||
if(ENABLE_OPT)
|
||||
find_package(SPIRV-Tools REQUIRED CONFIG)
|
||||
endif()
|
||||
|
||||
add_subdirectory(src)
|
||||
26
glslang/all/conandata.yml
Normal file
26
glslang/all/conandata.yml
Normal file
@@ -0,0 +1,26 @@
|
||||
# Add only the SDK release versions from https://github.com/KhronosGroup/glslang/tags for consistency
|
||||
sources:
|
||||
"1.4.341.0":
|
||||
url: "https://github.com/KhronosGroup/glslang/archive/refs/tags/vulkan-sdk-1.4.341.0.tar.gz"
|
||||
sha256: "18cdf7d40a39001dde842c6a1338b2c9321ac5e487139b9d52b4b9c666da3c86"
|
||||
"1.4.313.0":
|
||||
url: "https://github.com/KhronosGroup/glslang/archive/refs/tags/vulkan-sdk-1.4.313.0.tar.gz"
|
||||
sha256: "555ac780ccceca926fa25775834639ce6ffc744120bfb68fb8657dd4032d21ee"
|
||||
"1.3.268.0":
|
||||
url: "https://github.com/KhronosGroup/glslang/archive/refs/tags/vulkan-sdk-1.3.268.0.tar.gz"
|
||||
sha256: "8cfb4824f185bc246cd41cceedbfcdf14abd3d2fa861512baf81df8a263b9283"
|
||||
"1.3.261.1":
|
||||
url: "https://github.com/KhronosGroup/glslang/archive/refs/tags/sdk-1.3.261.1.tar.gz"
|
||||
sha256: "eb1f9c2ff0a1409151d7749fb37bc1988dc1fd908444c1e4f43d4190c90befcd"
|
||||
"1.3.243.0":
|
||||
url: "https://github.com/KhronosGroup/glslang/archive/refs/tags/sdk-1.3.243.0.tar.gz"
|
||||
sha256: "18b8f296874ac19d034bfb9060238c87b6d67a39af0dfd305d3252762c265f9f"
|
||||
"1.3.239.0":
|
||||
url: "https://github.com/KhronosGroup/glslang/archive/refs/tags/sdk-1.3.239.0.tar.gz"
|
||||
sha256: "8b040328c18399b7bbf5bef84fac3d7b7376b39ec6833b7e19b7961bf7a72017"
|
||||
"1.3.236.0":
|
||||
url: "https://github.com/KhronosGroup/glslang/archive/refs/tags/sdk-1.3.236.0.tar.gz"
|
||||
sha256: "fb6f323a36efcd98766bb72f598008f73c4c92bce69c79fc98ad2b3cdca0c263"
|
||||
"1.2.198.0":
|
||||
url: "https://github.com/KhronosGroup/glslang/archive/refs/tags/sdk-1.2.198.0.tar.gz"
|
||||
sha256: "b2a0541caf01de4fc411cbb32c805a3bd0f6578432e532c5fa6336d187a4a1b1"
|
||||
231
glslang/all/conanfile.py
Normal file
231
glslang/all/conanfile.py
Normal file
@@ -0,0 +1,231 @@
|
||||
import os
|
||||
import re
|
||||
|
||||
from conan import ConanFile
|
||||
from conan.errors import ConanInvalidConfiguration, ConanException
|
||||
from conan.tools.build import check_min_cppstd
|
||||
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
|
||||
from conan.tools.env import VirtualBuildEnv
|
||||
from conan.tools.files import copy, get, rmdir
|
||||
from conan.tools.scm import Version
|
||||
|
||||
required_conan_version = ">=2.1"
|
||||
|
||||
|
||||
class GlslangConan(ConanFile):
|
||||
name = "glslang"
|
||||
description = "Khronos-reference front end for GLSL/ESSL, partial front " \
|
||||
"end for HLSL, and a SPIR-V generator."
|
||||
license = "DocumentRef-LICENSE.txt:LicenseRef-glslang"
|
||||
topics = ("glsl", "hlsl", "spirv", "spir-v", "validation", "translation")
|
||||
homepage = "https://github.com/KhronosGroup/glslang"
|
||||
url = "https://github.com/conan-io/conan-center-index"
|
||||
|
||||
package_type = "library"
|
||||
settings = "os", "arch", "compiler", "build_type"
|
||||
options = {
|
||||
"shared": [True, False],
|
||||
"fPIC": [True, False],
|
||||
"build_executables": [True, False],
|
||||
"spv_remapper": [True, False],
|
||||
"hlsl": [True, False],
|
||||
"enable_optimizer": [True, False],
|
||||
}
|
||||
default_options = {
|
||||
"shared": False,
|
||||
"fPIC": True,
|
||||
"build_executables": True,
|
||||
"spv_remapper": True,
|
||||
"hlsl": True,
|
||||
"enable_optimizer": True,
|
||||
}
|
||||
|
||||
short_paths = True
|
||||
|
||||
def export_sources(self):
|
||||
copy(self, "CMakeLists.txt", self.recipe_folder, self.export_sources_folder)
|
||||
|
||||
def config_options(self):
|
||||
if self.settings.os == "Windows":
|
||||
del self.options.fPIC
|
||||
if Version(self.version) >= "1.4.341.0":
|
||||
del self.options.spv_remapper
|
||||
|
||||
def configure(self):
|
||||
if self.options.shared:
|
||||
self.options.rm_safe("fPIC")
|
||||
|
||||
def layout(self):
|
||||
cmake_layout(self, src_folder="src")
|
||||
|
||||
def requirements(self):
|
||||
if self.options.enable_optimizer:
|
||||
if Version(self.version) >= "1.4.341.0":
|
||||
self.requires(f"spirv-tools/{self.version}@{self.user}/{self.channel}")
|
||||
else:
|
||||
self.requires(f"spirv-tools/{self.version}")
|
||||
|
||||
def validate(self):
|
||||
if self.settings.compiler.get_safe("cppstd"):
|
||||
check_min_cppstd(self, 11)
|
||||
|
||||
# see https://github.com/KhronosGroup/glslang/issues/2283
|
||||
if self.options.shared:
|
||||
if self.settings.os == "Windows":
|
||||
raise ConanInvalidConfiguration(f"{self.ref} shared library build is broken on {self.settings.os}")
|
||||
|
||||
if self.options.enable_optimizer and self.dependencies["spirv-tools"].options.shared:
|
||||
raise ConanInvalidConfiguration(
|
||||
f"{self.ref} with enable_optimizer requires static spirv-tools, "
|
||||
"because SPIRV-Tools-opt is not built if shared"
|
||||
)
|
||||
|
||||
def build_requirements(self):
|
||||
if Version(self.version) >= "1.3.261":
|
||||
self.tool_requires("cmake/[>=3.17.2 <4]")
|
||||
|
||||
def source(self):
|
||||
get(self, **self.conan_data["sources"][self.version], strip_root=True)
|
||||
|
||||
def generate(self):
|
||||
venv = VirtualBuildEnv(self)
|
||||
venv.generate()
|
||||
|
||||
tc = CMakeToolchain(self)
|
||||
tc.variables["BUILD_EXTERNAL"] = False
|
||||
tc.variables["SKIP_GLSLANG_INSTALL"] = False
|
||||
tc.cache_variables["GLSLANG_ENABLE_INSTALL"] = True
|
||||
tc.variables["ENABLE_SPVREMAPPER"] = self.options.get_safe("spv_remapper", False)
|
||||
tc.variables["ENABLE_GLSLANG_BINARIES"] = self.options.build_executables
|
||||
tc.variables["ENABLE_GLSLANG_JS"] = False
|
||||
tc.variables["ENABLE_GLSLANG_WEBMIN"] = False
|
||||
tc.variables["ENABLE_GLSLANG_WEBMIN_DEVEL"] = False
|
||||
tc.variables["ENABLE_EMSCRIPTEN_SINGLE_FILE"] = False
|
||||
tc.variables["ENABLE_EMSCRIPTEN_ENVIRONMENT_NODE"] = False
|
||||
tc.variables["ENABLE_HLSL"] = self.options.hlsl
|
||||
tc.variables["ENABLE_RTTI"] = True
|
||||
tc.variables["ENABLE_OPT"] = self.options.enable_optimizer
|
||||
if self.options.enable_optimizer:
|
||||
tc.variables["spirv-tools_SOURCE_DIR"] = self.dependencies["spirv-tools"].package_folder.replace("\\", "/")
|
||||
tc.variables["ENABLE_PCH"] = False
|
||||
tc.variables["ENABLE_CTEST"] = False
|
||||
tc.variables["USE_CCACHE"] = False
|
||||
tc.variables["OVERRIDE_MSVCCRT"] = False
|
||||
tc.variables["CMAKE_MACOSX_BUNDLE"] = False
|
||||
# Generate a relocatable shared lib on Macos
|
||||
tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW"
|
||||
# glslang builds intermediate static libs, but Conan does not set -fPIC for shared builds
|
||||
tc.variables["CMAKE_POSITION_INDEPENDENT_CODE"] = self.options.get_safe("fPIC", True)
|
||||
if Version(self.version) < "1.3.224.1":
|
||||
tc.cache_variables["CMAKE_POLICY_VERSION_MINIMUM"] = "3.5" # CMake 4 support
|
||||
tc.generate()
|
||||
|
||||
deps = CMakeDeps(self)
|
||||
deps.generate()
|
||||
|
||||
def _patch_sources(self):
|
||||
for cmake_file in sorted(self.source_path.rglob("CMakeLists.txt")):
|
||||
content = cmake_file.read_text(encoding="utf8")
|
||||
if "POSITION_INDEPENDENT_CODE ON" in content:
|
||||
content = re.sub(r"set_property\(TARGET \S+ PROPERTY POSITION_INDEPENDENT_CODE ON\)\n", "", content)
|
||||
content = content.replace("POSITION_INDEPENDENT_CODE ON", "")
|
||||
cmake_file.write_text(content, encoding="utf8")
|
||||
self.output.info(f"Patched fPIC handling in {cmake_file.relative_to(self.source_path)}")
|
||||
if "POSITION_INDEPENDENT_CODE" in content:
|
||||
raise ConanException(f"POSITION_INDEPENDENT_CODE found in {cmake_file}, please update the recipe")
|
||||
|
||||
def build(self):
|
||||
self._patch_sources()
|
||||
cmake = CMake(self)
|
||||
cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir))
|
||||
cmake.build()
|
||||
|
||||
def package(self):
|
||||
copy(self, "LICENSE.txt", self.source_folder, os.path.join(self.package_folder, "licenses"))
|
||||
cmake = CMake(self)
|
||||
cmake.install()
|
||||
rmdir(self, os.path.join(self.package_folder, "lib", "cmake"))
|
||||
rmdir(self, os.path.join(self.package_folder, "share"))
|
||||
|
||||
def package_info(self):
|
||||
self.cpp_info.set_property("cmake_file_name", "glslang")
|
||||
self.cpp_info.set_property("cmake_target_name", "glslang::_glslang-do-not-use") # because glslang-core target is glslang::glslang
|
||||
|
||||
lib_suffix = "d" if self.settings.os == "Windows" and self.settings.build_type == "Debug" else ""
|
||||
|
||||
has_machineindependent = not self.options.shared
|
||||
has_genericcodegen = not self.options.shared
|
||||
has_osdependent = not self.options.shared
|
||||
|
||||
# removed - see CHANGES.md
|
||||
has_oglcompiler = not self.options.shared and Version(self.version) <= "1.3.243"
|
||||
has_hlsl = self.options.hlsl and Version(self.version) <= "1.3.243"
|
||||
|
||||
# glslang
|
||||
self.cpp_info.components["glslang-core"].set_property("cmake_target_name", "glslang::glslang")
|
||||
self.cpp_info.components["glslang-core"].libs = [f"glslang{lib_suffix}"]
|
||||
if self.options.shared:
|
||||
self.cpp_info.components["glslang-core"].defines.append("GLSLANG_IS_SHARED_LIBRARY")
|
||||
if self.settings.os in ["Linux", "FreeBSD"]:
|
||||
self.cpp_info.components["glslang-core"].system_libs.extend(["m", "pthread"])
|
||||
if has_machineindependent:
|
||||
self.cpp_info.components["glslang-core"].requires.append("machineindependent")
|
||||
if has_genericcodegen:
|
||||
self.cpp_info.components["glslang-core"].requires.append("genericcodegen")
|
||||
if has_osdependent:
|
||||
self.cpp_info.components["glslang-core"].requires.append("osdependent")
|
||||
if has_oglcompiler:
|
||||
self.cpp_info.components["glslang-core"].requires.append("oglcompiler")
|
||||
if has_hlsl:
|
||||
self.cpp_info.components["glslang-core"].defines.append("ENABLE_HLSL")
|
||||
|
||||
if has_machineindependent:
|
||||
# MachineIndependent
|
||||
self.cpp_info.components["machineindependent"].set_property("cmake_target_name", "glslang::MachineIndependent")
|
||||
self.cpp_info.components["machineindependent"].libs = [f"MachineIndependent{lib_suffix}"]
|
||||
if has_genericcodegen:
|
||||
self.cpp_info.components["machineindependent"].requires.append("genericcodegen")
|
||||
if has_osdependent:
|
||||
self.cpp_info.components["machineindependent"].requires.append("osdependent")
|
||||
if has_oglcompiler:
|
||||
self.cpp_info.components["machineindependent"].requires.append("oglcompiler")
|
||||
|
||||
if has_genericcodegen:
|
||||
# GenericCodeGen
|
||||
self.cpp_info.components["genericcodegen"].set_property("cmake_target_name", "glslang::GenericCodeGen")
|
||||
self.cpp_info.components["genericcodegen"].libs = [f"GenericCodeGen{lib_suffix}"]
|
||||
|
||||
if has_osdependent:
|
||||
# OSDependent
|
||||
self.cpp_info.components["osdependent"].set_property("cmake_target_name", "glslang::OSDependent")
|
||||
self.cpp_info.components["osdependent"].libs = [f"OSDependent{lib_suffix}"]
|
||||
if self.settings.os in ["Linux", "FreeBSD"]:
|
||||
self.cpp_info.components["osdependent"].system_libs.append("pthread")
|
||||
|
||||
if has_oglcompiler:
|
||||
# OGLCompiler
|
||||
self.cpp_info.components["oglcompiler"].set_property("cmake_target_name", "glslang::OGLCompiler")
|
||||
self.cpp_info.components["oglcompiler"].libs = [f"OGLCompiler{lib_suffix}"]
|
||||
|
||||
# SPIRV
|
||||
self.cpp_info.components["spirv"].set_property("cmake_target_name", "glslang::SPIRV")
|
||||
self.cpp_info.components["spirv"].libs = [f"SPIRV{lib_suffix}"]
|
||||
self.cpp_info.components["spirv"].requires = ["glslang-core"]
|
||||
if self.options.enable_optimizer:
|
||||
self.cpp_info.components["spirv"].requires.append("spirv-tools::spirv-tools-opt")
|
||||
self.cpp_info.components["spirv"].defines.append("ENABLE_OPT")
|
||||
|
||||
# HLSL
|
||||
if has_hlsl:
|
||||
self.cpp_info.components["hlsl"].set_property("cmake_target_name", "glslang::HLSL")
|
||||
self.cpp_info.components["hlsl"].libs = [f"HLSL{lib_suffix}"]
|
||||
self.cpp_info.components["glslang-core"].requires.append("hlsl")
|
||||
|
||||
# SPVRemapper
|
||||
if self.options.get_safe("spv_remapper"):
|
||||
self.cpp_info.components["spvremapper"].set_property("cmake_target_name", "glslang::SPVRemapper")
|
||||
self.cpp_info.components["spvremapper"].libs = [f"SPVRemapper{lib_suffix}"]
|
||||
|
||||
if Version(self.version) >= "1.3.243":
|
||||
self.cpp_info.components["glslang-default-resource-limits"].set_property("cmake_target_name", "glslang::glslang-default-resource-limits")
|
||||
self.cpp_info.components["glslang-default-resource-limits"].libs = [f"glslang-default-resource-limits{lib_suffix}"]
|
||||
8
glslang/all/test_package/CMakeLists.txt
Normal file
8
glslang/all/test_package/CMakeLists.txt
Normal file
@@ -0,0 +1,8 @@
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
project(test_package LANGUAGES CXX)
|
||||
|
||||
find_package(glslang REQUIRED CONFIG)
|
||||
|
||||
add_executable(${PROJECT_NAME} test_package.cpp)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE glslang::glslang)
|
||||
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11)
|
||||
28
glslang/all/test_package/conanfile.py
Normal file
28
glslang/all/test_package/conanfile.py
Normal file
@@ -0,0 +1,28 @@
|
||||
from conan import ConanFile
|
||||
from conan.tools.build import can_run
|
||||
from conan.tools.cmake import CMake, cmake_layout
|
||||
import os
|
||||
|
||||
|
||||
class TestPackageConan(ConanFile):
|
||||
settings = "os", "arch", "compiler", "build_type"
|
||||
generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv"
|
||||
test_type = "explicit"
|
||||
|
||||
def layout(self):
|
||||
cmake_layout(self)
|
||||
|
||||
def requirements(self):
|
||||
self.requires(self.tested_reference_str, run=can_run(self))
|
||||
|
||||
def build(self):
|
||||
cmake = CMake(self)
|
||||
cmake.configure()
|
||||
cmake.build()
|
||||
|
||||
def test(self):
|
||||
if can_run(self):
|
||||
bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package")
|
||||
self.run(bin_path, env="conanrun")
|
||||
shader_name = os.path.join(self.source_folder, "test_package.vert")
|
||||
self.run(f"glslangValidator \"{shader_name}\"", env="conanrun")
|
||||
8
glslang/all/test_package/test_package.cpp
Normal file
8
glslang/all/test_package/test_package.cpp
Normal file
@@ -0,0 +1,8 @@
|
||||
#include <glslang/Public/ShaderLang.h>
|
||||
|
||||
int main() {
|
||||
glslang::InitializeProcess();
|
||||
glslang::FinalizeProcess();
|
||||
|
||||
return 0;
|
||||
}
|
||||
8
glslang/all/test_package/test_package.vert
Normal file
8
glslang/all/test_package/test_package.vert
Normal file
@@ -0,0 +1,8 @@
|
||||
#version 450
|
||||
#extension GL_ARB_separate_shader_objects : enable
|
||||
|
||||
layout(location = 0) in vec2 inPosition;
|
||||
|
||||
void main() {
|
||||
gl_Position = vec4(inPosition, 0.0, 1.0);
|
||||
}
|
||||
17
glslang/config.yml
Normal file
17
glslang/config.yml
Normal file
@@ -0,0 +1,17 @@
|
||||
versions:
|
||||
"1.4.341.0":
|
||||
folder: all
|
||||
"1.4.313.0":
|
||||
folder: all
|
||||
"1.3.268.0":
|
||||
folder: all
|
||||
"1.3.261.1":
|
||||
folder: all
|
||||
"1.3.243.0":
|
||||
folder: all
|
||||
"1.3.239.0":
|
||||
folder: all
|
||||
"1.3.236.0":
|
||||
folder: all
|
||||
"1.2.198.0":
|
||||
folder: all
|
||||
@@ -1,4 +1,7 @@
|
||||
sources:
|
||||
"2026.1":
|
||||
url: "https://github.com/google/shaderc/archive/refs/tags/v2026.1.tar.gz"
|
||||
sha256: "245002feccbe7f8361b223545a5654cea69780745886872d7efff50a38d96c66"
|
||||
"2025.3":
|
||||
url: "https://github.com/google/shaderc/archive/refs/tags/v2025.3.tar.gz"
|
||||
sha256: "a8e4a25e5c2686fd36981e527ed05e451fcfc226bddf350f4e76181371190937"
|
||||
@@ -12,6 +15,16 @@ sources:
|
||||
url: "https://github.com/google/shaderc/archive/v2021.1.tar.gz"
|
||||
sha256: "047113bc4628da164a3cb845efc20d442728873f6054a68ab56d04a053f2c32b"
|
||||
patches:
|
||||
"2026.1":
|
||||
- patch_file: "patches/2025.3/use-conan-dependencies.patch"
|
||||
patch_description: "Replace third_party with Conan dependencies"
|
||||
patch_type: "conan"
|
||||
- patch_file: "patches/2026.1/adapt-update_build_version.py.patch"
|
||||
patch_description: "Adapt update_build_version.py for Conan"
|
||||
patch_type: "conan"
|
||||
- patch_file: "patches/2021.1/install-shaderc_util.patch"
|
||||
patch_description: "install() shaderc_util"
|
||||
patch_type: "conan"
|
||||
"2025.3":
|
||||
- patch_file: "patches/2025.3/use-conan-dependencies.patch"
|
||||
patch_description: "Replace third_party with Conan dependencies"
|
||||
@@ -54,6 +67,7 @@ patches:
|
||||
patch_type: "conan"
|
||||
siprv_mapping:
|
||||
# TODO: bump me once newer versions are available on CCI
|
||||
"2026.1": "1.4.341.0"
|
||||
"2025.3": "1.4.313.0"
|
||||
"2024.1": "1.3.261.1"
|
||||
# "2023.6": "1.3.261.1"
|
||||
|
||||
@@ -51,9 +51,14 @@ class ShadercConan(ConanFile):
|
||||
|
||||
def requirements(self):
|
||||
# transitive_headers=True is not required for any of the dependencies
|
||||
self.requires(f"glslang/{self._spirv_version}")
|
||||
self.requires(f"spirv-tools/{self._spirv_version}")
|
||||
self.requires(f"spirv-headers/{self._spirv_version}")
|
||||
if Version(self.version) >= "1.4.341.0":
|
||||
self.requires(f"glslang/{self._spirv_version}@{self.user}/{self.channel}")
|
||||
self.requires(f"spirv-tools/{self._spirv_version}@{self.user}/{self.channel}")
|
||||
self.requires(f"spirv-headers/{self._spirv_version}@{self.user}/{self.channel}")
|
||||
else:
|
||||
self.requires(f"glslang/{self._spirv_version}")
|
||||
self.requires(f"spirv-tools/{self._spirv_version}")
|
||||
self.requires(f"spirv-headers/{self._spirv_version}")
|
||||
|
||||
def validate(self):
|
||||
if self.settings.compiler.get_safe("cppstd"):
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
diff --git a/utils/update_build_version.py b/utils/update_build_version.py
|
||||
--- a/utils/update_build_version.py
|
||||
+++ b/utils/update_build_version.py
|
||||
@@ -130,18 +130,18 @@
|
||||
|
||||
|
||||
def main():
|
||||
- if len(sys.argv) != 5:
|
||||
+ if len(sys.argv) < 5:
|
||||
print(('usage: {} <shaderc-dir> <spirv-tools-dir> <glslang-dir> <output-file>'.format(
|
||||
sys.argv[0])))
|
||||
sys.exit(1)
|
||||
|
||||
- projects = ['shaderc', 'spirv-tools', 'glslang']
|
||||
+ projects = ['shaderc']
|
||||
new_content = ''.join([
|
||||
'"{}\\n"\n'.format(get_version_string(p, d))
|
||||
for (p, d) in zip(projects, sys.argv[1:])
|
||||
])
|
||||
|
||||
- output_file = sys.argv[4]
|
||||
+ output_file = sys.argv[-1]
|
||||
mkdir_p(os.path.dirname(output_file))
|
||||
|
||||
if os.path.isfile(output_file):
|
||||
@@ -1,4 +1,6 @@
|
||||
versions:
|
||||
"2026.1":
|
||||
folder: all
|
||||
"2025.3":
|
||||
folder: all
|
||||
"2024.1":
|
||||
|
||||
28
spirv-headers/all/conandata.yml
Normal file
28
spirv-headers/all/conandata.yml
Normal file
@@ -0,0 +1,28 @@
|
||||
sources:
|
||||
"1.4.341.0":
|
||||
url: "https://github.com/KhronosGroup/SPIRV-Headers/archive/refs/tags/vulkan-sdk-1.4.341.0.tar.gz"
|
||||
sha256: "cab0a654c4917e16367483296b44cdb1d614e3120c721beafcd37e3a8580486c"
|
||||
"1.4.313.0":
|
||||
url: "https://github.com/KhronosGroup/SPIRV-Headers/archive/refs/tags/vulkan-sdk-1.4.313.0.tar.gz"
|
||||
sha256: "f68be549d74afb61600a1e3a7d1da1e6b7437758c8e77d664909f88f302c5ac1"
|
||||
"1.4.309.0":
|
||||
url: "https://github.com/KhronosGroup/SPIRV-Headers/archive/refs/tags/vulkan-sdk-1.4.309.0.tar.gz"
|
||||
sha256: "a96f8b4f2dfb18f7432e5c523e220ab0075372a9509e0c25fbff21c76af0de7c"
|
||||
"1.3.296.0":
|
||||
url: "https://github.com/KhronosGroup/SPIRV-Headers/archive/refs/tags/vulkan-sdk-1.3.296.0.tar.gz"
|
||||
sha256: "1423d58a1171611d5aba2bf6f8c69c72ef9c38a0aca12c3493e4fda64c9b2dc6"
|
||||
"1.3.268.0":
|
||||
url: "https://github.com/KhronosGroup/SPIRV-Headers/archive/refs/tags/vulkan-sdk-1.3.268.0.tar.gz"
|
||||
sha256: "1022379e5b920ae21ccfb5cb41e07b1c59352a18c3d3fdcbf38d6ae7733384d4"
|
||||
"1.3.261.1":
|
||||
url: "https://github.com/KhronosGroup/SPIRV-Headers/archive/refs/tags/sdk-1.3.261.1.tar.gz"
|
||||
sha256: "32b4c6ae6a2fa9b56c2c17233c8056da47e331f76e117729925825ea3e77a739"
|
||||
"1.3.243.0":
|
||||
url: "https://github.com/KhronosGroup/SPIRV-Headers/archive/refs/tags/sdk-1.3.243.0.tar.gz"
|
||||
sha256: "16927b1868e7891377d059cd549484e4158912439cf77451ae7e01e2a3bcd28b"
|
||||
"1.3.239.0":
|
||||
url: "https://github.com/KhronosGroup/SPIRV-Headers/archive/refs/tags/sdk-1.3.239.0.tar.gz"
|
||||
sha256: "fdaf6670e311cd1c08ae90bf813e89dd31630205bc60030ffd25fb0af39b51fe"
|
||||
"1.2.198.0":
|
||||
url: "https://github.com/KhronosGroup/SPIRV-Headers/archive/refs/tags/sdk-1.2.198.0.tar.gz"
|
||||
sha256: "3301a23aca0434336a643e433dcacacdd60000ab3dd35dc0078a297c06124a12"
|
||||
55
spirv-headers/all/conanfile.py
Normal file
55
spirv-headers/all/conanfile.py
Normal file
@@ -0,0 +1,55 @@
|
||||
from conan import ConanFile
|
||||
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
|
||||
from conan.tools.files import copy, get, rmdir
|
||||
from conan.tools.scm import Version
|
||||
import os
|
||||
|
||||
required_conan_version = ">=1.50.0"
|
||||
|
||||
|
||||
class SpirvheadersConan(ConanFile):
|
||||
name = "spirv-headers"
|
||||
homepage = "https://github.com/KhronosGroup/SPIRV-Headers"
|
||||
description = "Header files for the SPIRV instruction set."
|
||||
license = "MIT-KhronosGroup"
|
||||
topics = ("spirv", "spirv-v", "vulkan", "opengl", "opencl", "khronos")
|
||||
url = "https://github.com/conan-io/conan-center-index"
|
||||
package_type = "header-library"
|
||||
settings = "os", "arch", "compiler", "build_type"
|
||||
|
||||
def layout(self):
|
||||
cmake_layout(self, src_folder="src")
|
||||
|
||||
def package_id(self):
|
||||
self.info.clear()
|
||||
|
||||
def source(self):
|
||||
get(self, **self.conan_data["sources"][self.version], strip_root=True)
|
||||
|
||||
def generate(self):
|
||||
tc = CMakeToolchain(self)
|
||||
tc.variables["SPIRV_HEADERS_SKIP_EXAMPLES"] = True
|
||||
if Version(self.version) > "1.3.275.0":
|
||||
tc.variables["SPIRV_HEADERS_ENABLE_TESTS"] = False
|
||||
if Version(self.version) <= "1.3.243.0":
|
||||
tc.cache_variables["CMAKE_POLICY_VERSION_MINIMUM"] = "3.5" # CMake 4 support
|
||||
tc.generate()
|
||||
|
||||
def build(self):
|
||||
cmake = CMake(self)
|
||||
cmake.configure()
|
||||
cmake.build()
|
||||
|
||||
def package(self):
|
||||
copy(self, "LICENSE*", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses"))
|
||||
cmake = CMake(self)
|
||||
cmake.install()
|
||||
rmdir(self, os.path.join(self.package_folder, "lib"))
|
||||
rmdir(self, os.path.join(self.package_folder, "share"))
|
||||
|
||||
def package_info(self):
|
||||
self.cpp_info.set_property("cmake_file_name", "SPIRV-Headers")
|
||||
self.cpp_info.set_property("cmake_target_name", "SPIRV-Headers::SPIRV-Headers")
|
||||
self.cpp_info.set_property("pkg_config_name", "SPIRV-Headers")
|
||||
self.cpp_info.bindirs = []
|
||||
self.cpp_info.libdirs = []
|
||||
7
spirv-headers/all/test_package/CMakeLists.txt
Normal file
7
spirv-headers/all/test_package/CMakeLists.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
project(test_package LANGUAGES CXX)
|
||||
|
||||
find_package(SPIRV-Headers REQUIRED CONFIG)
|
||||
|
||||
add_executable(${PROJECT_NAME} test_package.cpp)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE SPIRV-Headers::SPIRV-Headers)
|
||||
26
spirv-headers/all/test_package/conanfile.py
Normal file
26
spirv-headers/all/test_package/conanfile.py
Normal file
@@ -0,0 +1,26 @@
|
||||
from conan import ConanFile
|
||||
from conan.tools.build import can_run
|
||||
from conan.tools.cmake import CMake, cmake_layout
|
||||
import os
|
||||
|
||||
|
||||
class TestPackageConan(ConanFile):
|
||||
settings = "os", "arch", "compiler", "build_type"
|
||||
generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv"
|
||||
test_type = "explicit"
|
||||
|
||||
def layout(self):
|
||||
cmake_layout(self)
|
||||
|
||||
def requirements(self):
|
||||
self.requires(self.tested_reference_str)
|
||||
|
||||
def build(self):
|
||||
cmake = CMake(self)
|
||||
cmake.configure()
|
||||
cmake.build()
|
||||
|
||||
def test(self):
|
||||
if can_run(self):
|
||||
bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package")
|
||||
self.run(bin_path, env="conanrun")
|
||||
43
spirv-headers/all/test_package/test_package.cpp
Normal file
43
spirv-headers/all/test_package/test_package.cpp
Normal file
@@ -0,0 +1,43 @@
|
||||
// Copyright (c) 2016 The Khronos Group Inc.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and/or associated documentation files (the
|
||||
// "Materials"), to deal in the Materials without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
// permit persons to whom the Materials are furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Materials.
|
||||
//
|
||||
// MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
|
||||
// KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
|
||||
// SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
|
||||
// https://www.khronos.org/registry/
|
||||
//
|
||||
// THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
// MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
|
||||
#include <spirv/1.0/GLSL.std.450.h>
|
||||
#include <spirv/1.0/OpenCL.std.h>
|
||||
#include <spirv/1.0/spirv.hpp>
|
||||
|
||||
namespace {
|
||||
|
||||
const GLSLstd450 kSin = GLSLstd450Sin;
|
||||
const OpenCLLIB::Entrypoints kNative_cos = OpenCLLIB::Native_cos;
|
||||
const spv::Op kNop = spv::OpNop;
|
||||
|
||||
}
|
||||
|
||||
int main(int argc, char ** argv)
|
||||
{
|
||||
|
||||
return 0;
|
||||
}
|
||||
19
spirv-headers/config.yml
Normal file
19
spirv-headers/config.yml
Normal file
@@ -0,0 +1,19 @@
|
||||
versions:
|
||||
"1.4.341.0":
|
||||
folder: all
|
||||
"1.4.313.0":
|
||||
folder: all
|
||||
"1.4.309.0":
|
||||
folder: all
|
||||
"1.3.296.0":
|
||||
folder: all
|
||||
"1.3.268.0":
|
||||
folder: all
|
||||
"1.3.261.1":
|
||||
folder: all
|
||||
"1.3.243.0":
|
||||
folder: all
|
||||
"1.3.239.0":
|
||||
folder: all
|
||||
"1.2.198.0":
|
||||
folder: all
|
||||
46
spirv-tools/all/conandata.yml
Normal file
46
spirv-tools/all/conandata.yml
Normal file
@@ -0,0 +1,46 @@
|
||||
# Add only the SDK release versions from https://github.com/KhronosGroup/SPIRV-Tools/tags for consistency
|
||||
sources:
|
||||
"1.4.341.0":
|
||||
url: "https://github.com/KhronosGroup/SPIRV-Tools/archive/refs/tags/vulkan-sdk-1.4.341.0.tar.gz"
|
||||
sha256: "15bfb678138cdf9cd1480dfb952547bbb66b763a735b6d5582578572f5c2e6f9"
|
||||
"1.4.313.0":
|
||||
url: "https://github.com/KhronosGroup/SPIRV-Tools/archive/refs/tags/vulkan-sdk-1.4.313.0.tar.gz"
|
||||
sha256: "6b60f723345ceed5291cceebbcfacf7fea9361a69332261fa08ae57e2a562005"
|
||||
"1.4.309.0":
|
||||
url: "https://github.com/KhronosGroup/SPIRV-Tools/archive/refs/tags/vulkan-sdk-1.4.309.0.tar.gz"
|
||||
sha256: "6b8577054c575573ead3ad71cb6a2c0b3397b64c746cc3c99e48cc5e324c1b55"
|
||||
"1.3.268.0":
|
||||
url: "https://github.com/KhronosGroup/SPIRV-Tools/archive/refs/tags/vulkan-sdk-1.3.268.0.tar.gz"
|
||||
sha256: "4c19fdcffb5fe8ef8dc93d7a65ae78b64edc7a5688893ee381c57f70be77deaf"
|
||||
"1.3.261.1":
|
||||
url: "https://github.com/KhronosGroup/SPIRV-Tools/archive/refs/tags/sdk-1.3.261.1.tar.gz"
|
||||
sha256: "ead95c626ad482882a141d1aa0ce47b9453871f72c42c0b28d39c82f60a52008"
|
||||
"1.3.243.0":
|
||||
url: "https://github.com/KhronosGroup/SPIRV-Tools/archive/refs/tags/sdk-1.3.243.0.tar.gz"
|
||||
sha256: "684a29e37bfdc6e151fe1d3ec4b87c5396c17a439de545d81ea05d4ee6fbc86e"
|
||||
"1.3.239.0":
|
||||
url: "https://github.com/KhronosGroup/SPIRV-Tools/archive/refs/tags/sdk-1.3.239.0.tar.gz"
|
||||
sha256: "327b2dba4515646eee28c1a5fe1332891e81c8b6ff289363f52877f3e67c2d81"
|
||||
"1.3.236.0":
|
||||
url: "https://github.com/KhronosGroup/SPIRV-Tools/archive/refs/tags/sdk-1.3.236.0.tar.gz"
|
||||
sha256: "6789c782a8ba8fa127c3d579f9362f0cdde7a9ccc2e8513cdf217bba579dfda9"
|
||||
"1.2.198.0":
|
||||
url: "https://github.com/KhronosGroup/SPIRV-Tools/archive/refs/tags/sdk-1.2.198.0.tar.gz"
|
||||
sha256: "e8a9fec946f8473129374ad6b98ee690ac9a4574ace7cb3b46bbeb4eddfdc33b"
|
||||
patches:
|
||||
"1.4.313.0":
|
||||
- patch_file: "patches/0001-fix-clang-20-build-issue.patch"
|
||||
patch_description: "fix clang-20 build issue"
|
||||
patch_type: "backport"
|
||||
"1.4.309.0":
|
||||
- patch_file: "patches/0001-fix-clang-20-build-issue.patch"
|
||||
patch_description: "fix clang-20 build issue"
|
||||
patch_type: "backport"
|
||||
"1.3.268.0":
|
||||
- patch_file: "patches/0001-fix-clang-20-build-issue.patch"
|
||||
patch_description: "fix clang-20 build issue"
|
||||
patch_type: "backport"
|
||||
"1.3.261.1":
|
||||
- patch_file: "patches/0001-fix-clang-20-build-issue.patch"
|
||||
patch_description: "fix clang-20 build issue"
|
||||
patch_type: "backport"
|
||||
202
spirv-tools/all/conanfile.py
Normal file
202
spirv-tools/all/conanfile.py
Normal file
@@ -0,0 +1,202 @@
|
||||
from conan import ConanFile
|
||||
from conan.tools.build import check_min_cppstd, stdcpp_library
|
||||
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
|
||||
from conan.tools.env import VirtualBuildEnv
|
||||
from conan.tools.files import copy, get, replace_in_file, rm, rmdir, save, apply_conandata_patches, export_conandata_patches
|
||||
from conan.tools.scm import Version
|
||||
import os
|
||||
|
||||
required_conan_version = ">=2.1"
|
||||
|
||||
|
||||
class SpirvtoolsConan(ConanFile):
|
||||
name = "spirv-tools"
|
||||
homepage = "https://github.com/KhronosGroup/SPIRV-Tools/"
|
||||
description = "Create and optimize SPIRV shaders"
|
||||
topics = ("spirv", "spirv-v", "vulkan", "opengl", "opencl", "hlsl", "khronos")
|
||||
url = "https://github.com/conan-io/conan-center-index"
|
||||
license = "Apache-2.0"
|
||||
|
||||
package_type = "library"
|
||||
settings = "os", "arch", "compiler", "build_type"
|
||||
options = {
|
||||
"shared": [True, False],
|
||||
"fPIC": [True, False],
|
||||
"build_executables": [True, False],
|
||||
}
|
||||
default_options = {
|
||||
"shared": False,
|
||||
"fPIC": True,
|
||||
"build_executables": True,
|
||||
}
|
||||
|
||||
short_paths = True
|
||||
|
||||
def export_sources(self):
|
||||
export_conandata_patches(self)
|
||||
|
||||
def config_options(self):
|
||||
if self.settings.os == "Windows":
|
||||
del self.options.fPIC
|
||||
|
||||
def configure(self):
|
||||
if self.options.shared:
|
||||
self.options.rm_safe("fPIC")
|
||||
|
||||
def layout(self):
|
||||
cmake_layout(self, src_folder="src")
|
||||
|
||||
def requirements(self):
|
||||
if Version(self.version) >= "1.4.341.0":
|
||||
self.requires(f"spirv-headers/{self.version}@{self.user}/{self.channel}")
|
||||
else:
|
||||
self.requires(f"spirv-headers/{self.version}")
|
||||
|
||||
def validate_build(self):
|
||||
# newer versions of the library require C++17 for internals
|
||||
check_min_cppstd(self, 11 if Version(self.version) < "1.3.243" else 17)
|
||||
|
||||
def validate(self):
|
||||
# The interface requires C++11
|
||||
check_min_cppstd(self, 11)
|
||||
|
||||
def build_requirements(self):
|
||||
if Version(self.version) >= "1.3.239":
|
||||
self.tool_requires("cmake/[>=3.17.2 <4]")
|
||||
|
||||
def source(self):
|
||||
get(self, **self.conan_data["sources"][self.version], strip_root=True)
|
||||
|
||||
def generate(self):
|
||||
env = VirtualBuildEnv(self)
|
||||
env.generate()
|
||||
|
||||
tc = CMakeToolchain(self)
|
||||
|
||||
#====================
|
||||
# Shared libs mess in Spirv-Tools (see https://github.com/KhronosGroup/SPIRV-Tools/issues/3909)
|
||||
#====================
|
||||
# We have 2 solutions if shared True:
|
||||
# - Only package SPIRV-Tools-shared lib (private symbols properly hidden), and wait resolution
|
||||
# of above issue before allowing to build shared for all Spirv-Tools libs.
|
||||
# - Build and package shared libs with all symbols exported
|
||||
# (it would require CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS for msvc)
|
||||
# Currently this recipe implements the first solution
|
||||
|
||||
# Static and shared libs are controlled by a weird combination
|
||||
# of SPIRV_TOOLS_BUILD_STATIC and BUILD_SHARED_LIBS.
|
||||
tc.variables["SPIRV_TOOLS_BUILD_STATIC"] = True
|
||||
#============
|
||||
|
||||
# Required by the project's CMakeLists.txt
|
||||
tc.variables["SPIRV-Headers_SOURCE_DIR"] = self.dependencies["spirv-headers"].package_folder.replace("\\", "/")
|
||||
|
||||
# There are some switch( ) statements that are causing errors
|
||||
# need to turn this off
|
||||
tc.variables["SPIRV_WERROR"] = False
|
||||
|
||||
tc.variables["SKIP_SPIRV_TOOLS_INSTALL"] = False
|
||||
tc.variables["SPIRV_LOG_DEBUG"] = False
|
||||
tc.variables["SPIRV_SKIP_TESTS"] = True
|
||||
tc.variables["SPIRV_CHECK_CONTEXT"] = False
|
||||
tc.variables["SPIRV_BUILD_FUZZER"] = False
|
||||
tc.variables["SPIRV_SKIP_EXECUTABLES"] = not self.options.build_executables
|
||||
# To install relocatable shared libs on Macos
|
||||
if Version(self.version) < "1.3.239":
|
||||
tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW"
|
||||
tc.cache_variables["CMAKE_POLICY_VERSION_MINIMUM"] = "3.5" # CMake 4 support
|
||||
# For iOS/tvOS/watchOS
|
||||
tc.variables["CMAKE_MACOSX_BUNDLE"] = False
|
||||
|
||||
tc.generate()
|
||||
|
||||
def _patch_sources(self):
|
||||
apply_conandata_patches(self)
|
||||
# CMAKE_POSITION_INDEPENDENT_CODE was set ON for the entire
|
||||
# project in the lists file.
|
||||
replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"),
|
||||
"set(CMAKE_POSITION_INDEPENDENT_CODE ON)", "")
|
||||
|
||||
def build(self):
|
||||
self._patch_sources()
|
||||
cmake = CMake(self)
|
||||
cmake.configure()
|
||||
cmake.build()
|
||||
|
||||
def package(self):
|
||||
copy(self, "LICENSE*", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses"))
|
||||
cmake = CMake(self)
|
||||
cmake.install()
|
||||
|
||||
rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig"))
|
||||
rmdir(self, os.path.join(self.package_folder, "lib", "cmake"))
|
||||
rmdir(self, os.path.join(self.package_folder, "SPIRV-Tools"))
|
||||
rmdir(self, os.path.join(self.package_folder, "SPIRV-Tools-link"))
|
||||
rmdir(self, os.path.join(self.package_folder, "SPIRV-Tools-opt"))
|
||||
rmdir(self, os.path.join(self.package_folder, "SPIRV-Tools-reduce"))
|
||||
rmdir(self, os.path.join(self.package_folder, "SPIRV-Tools-lint"))
|
||||
rmdir(self, os.path.join(self.package_folder, "SPIRV-Tools-diff"))
|
||||
rmdir(self, os.path.join(self.package_folder, "SPIRV-Tools-tools"))
|
||||
if self.options.shared:
|
||||
for file_name in [
|
||||
"*SPIRV-Tools", "*SPIRV-Tools-opt", "*SPIRV-Tools-link",
|
||||
"*SPIRV-Tools-reduce", "*SPIRV-Tools-lint",
|
||||
]:
|
||||
for ext in [".a", ".lib"]:
|
||||
rm(self, f"{file_name}{ext}", os.path.join(self.package_folder, "lib"))
|
||||
else:
|
||||
rm(self, "*SPIRV-Tools-shared.dll", os.path.join(self.package_folder, "bin"))
|
||||
rm(self, "*SPIRV-Tools-shared*", os.path.join(self.package_folder, "lib"))
|
||||
|
||||
def package_info(self):
|
||||
self.cpp_info.set_property("cmake_file_name", "SPIRV-Tools")
|
||||
self.cpp_info.set_property("pkg_config_name", "SPIRV-Tools-shared" if self.options.shared else "SPIRV-Tools")
|
||||
|
||||
# SPIRV-Tools
|
||||
self.cpp_info.components["spirv-tools-core"].set_property(
|
||||
"cmake_target_name",
|
||||
"SPIRV-Tools-shared" if self.options.shared else "SPIRV-Tools-static",
|
||||
)
|
||||
self.cpp_info.components["spirv-tools-core"].set_property("cmake_target_aliases", ["SPIRV-Tools"]) # before 2020.5, kept for conveniency
|
||||
self.cpp_info.components["spirv-tools-core"].libs = ["SPIRV-Tools-shared" if self.options.shared else "SPIRV-Tools"]
|
||||
self.cpp_info.components["spirv-tools-core"].requires = ["spirv-headers::spirv-headers"]
|
||||
if self.options.shared:
|
||||
self.cpp_info.components["spirv-tools-core"].defines = ["SPIRV_TOOLS_SHAREDLIB"]
|
||||
if self.settings.os in ["Linux", "FreeBSD"]:
|
||||
self.cpp_info.components["spirv-tools-core"].system_libs.extend(["m", "rt"])
|
||||
if not self.options.shared:
|
||||
libcxx = stdcpp_library(self)
|
||||
if libcxx:
|
||||
self.cpp_info.components["spirv-tools-core"].system_libs.append(libcxx)
|
||||
|
||||
# FIXME: others components should have their own CMake config file
|
||||
if not self.options.shared:
|
||||
# SPIRV-Tools-opt
|
||||
self.cpp_info.components["spirv-tools-opt"].set_property("cmake_target_name", "SPIRV-Tools-opt")
|
||||
self.cpp_info.components["spirv-tools-opt"].libs = ["SPIRV-Tools-opt"]
|
||||
self.cpp_info.components["spirv-tools-opt"].requires = ["spirv-tools-core", "spirv-headers::spirv-headers"]
|
||||
if self.settings.os in ["Linux", "FreeBSD"]:
|
||||
self.cpp_info.components["spirv-tools-opt"].system_libs.append("m")
|
||||
|
||||
# SPIRV-Tools-link
|
||||
self.cpp_info.components["spirv-tools-link"].set_property("cmake_target_name", "SPIRV-Tools-link")
|
||||
self.cpp_info.components["spirv-tools-link"].libs = ["SPIRV-Tools-link"]
|
||||
self.cpp_info.components["spirv-tools-link"].requires = ["spirv-tools-core", "spirv-tools-opt"]
|
||||
|
||||
# SPIRV-Tools-reduce
|
||||
self.cpp_info.components["spirv-tools-reduce"].set_property("cmake_target_name", "SPIRV-Tools-reduce")
|
||||
self.cpp_info.components["spirv-tools-reduce"].libs = ["SPIRV-Tools-reduce"]
|
||||
self.cpp_info.components["spirv-tools-reduce"].requires = ["spirv-tools-core", "spirv-tools-opt"]
|
||||
|
||||
# SPIRV-Tools-lint
|
||||
self.cpp_info.components["spirv-tools-lint"].set_property("cmake_target_name", "SPIRV-Tools-lint")
|
||||
self.cpp_info.components["spirv-tools-lint"].libs = ["SPIRV-Tools-lint"]
|
||||
self.cpp_info.components["spirv-tools-lint"].requires = ["spirv-tools-core", "spirv-tools-opt"]
|
||||
|
||||
# SPIRV-Tools-diff
|
||||
self.cpp_info.components["spirv-tools-diff"].set_property("cmake_target_name", "SPIRV-Tools-diff")
|
||||
self.cpp_info.components["spirv-tools-diff"].libs = ["SPIRV-Tools-diff"]
|
||||
self.cpp_info.components["spirv-tools-diff"].requires = ["spirv-tools-core", "spirv-tools-opt"]
|
||||
|
||||
if Version(self.version) < "1.3" and not self.options.shared:
|
||||
del self.cpp_info.components["spirv-tools-diff"]
|
||||
26
spirv-tools/all/patches/0001-fix-clang-20-build-issue.patch
Normal file
26
spirv-tools/all/patches/0001-fix-clang-20-build-issue.patch
Normal file
@@ -0,0 +1,26 @@
|
||||
From 4b46b76c7c68f838f18906c6d3ca275eef207ca7 Mon Sep 17 00:00:00 2001
|
||||
From: Elvis Dukaj <elvis.dukaj@dynatrace.com>
|
||||
Date: Thu, 24 Apr 2025 14:36:21 +0200
|
||||
Subject: [PATCH] fix clang-20 build issue
|
||||
|
||||
---
|
||||
tools/diff/diff.cpp | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/tools/diff/diff.cpp b/tools/diff/diff.cpp
|
||||
index d60edb2e..349ec092 100644
|
||||
--- a/tools/diff/diff.cpp
|
||||
+++ b/tools/diff/diff.cpp
|
||||
@@ -87,7 +87,8 @@ std::unique_ptr<spvtools::opt::IRContext> load_module(const char* path) {
|
||||
return spvtools::BuildModule(
|
||||
kDefaultEnvironment, spvtools::utils::CLIMessageConsumer,
|
||||
std::string(contents.begin(), contents.end()),
|
||||
- spvtools::SpirvTools::kDefaultAssembleOption |
|
||||
+ static_cast<spv_text_to_binary_options_t>(
|
||||
+ spvtools::SpirvTools::kDefaultAssembleOption) |
|
||||
SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS);
|
||||
}
|
||||
|
||||
--
|
||||
2.43.0
|
||||
|
||||
24
spirv-tools/all/test_package/CMakeLists.txt
Normal file
24
spirv-tools/all/test_package/CMakeLists.txt
Normal file
@@ -0,0 +1,24 @@
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
project(test_package)
|
||||
|
||||
find_package(SPIRV-Tools REQUIRED CONFIG)
|
||||
|
||||
add_executable(${PROJECT_NAME}_c test_package.c)
|
||||
if(TARGET SPIRV-Tools-shared)
|
||||
target_link_libraries(${PROJECT_NAME}_c PRIVATE SPIRV-Tools-shared)
|
||||
elseif(TARGET SPIRV-Tools-static)
|
||||
target_link_libraries(${PROJECT_NAME}_c PRIVATE SPIRV-Tools-static)
|
||||
else()
|
||||
target_link_libraries(${PROJECT_NAME}_c PRIVATE SPIRV-Tools)
|
||||
endif()
|
||||
|
||||
# TODO: we should call find_package(SPIRV-Tools-opt REQUIRED CONFIG), but not modeled right now
|
||||
if(TARGET SPIRV-Tools-opt)
|
||||
add_executable(${PROJECT_NAME}_cpp test_package.cpp)
|
||||
target_link_libraries(${PROJECT_NAME}_cpp PRIVATE SPIRV-Tools-opt)
|
||||
if(SPIRV-Tools_VERSION VERSION_LESS "1.3.243.0")
|
||||
target_compile_features(${PROJECT_NAME}_cpp PRIVATE cxx_std_11)
|
||||
else()
|
||||
target_compile_features(${PROJECT_NAME}_cpp PRIVATE cxx_std_17)
|
||||
endif()
|
||||
endif()
|
||||
29
spirv-tools/all/test_package/conanfile.py
Normal file
29
spirv-tools/all/test_package/conanfile.py
Normal file
@@ -0,0 +1,29 @@
|
||||
from conan import ConanFile
|
||||
from conan.tools.build import can_run
|
||||
from conan.tools.cmake import CMake, cmake_layout
|
||||
import os
|
||||
|
||||
|
||||
class TestPackageConan(ConanFile):
|
||||
settings = "os", "arch", "compiler", "build_type"
|
||||
generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv"
|
||||
test_type = "explicit"
|
||||
|
||||
def layout(self):
|
||||
cmake_layout(self)
|
||||
|
||||
def requirements(self):
|
||||
self.requires(self.tested_reference_str)
|
||||
|
||||
def build(self):
|
||||
cmake = CMake(self)
|
||||
cmake.configure()
|
||||
cmake.build()
|
||||
|
||||
def test(self):
|
||||
if can_run(self):
|
||||
bin_path_c = os.path.join(self.cpp.build.bindirs[0], "test_package_c")
|
||||
self.run(bin_path_c, env="conanrun")
|
||||
bin_path_cpp = os.path.join(self.cpp.build.bindirs[0], "test_package_cpp")
|
||||
if os.path.exists(bin_path_cpp):
|
||||
self.run(bin_path_cpp, env="conanrun")
|
||||
31
spirv-tools/all/test_package/test_package.c
Normal file
31
spirv-tools/all/test_package/test_package.c
Normal file
@@ -0,0 +1,31 @@
|
||||
#include "spirv-tools/libspirv.h"
|
||||
|
||||
int main(int argc, char ** argv)
|
||||
{
|
||||
const char input_text[] =
|
||||
"OpCapability Shader\n"
|
||||
"OpCapability Linkage\n"
|
||||
"OpMemoryModel Logical GLSL450";
|
||||
spv_text text;
|
||||
spv_binary binary;
|
||||
spv_context context;
|
||||
|
||||
context = spvContextCreate(SPV_ENV_UNIVERSAL_1_1);
|
||||
|
||||
binary = 0;
|
||||
if( SPV_SUCCESS != spvTextToBinary(context, input_text, sizeof(input_text), &binary, 0) )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
text = 0;
|
||||
if( SPV_SUCCESS != spvBinaryToText(context, binary->code, binary->wordCount, 0, &text, 0) )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
spvTextDestroy(text);
|
||||
spvBinaryDestroy(binary);
|
||||
spvContextDestroy(context);
|
||||
return 0;
|
||||
}
|
||||
65
spirv-tools/all/test_package/test_package.cpp
Normal file
65
spirv-tools/all/test_package/test_package.cpp
Normal file
@@ -0,0 +1,65 @@
|
||||
// Copyright (c) 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// This program demonstrates basic SPIR-V module processing using
|
||||
// SPIRV-Tools C++ API:
|
||||
// * Assembling
|
||||
// * Validating
|
||||
// * Optimizing
|
||||
// * Disassembling
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "spirv-tools/libspirv.hpp"
|
||||
#include "spirv-tools/optimizer.hpp"
|
||||
|
||||
int main() {
|
||||
const std::string source =
|
||||
" OpCapability Linkage "
|
||||
" OpCapability Shader "
|
||||
" OpMemoryModel Logical GLSL450 "
|
||||
" OpSource GLSL 450 "
|
||||
" OpDecorate %spec SpecId 1 "
|
||||
" %int = OpTypeInt 32 1 "
|
||||
" %spec = OpSpecConstant %int 0 "
|
||||
"%const = OpConstant %int 42";
|
||||
|
||||
spvtools::SpirvTools core(SPV_ENV_UNIVERSAL_1_3);
|
||||
spvtools::Optimizer opt(SPV_ENV_UNIVERSAL_1_3);
|
||||
|
||||
auto print_msg_to_stderr = [](spv_message_level_t, const char*,
|
||||
const spv_position_t&, const char* m) {
|
||||
std::cerr << "error: " << m << std::endl;
|
||||
};
|
||||
core.SetMessageConsumer(print_msg_to_stderr);
|
||||
opt.SetMessageConsumer(print_msg_to_stderr);
|
||||
|
||||
std::vector<uint32_t> spirv;
|
||||
if (!core.Assemble(source, &spirv)) return 1;
|
||||
if (!core.Validate(spirv)) return 1;
|
||||
|
||||
opt.RegisterPass(spvtools::CreateSetSpecConstantDefaultValuePass({{1, "42"}}))
|
||||
.RegisterPass(spvtools::CreateFreezeSpecConstantValuePass())
|
||||
.RegisterPass(spvtools::CreateUnifyConstantPass())
|
||||
.RegisterPass(spvtools::CreateStripDebugInfoPass());
|
||||
if (!opt.Run(spirv.data(), spirv.size(), &spirv)) return 1;
|
||||
|
||||
std::string disassembly;
|
||||
if (!core.Disassemble(spirv, &disassembly)) return 1;
|
||||
std::cout << disassembly << "\n";
|
||||
|
||||
return 0;
|
||||
}
|
||||
19
spirv-tools/config.yml
Normal file
19
spirv-tools/config.yml
Normal file
@@ -0,0 +1,19 @@
|
||||
versions:
|
||||
"1.4.341.0":
|
||||
folder: all
|
||||
"1.4.313.0":
|
||||
folder: all
|
||||
"1.4.309.0":
|
||||
folder: all
|
||||
"1.3.268.0":
|
||||
folder: all
|
||||
"1.3.261.1":
|
||||
folder: all
|
||||
"1.3.243.0":
|
||||
folder: all
|
||||
"1.3.239.0":
|
||||
folder: all
|
||||
"1.3.236.0":
|
||||
folder: all
|
||||
"1.2.198.0":
|
||||
folder: all
|
||||
34
vulkan-headers/all/conandata.yml
Normal file
34
vulkan-headers/all/conandata.yml
Normal file
@@ -0,0 +1,34 @@
|
||||
sources:
|
||||
"1.4.341.0":
|
||||
url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/refs/tags/vulkan-sdk-1.4.341.0.tar.gz"
|
||||
sha256: "d73bc5036b6556b741f6985ff600ca720308c5f2850e4a43ceb498bd3de069e7"
|
||||
"1.4.313.0":
|
||||
url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/refs/tags/vulkan-sdk-1.4.313.0.tar.gz"
|
||||
sha256: "20743c99a96c07290f24377360e7a12bdd2c465ba202e0c7ef2ec25d446cf61d"
|
||||
"1.4.309.0":
|
||||
url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/refs/tags/vulkan-sdk-1.4.309.0.tar.gz"
|
||||
sha256: "2bc1b4127950badc80212abf1edfa5c3b5032f3425edf37255863ba7592c1969"
|
||||
"1.3.296.0":
|
||||
url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/refs/tags/vulkan-sdk-1.3.296.0.tar.gz"
|
||||
sha256: "1e872a0be3890784bbe68dcd89b7e017fed77ba95820841848718c98bda6dc33"
|
||||
"1.3.290.0":
|
||||
url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/refs/tags/vulkan-sdk-1.3.290.0.tar.gz"
|
||||
sha256: "5b186e1492d97c44102fe858fb9f222b55524a8b6da940a8795c9e326ae6d722"
|
||||
"1.3.268.0":
|
||||
url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/refs/tags/vulkan-sdk-1.3.268.0.tar.gz"
|
||||
sha256: "94993cbe2b1a604c0d5d9ea37a767e1aba4d771d2bfd4ddceefd66243095164f"
|
||||
"1.3.261.1":
|
||||
url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/refs/tags/sdk-1.3.261.1.tar.gz"
|
||||
sha256: "7a25ebdb6325e626dc5d33bc937b289ccce7ddb7b0ac1a1b1d5d7ff33b6715d3"
|
||||
"1.3.250.0":
|
||||
url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/refs/tags/sdk-1.3.250.0.tar.gz"
|
||||
sha256: "0da601a81b868bc543ec09ab7e514d1b059774993dfce81df7150f432c8bf33a"
|
||||
"1.3.243.0":
|
||||
url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/refs/tags/sdk-1.3.243.0.tar.gz"
|
||||
sha256: "29ddb2ef931f5fb0cabd1a78398f9c4da44d37f8c8a1e110f834f4c260c9d548"
|
||||
"1.3.239.0":
|
||||
url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/refs/tags/sdk-1.3.239.0.tar.gz"
|
||||
sha256: "865fa8e8e8314fcca60777a92f50bd0cf612205a36e719d6975482d3366f619e"
|
||||
"1.2.198.0":
|
||||
url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/refs/tags/sdk-1.2.198.0.tar.gz"
|
||||
sha256: "34782c61cad9b3ccf2fa0a31ec397d4fce99490500b4f3771cb1a48713fece80"
|
||||
56
vulkan-headers/all/conanfile.py
Normal file
56
vulkan-headers/all/conanfile.py
Normal file
@@ -0,0 +1,56 @@
|
||||
from conan import ConanFile
|
||||
from conan.tools.files import copy, get
|
||||
from conan.tools.layout import basic_layout
|
||||
import os
|
||||
|
||||
required_conan_version = ">=1.50.0"
|
||||
|
||||
|
||||
class VulkanHeadersConan(ConanFile):
|
||||
name = "vulkan-headers"
|
||||
description = "Vulkan Header files."
|
||||
license = "Apache-2.0"
|
||||
topics = ("vulkan-headers", "vulkan")
|
||||
homepage = "https://github.com/KhronosGroup/Vulkan-Headers"
|
||||
url = "https://github.com/conan-io/conan-center-index"
|
||||
package_type = "header-library"
|
||||
package_id_embed_mode = "patch_mode"
|
||||
settings = "os", "arch", "compiler", "build_type"
|
||||
no_copy_source = True
|
||||
|
||||
def layout(self):
|
||||
basic_layout(self, src_folder="src")
|
||||
|
||||
def package_id(self):
|
||||
self.info.clear()
|
||||
|
||||
def source(self):
|
||||
get(self, **self.conan_data["sources"][self.version], strip_root=True)
|
||||
|
||||
def build(self):
|
||||
pass
|
||||
|
||||
def package(self):
|
||||
copy(self, "LICENSE*", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses"))
|
||||
copy(self, "*", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include"))
|
||||
copy(self, "*", src=os.path.join(self.source_folder, "registry"), dst=os.path.join(self.package_folder, "res", "vulkan", "registry"))
|
||||
|
||||
def package_info(self):
|
||||
self.cpp_info.set_property("cmake_file_name", "VulkanHeaders")
|
||||
self.cpp_info.components["vulkanheaders"].set_property("cmake_target_name", "Vulkan::Headers")
|
||||
self.cpp_info.components["vulkanheaders"].bindirs = []
|
||||
self.cpp_info.components["vulkanheaders"].libdirs = []
|
||||
self.cpp_info.components["vulkanregistry"].set_property("cmake_target_name", "Vulkan::Registry")
|
||||
self.cpp_info.components["vulkanregistry"].includedirs = [os.path.join("res", "vulkan", "registry")]
|
||||
self.cpp_info.components["vulkanregistry"].bindirs = []
|
||||
self.cpp_info.components["vulkanregistry"].libdirs = []
|
||||
self.cpp_info.components["vulkanregistry"].resdirs = ["res"]
|
||||
|
||||
self.cpp_info.filenames["cmake_find_package"] = "VulkanHeaders"
|
||||
self.cpp_info.filenames["cmake_find_package_multi"] = "VulkanHeaders"
|
||||
self.cpp_info.names["cmake_find_package"] = "Vulkan"
|
||||
self.cpp_info.names["cmake_find_package_multi"] = "Vulkan"
|
||||
self.cpp_info.components["vulkanheaders"].names["cmake_find_package"] = "Headers"
|
||||
self.cpp_info.components["vulkanheaders"].names["cmake_find_package_multi"] = "Headers"
|
||||
self.cpp_info.components["vulkanregistry"].names["cmake_find_package"] = "Registry"
|
||||
self.cpp_info.components["vulkanregistry"].names["cmake_find_package_multi"] = "Registry"
|
||||
7
vulkan-headers/all/test_package/CMakeLists.txt
Normal file
7
vulkan-headers/all/test_package/CMakeLists.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
project(test_package LANGUAGES C)
|
||||
|
||||
find_package(VulkanHeaders REQUIRED CONFIG)
|
||||
|
||||
add_executable(${PROJECT_NAME} test_package.c)
|
||||
target_link_libraries(${PROJECT_NAME} Vulkan::Headers)
|
||||
26
vulkan-headers/all/test_package/conanfile.py
Normal file
26
vulkan-headers/all/test_package/conanfile.py
Normal file
@@ -0,0 +1,26 @@
|
||||
from conan import ConanFile
|
||||
from conan.tools.build import can_run
|
||||
from conan.tools.cmake import CMake, cmake_layout
|
||||
import os
|
||||
|
||||
|
||||
class TestPackageConan(ConanFile):
|
||||
settings = "os", "arch", "compiler", "build_type"
|
||||
generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv"
|
||||
test_type = "explicit"
|
||||
|
||||
def layout(self):
|
||||
cmake_layout(self)
|
||||
|
||||
def requirements(self):
|
||||
self.requires(self.tested_reference_str)
|
||||
|
||||
def build(self):
|
||||
cmake = CMake(self)
|
||||
cmake.configure()
|
||||
cmake.build()
|
||||
|
||||
def test(self):
|
||||
if can_run(self):
|
||||
bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package")
|
||||
self.run(bin_path, env="conanrun")
|
||||
21
vulkan-headers/all/test_package/test_package.c
Normal file
21
vulkan-headers/all/test_package/test_package.c
Normal file
@@ -0,0 +1,21 @@
|
||||
#include <vulkan/vulkan.h>
|
||||
|
||||
int main() {
|
||||
VkApplicationInfo appInfo;
|
||||
appInfo.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
|
||||
appInfo.pApplicationName = "Hello Conan";
|
||||
appInfo.applicationVersion = VK_MAKE_VERSION(1, 0, 0);
|
||||
appInfo.pEngineName = "Dummy Engine";
|
||||
appInfo.engineVersion = VK_MAKE_VERSION(1, 0, 0);
|
||||
appInfo.apiVersion = VK_API_VERSION_1_0;
|
||||
|
||||
VkInstanceCreateInfo createInfo;
|
||||
createInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
|
||||
createInfo.pApplicationInfo = &appInfo;
|
||||
createInfo.enabledLayerCount = 0;
|
||||
createInfo.ppEnabledLayerNames = NULL;
|
||||
createInfo.enabledExtensionCount = 0;
|
||||
createInfo.ppEnabledExtensionNames = NULL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
23
vulkan-headers/config.yml
Normal file
23
vulkan-headers/config.yml
Normal file
@@ -0,0 +1,23 @@
|
||||
versions:
|
||||
"1.4.341.0":
|
||||
folder: all
|
||||
"1.4.313.0":
|
||||
folder: all
|
||||
"1.4.309.0":
|
||||
folder: all
|
||||
"1.3.296.0":
|
||||
folder: all
|
||||
"1.3.290.0":
|
||||
folder: all
|
||||
"1.3.268.0":
|
||||
folder: all
|
||||
"1.3.261.1":
|
||||
folder: all
|
||||
"1.3.250.0":
|
||||
folder: all
|
||||
"1.3.243.0":
|
||||
folder: all
|
||||
"1.3.239.0":
|
||||
folder: all
|
||||
"1.2.198.0":
|
||||
folder: all
|
||||
@@ -29,7 +29,7 @@ class VulkanMemoryAllocatorConan(ConanFile):
|
||||
basic_layout(self, src_folder="src")
|
||||
|
||||
def requirements(self):
|
||||
self.requires("vulkan-headers/1.4.313.0")
|
||||
self.requires(f"vulkan-headers/1.4.341.0@{self.user}/{self.channel}")
|
||||
|
||||
def package_id(self):
|
||||
self.info.clear()
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
sources:
|
||||
"1.4.341.0":
|
||||
url: "https://github.com/KhronosGroup/Vulkan-Utility-Libraries/archive/refs/heads/vulkan-sdk-1.4.341.tar.gz"
|
||||
sha256: "a9e0611238558e108f6cc1df6e21ae00c8a935f9a8a0003c88d8de1fc4acec65"
|
||||
"1.4.313.0":
|
||||
url: "https://github.com/KhronosGroup/Vulkan-Utility-Libraries/archive/refs/heads/vulkan-sdk-1.4.313.tar.gz"
|
||||
sha256: "18c49c694f6b6aec17d9e8c7807a89ac7ad93517c93cb94ceaed3150bd4117ef"
|
||||
|
||||
@@ -2,6 +2,7 @@ from conan import ConanFile
|
||||
from conan.tools.build import check_min_cppstd
|
||||
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
|
||||
from conan.tools.files import copy, get, rm, rmdir
|
||||
from conan.tools.scm import Version
|
||||
import os
|
||||
|
||||
|
||||
@@ -29,7 +30,10 @@ class VulkanUtilityLibraries(ConanFile):
|
||||
cmake_layout(self, src_folder="src")
|
||||
|
||||
def requirements(self):
|
||||
self.requires(f"vulkan-headers/{self.version}", transitive_headers=True)
|
||||
if Version(self.version) >= "1.4.341.0":
|
||||
self.requires(f"vulkan-headers/{self.version}@{self.user}/{self.channel}", transitive_headers=True)
|
||||
else:
|
||||
self.requires(f"vulkan-headers/{self.version}", transitive_headers=True)
|
||||
|
||||
def validate(self):
|
||||
check_min_cppstd(self, 17)
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
versions:
|
||||
"1.4.341.0":
|
||||
folder: all
|
||||
"1.4.313.0":
|
||||
folder: all
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
sources:
|
||||
"1.4.341.0":
|
||||
url: "https://github.com/KhronosGroup/Vulkan-ValidationLayers/archive/refs/tags/vulkan-sdk-1.4.341.0.tar.gz"
|
||||
sha256: "7f521490495e43561f70fe8b6317fd5cc13d4083413f1abf891f50cbabe12238"
|
||||
"1.4.313.0":
|
||||
url: "https://github.com/KhronosGroup/Vulkan-ValidationLayers/archive/refs/tags/vulkan-sdk-1.4.313.0.tar.gz"
|
||||
sha256: "49b8ee6c2352157b12b1c87eb1165bc0f82a885bc2135ad97041ac84f79aacd0"
|
||||
|
||||
@@ -101,15 +101,24 @@ class VulkanValidationLayersConan(ConanFile):
|
||||
|
||||
def requirements(self):
|
||||
self.requires("robin-hood-hashing/3.11.5")
|
||||
self.requires(self._require("spirv-headers"))
|
||||
if Version(conan_version).minor >= "1.4.341":
|
||||
self.requires(f"{self._require("spirv-headers")}@{self.user}/{self.channel}")
|
||||
else:
|
||||
self.requires(self._require("spirv-headers"))
|
||||
if Version(conan_version).minor >= "1.4.313":
|
||||
self.requires(f"{self._require("vulkan-utility-libraries")}@{self.user}/{self.channel}", transitive_headers=True)
|
||||
if Version(conan_version).major < "2":
|
||||
# TODO: set private=True, once the issue is resolved https://github.com/conan-io/conan/issues/9390
|
||||
self.requires(self._require("spirv-tools"), private=not hasattr(self, "settings_build"))
|
||||
else:
|
||||
self.requires(self._require("spirv-tools"))
|
||||
self.requires(self._require("vulkan-headers"), transitive_headers=True)
|
||||
if Version(conan_version).minor >= "1.4.341":
|
||||
self.requires(f"{self._require("spirv-tools")}@{self.user}/{self.channel}")
|
||||
else:
|
||||
self.requires(self._require("spirv-tools"))
|
||||
if Version(conan_version).minor >= "1.4.341":
|
||||
self.requires(f"{self._require("vulkan-headers")}@{self.user}/{self.channel}", transitive_headers=True)
|
||||
else:
|
||||
self.requires(self._require("vulkan-headers"), transitive_headers=True)
|
||||
if self.options.get_safe("with_wsi_xcb") or self.options.get_safe("with_wsi_xlib"):
|
||||
self.requires("xorg/system")
|
||||
if self._needs_wayland_for_build:
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
spirv-headers: "1.4.341.0"
|
||||
spirv-tools: "1.4.341.0"
|
||||
vulkan-headers: "1.4.341.0"
|
||||
vulkan-utility-libraries: "1.4.341.0"
|
||||
@@ -1,4 +1,6 @@
|
||||
versions:
|
||||
"1.4.341.0":
|
||||
folder: all
|
||||
"1.4.313.0":
|
||||
folder: all
|
||||
"1.3.243.0":
|
||||
|
||||
Reference in New Issue
Block a user