Initial commit

This commit is contained in:
Your Name
2026-04-23 17:07:55 +08:00
commit b7e39e063b
16725 changed files with 1625565 additions and 0 deletions
@@ -0,0 +1,76 @@
From 7f6c60f928dabd8b15aa948886523ddf15709215 Mon Sep 17 00:00:00 2001
From: Alexander Kanavin <alex@linutronix.de>
Date: Wed, 2 Nov 2022 15:42:58 +0100
Subject: [PATCH] CMakeLists.txt: drop OSDependent/OGLCompiler from lists of
glslang libraries
glslang no longer installs them separately, and all needed
functionality has been merged into glslang shared library itself:
This wasn't a problem previously as they were still provided,
as static libraries but in latest glslang they no longer are:
https://github.com/KhronosGroup/glslang/commit/7cd519511c32d7e86d901c7ed231cb84c652d18d
Upstream-Status: Submitted [https://github.com/google/shaderc/pull/1276]
Signed-off-by: Alexander Kanavin <alex@linutronix.de>
---
glslc/CMakeLists.txt | 2 +-
libshaderc/CMakeLists.txt | 2 +-
libshaderc/README.md | 4 ++--
libshaderc_util/CMakeLists.txt | 2 +-
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/glslc/CMakeLists.txt b/glslc/CMakeLists.txt
index 31664d1..5093bd9 100644
--- a/glslc/CMakeLists.txt
+++ b/glslc/CMakeLists.txt
@@ -43,7 +43,7 @@ if (SHADERC_ENABLE_WGSL_OUTPUT)
endif(SHADERC_ENABLE_WGSL_OUTPUT)
target_link_libraries(glslc PRIVATE
- glslang OSDependent OGLCompiler HLSL glslang SPIRV # Glslang libraries
+ glslang HLSL glslang SPIRV # Glslang libraries
$<$<BOOL:${SHADERC_ENABLE_WGSL_OUTPUT}>:libtint> # Tint libraries, optional
shaderc_util shaderc # internal Shaderc libraries
${CMAKE_THREAD_LIBS_INIT})
diff --git a/libshaderc/CMakeLists.txt b/libshaderc/CMakeLists.txt
index 3ada419..d3542bf 100644
--- a/libshaderc/CMakeLists.txt
+++ b/libshaderc/CMakeLists.txt
@@ -62,7 +62,7 @@ endif(SHADERC_ENABLE_INSTALL)
find_package(Threads)
set(SHADERC_LIBS
- glslang OSDependent OGLCompiler glslang ${CMAKE_THREAD_LIBS_INIT}
+ glslang glslang ${CMAKE_THREAD_LIBS_INIT}
shaderc_util
SPIRV # from glslang
SPIRV-Tools
diff --git a/libshaderc/README.md b/libshaderc/README.md
index bf9d317..1071769 100644
--- a/libshaderc/README.md
+++ b/libshaderc/README.md
@@ -7,8 +7,8 @@ A library for compiling shader strings into SPIR-V.
There are two main shaderc libraries that are created during a CMake
compilation. The first is `libshaderc`, which is a static library
containing just the functionality exposed by libshaderc. It depends
-on other compilation targets `glslang`, `OSDependent`, `OGLCompiler`,
-`shaderc_util`, `SPIRV`, `HLSL`, `SPIRV-Tools`, and `SPIRV-Tools-opt`.
+on other compilation targets `glslang`, `shaderc_util`, `SPIRV`,
+`HLSL`, `SPIRV-Tools`, and `SPIRV-Tools-opt`.
The other is `libshaderc_combined`, which is a static library containing
libshaderc and all of its dependencies.
diff --git a/libshaderc_util/CMakeLists.txt b/libshaderc_util/CMakeLists.txt
index 99ce3c4..5291175 100644
--- a/libshaderc_util/CMakeLists.txt
+++ b/libshaderc_util/CMakeLists.txt
@@ -46,7 +46,7 @@ add_definitions(-DENABLE_HLSL)
find_package(Threads)
target_link_libraries(shaderc_util PRIVATE
- glslang OSDependent OGLCompiler HLSL glslang SPIRV
+ glslang HLSL glslang SPIRV
SPIRV-Tools-opt ${CMAKE_THREAD_LIBS_INIT})
shaderc_add_tests(
@@ -0,0 +1,107 @@
From d3fbd6b9427f29606540528d17fe02930cd78d0c Mon Sep 17 00:00:00 2001
From: Jose Quaresma <quaresma.jose@gmail.com>
Date: Sat, 13 Feb 2021 00:45:56 +0000
Subject: [PATCH] cmake: disable building external dependencies
- add cmake option to disable the build of the third_party dependencies
- change the update_build_version.py to use pkg-config when third_party dependencies not found
Upstream-Status: Inappropriate [OE-core specific]
Signed-off-by: Jose Quaresma <quaresma.jose@gmail.com>
---
CMakeLists.txt | 13 ++++++++++---
utils/update_build_version.py | 22 +++++++++++++++-------
2 files changed, 25 insertions(+), 10 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 633c244..75b01da 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -67,6 +67,7 @@ else()
endif()
option(SHADERC_ENABLE_WERROR_COMPILE "Enable passing -Werror to compiler, if available" ON)
+option(BUILD_EXTERNAL "Build external dependencies in /third_party" ON)
set (CMAKE_CXX_STANDARD 17)
@@ -129,8 +130,14 @@ endif(MSVC)
# Configure subdirectories.
-# We depend on these for later projects, so they should come first.
-add_subdirectory(third_party)
+if(BUILD_EXTERNAL)
+ # We depend on these for later projects, so they should come first.
+ add_subdirectory(third_party)
+else()
+ find_package(PkgConfig REQUIRED)
+ pkg_check_modules (PKG_CHECK REQUIRED SPIRV-Tools)
+ pkg_check_modules (PKG_CHECK REQUIRED glslang)
+endif()
add_subdirectory(libshaderc_util)
add_subdirectory(libshaderc)
@@ -142,7 +149,7 @@ endif()
add_custom_target(build-version
${PYTHON_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/utils/update_build_version.py
- ${shaderc_SOURCE_DIR} ${spirv-tools_SOURCE_DIR} ${glslang_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/build-version.inc
+ ${CMAKE_CURRENT_BINARY_DIR}/build-version.inc ${shaderc_SOURCE_DIR} ${spirv-tools_SOURCE_DIR} ${glslang_SOURCE_DIR}
COMMENT "Update build-version.inc in the Shaderc build directory (if necessary).")
function(define_pkg_config_file NAME LIBS)
diff --git a/utils/update_build_version.py b/utils/update_build_version.py
index 5785390..f72b762 100755
--- a/utils/update_build_version.py
+++ b/utils/update_build_version.py
@@ -30,6 +30,7 @@ import re
import subprocess
import sys
import time
+import itertools
def mkdir_p(directory):
"""Make the directory, and all its ancestors as required. Any of the
@@ -121,25 +122,32 @@ def get_version_string(project, directory):
directory, which consists of software version string and git description
string."""
detailed_version_string_lst = [project]
- if project != 'glslang':
- detailed_version_string_lst.append(deduce_software_version(directory))
- detailed_version_string_lst.append(describe(directory).replace('"', '\\"'))
+ if isinstance(directory, str) and os.path.isdir(directory):
+ if project != 'glslang':
+ detailed_version_string_lst.append(deduce_software_version(directory))
+ detailed_version_string_lst.append(describe(directory).replace('"', '\\"'))
+ else:
+ if project == 'spirv-tools':
+ project = 'SPIRV-Tools'
+ pkgconfig = ['pkg-config', '--modversion', project]
+ version = subprocess.run(pkgconfig, capture_output=True, text=True).stdout.rstrip()
+ detailed_version_string_lst.append(version)
return ' '.join(detailed_version_string_lst)
def main():
- if len(sys.argv) != 5:
- print(('usage: {} <shaderc-dir> <spirv-tools-dir> <glslang-dir> <output-file>'.format(
+ if len(sys.argv) < 3:
+ print(('usage: {} <output-file> <shaderc-dir> [spirv-tools-dir] [glslang-dir]'.format(
sys.argv[0])))
sys.exit(1)
projects = ['shaderc', 'spirv-tools', 'glslang']
new_content = ''.join([
'"{}\\n"\n'.format(get_version_string(p, d))
- for (p, d) in zip(projects, sys.argv[1:])
+ for (p, d) in itertools.zip_longest(projects, sys.argv[2:])
])
- output_file = sys.argv[4]
+ output_file = sys.argv[1]
mkdir_p(os.path.dirname(output_file))
if os.path.isfile(output_file):
@@ -0,0 +1,26 @@
From d02ad48d5c9b48af70ddea2e6998081347ef82f3 Mon Sep 17 00:00:00 2001
From: Jose Quaresma <quaresma.jose@gmail.com>
Date: Sat, 13 Feb 2021 00:45:56 +0000
Subject: [PATCH] libshaderc_util: fix glslang header file location
Upstream-Status: Pending
Signed-off-by: Jose Quaresma <quaresma.jose@gmail.com>
---
libshaderc_util/src/compiler.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libshaderc_util/src/compiler.cc b/libshaderc_util/src/compiler.cc
index 051558b..9c4476c 100644
--- a/libshaderc_util/src/compiler.cc
+++ b/libshaderc_util/src/compiler.cc
@@ -20,7 +20,7 @@
#include <thread>
#include <tuple>
-#include "SPIRV/GlslangToSpv.h"
+#include "glslang/SPIRV/GlslangToSpv.h"
#include "libshaderc_util/format.h"
#include "libshaderc_util/io_shaderc.h"
#include "libshaderc_util/message.h"
@@ -0,0 +1,30 @@
SUMMARY = "A collection of tools, libraries and tests for shader compilation"
DESCRIPTION = "The Shaderc library provides an API for compiling GLSL/HLSL \
source code to SPIRV modules. It has been shipping in the Android NDK since version r12b."
SECTION = "graphics"
HOMEPAGE = "https://github.com/google/shaderc"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=86d3f3a95c324c9479bd8986968f4327"
SRCREV = "7a8b3da0583425cf511336cf3afbdcf2ebc8b36b"
SRC_URI = "git://github.com/google/shaderc.git;protocol=https;branch=main \
file://0001-cmake-disable-building-external-dependencies.patch \
file://0002-libshaderc_util-fix-glslang-header-file-location.patch \
file://0001-CMakeLists.txt-drop-OSDependent-OGLCompiler-from-lis.patch \
"
UPSTREAM_CHECK_GITTAGREGEX = "^v(?P<pver>\d+(\.\d+)+)$"
S = "${WORKDIR}/git"
inherit cmake python3native pkgconfig
DEPENDS = "spirv-headers spirv-tools glslang"
EXTRA_OECMAKE = " \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_EXTERNAL=OFF \
-DSHADERC_SKIP_TESTS=ON \
-DSHADERC_SKIP_EXAMPLES=ON \
-DSHADERC_SKIP_COPYRIGHT_CHECK=ON \
"
BBCLASSEXTEND = "native nativesdk"