Unbundle glslang

Resolves: RHEL-76115
This commit is contained in:
Jan Grulich 2025-01-24 10:34:53 +01:00
parent 54fb27f102
commit f72d06cdbe
2 changed files with 107 additions and 1 deletions

View File

@ -11,7 +11,7 @@
Summary: Qt6 - Qt Shader Tools module builds on the SPIR-V Open Source Ecosystem
Name: qt6-%{qt_module}
Version: 6.8.1
Release: 3%{?dist}
Release: 4%{?dist}
License: LGPL-3.0-only OR GPL-3.0-only WITH Qt-GPL-exception-1.0
Url: http://www.qt.io
@ -24,6 +24,9 @@ Source0: https://download.qt.io/development_releases/qt/%{majmin}/%{qt_version}/
Source0: https://download.qt.io/official_releases/qt/%{majmin}/%{version}/submodules/%{qt_module}-everywhere-src-%{version}.tar.xz
%endif
# Downstream patches
Patch0: qtshadertools-unbundle-glslang.patch
# Upstream patches
# Upstreamable patches
@ -34,8 +37,12 @@ BuildRequires: ninja-build
BuildRequires: qt6-qtbase-devel >= %{version}
BuildRequires: qt6-qtbase-private-devel
%{?_qt6:Requires: %{_qt6}%{?_isa} = %{_qt6_version}}
BuildRequires: glslang-devel
BuildRequires: spirv-tools-devel
BuildRequires: pkgconfig(xkbcommon) >= 0.4.1
Provides: bundled(spirv-cross)
%description
%{summary}.
@ -59,6 +66,10 @@ Requires: %{name}%{?_isa} = %{version}-%{release}
%prep
%autosetup -n %{qt_module}-everywhere-src-%{qt_version}%{?unstable:-%{prerelease}} -p1
# Make sure 3rdparty/glslang isn't used
pushd src/3rdparty
rm -rf glslang
popd
%build
%cmake_qt6 \
@ -133,6 +144,10 @@ popd
%endif
%changelog
* Fri Jan 24 2025 Jan Grulich <jgrulich@redhat.com> - 6.8.1-4
- Unbundle glslang
Resolves: RHEL-76115
* Wed Jan 15 2025 Jan Grulich <jgrulich@redhat.com> - 6.8.1-3
- Add spirv-tools as a dependency to -devel
Resolves: RHEL-74028

View File

@ -0,0 +1,91 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e68166a..97c942e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -15,6 +15,15 @@ project(QtShaderTools
find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS BuildInternals Core)
find_package(Qt6 ${PROJECT_VERSION} QUIET CONFIG OPTIONAL_COMPONENTS Gui)
+
+find_package(PkgConfig QUIET)
+pkg_check_modules(PC_glslang QUIET "glslang")
+pkg_check_modules(PC_spirv_tools QUIET "SPIRV-Tools")
+find_library(GLSLANG_RESOURCE_LIMITS_LIBRARY
+ NAMES libglslang-default-resource-limits.a
+ PATHS /usr/lib /usr/lib64
+ NO_DEFAULT_PATH
+)
qt_internal_project_setup()
if(INTEGRITY)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index cb0e25d..6a22710 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -3,6 +3,6 @@
# Generated from src.pro.
-add_subdirectory(glslang)
+# add_subdirectory(glslang)
add_subdirectory(SPIRV-Cross)
add_subdirectory(shadertools)
diff --git a/src/shadertools/CMakeLists.txt b/src/shadertools/CMakeLists.txt
index 04371a5..4a652bb 100644
--- a/src/shadertools/CMakeLists.txt
+++ b/src/shadertools/CMakeLists.txt
@@ -20,15 +20,15 @@ qt_internal_add_module(ShaderTools
DEFINES
QT_BUILD_SHADERTOOLS_LIB
INCLUDE_DIRECTORIES
+ ${PC_glslang_INCLUDE_DIRS}
../3rdparty/SPIRV-Cross
- ../3rdparty/glslang
LIBRARIES
Qt::GuiPrivate
# special case begin
Qt::BundledSpirv_Cross
- Qt::BundledGlslang_Glslang
- Qt::BundledGlslang_Spirv
- Qt::BundledGlslang_Osdependent
+ ${PC_glslang_LINK_LIBRARIES}
+ ${PC_spirv_tools_LINK_LIBRARIES}
+ ${GLSLANG_RESOURCE_LIMITS_LIBRARY}
# special case end
PUBLIC_LIBRARIES
Qt::Core
diff --git a/src/shadertools/qspirvcompiler.cpp b/src/shadertools/qspirvcompiler.cpp
index 4e97d48..b6fefb8 100644
--- a/src/shadertools/qspirvcompiler.cpp
+++ b/src/shadertools/qspirvcompiler.cpp
@@ -10,7 +10,7 @@ QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wsuggest-override")
#include <glslang/Public/ShaderLang.h>
#include <glslang/Public/ResourceLimits.h>
-#include <SPIRV/GlslangToSpv.h>
+#include <glslang/SPIRV/GlslangToSpv.h>
QT_WARNING_POP
//#define TOKENIZER_DEBUG
@@ -47,8 +47,6 @@ bool QSpirvCompilerPrivate::readFile(const QString &fn)
return true;
}
-using namespace QtShaderTools;
-
class Includer : public glslang::TShader::Includer
{
public:
diff --git a/src/shadertools/qspirvshaderremap.cpp b/src/shadertools/qspirvshaderremap.cpp
index e45161d..d8d4bfe 100644
--- a/src/shadertools/qspirvshaderremap.cpp
+++ b/src/shadertools/qspirvshaderremap.cpp
@@ -3,7 +3,7 @@
#include "qspirvshaderremap_p.h"
-#include <SPIRV/SPVRemapper.h>
+#include <glslang/SPIRV/SPVRemapper.h>
QT_BEGIN_NAMESPACE