Initial import (#1632243)

This commit is contained in:
Robert-André Mauchin 2018-10-02 18:08:23 +02:00
parent 3d7f9b9a20
commit 0862c53e13
6 changed files with 253 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/shaderc-7a23a01.tar.gz

View File

@ -0,0 +1,28 @@
From ae4cdbf6d82676222ab3af481a1e164e529f6c16 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Robert-Andr=C3=A9=20Mauchin?= <zebob.m@gmail.com>
Date: Mon, 24 Sep 2018 13:28:05 +0200
Subject: [PATCH] Add SONAME version to the library
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Robert-André Mauchin <zebob.m@gmail.com>
---
libshaderc/CMakeLists.txt | 1 +
1 file changed, 1 insertion(+)
diff --git a/libshaderc/CMakeLists.txt b/libshaderc/CMakeLists.txt
index 14da8ce..0eb3698 100644
--- a/libshaderc/CMakeLists.txt
+++ b/libshaderc/CMakeLists.txt
@@ -21,6 +21,7 @@ target_compile_definitions(shaderc_shared
PRIVATE SHADERC_IMPLEMENTATION
PUBLIC SHADERC_SHAREDLIB
)
+set_target_properties(shaderc_shared PROPERTIES SOVERSION 1)
if(SHADERC_ENABLE_INSTALL)
install(
--
2.17.1

View File

@ -0,0 +1,36 @@
From f3e0470ccf96a48f6e5701aa64aa831d51769d8e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Robert-Andr=C3=A9=20Mauchin?= <zebob.m@gmail.com>
Date: Sun, 30 Sep 2018 20:53:08 +0200
Subject: [PATCH] Drop third party code in CMakeLists.txt
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Robert-André Mauchin <zebob.m@gmail.com>
---
CMakeLists.txt | 6 ------
1 file changed, 6 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b9bd0df..bd2c9f7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -52,15 +52,9 @@ endif(MSVC)
# Configure subdirectories.
# We depend on these for later projects, so they should come first.
-add_subdirectory(third_party)
add_subdirectory(libshaderc_util)
add_subdirectory(libshaderc)
add_subdirectory(glslc)
add_subdirectory(examples)
-add_custom_target(build-version
- ${PYTHON_EXE}
- ${CMAKE_CURRENT_SOURCE_DIR}/utils/update_build_version.py
- ${shaderc_SOURCE_DIR} ${spirv-tools_SOURCE_DIR} ${glslang_SOURCE_DIR}
- COMMENT "Update build-version.inc in the Shaderc build directory (if necessary).")
--
2.19.0

View File

@ -0,0 +1,44 @@
From 21c8be385b3fab5edcb934a6d99f69fd389c4e67 Mon Sep 17 00:00:00 2001
From: Niklas Haas <git@haasn.xyz>
Date: Tue, 29 May 2018 07:34:00 +0200
Subject: [PATCH] Fix the link order of libglslang and libHLSL
libglslang depends on libHLSL, so the latter needs to be specified last.
This fixes an issue when trying to build shaderc against system-wide
versions of libglslang/libHLSL, rather than the in-tree versions from
third_party.
Additionally, libshaderc_util also depends on SPIRV-Tools
---
glslc/CMakeLists.txt | 2 +-
libshaderc_util/CMakeLists.txt | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/glslc/CMakeLists.txt b/glslc/CMakeLists.txt
index acf6fb0..0f5d888 100644
--- a/glslc/CMakeLists.txt
+++ b/glslc/CMakeLists.txt
@@ -18,7 +18,7 @@ add_library(glslc STATIC
shaderc_default_compile_options(glslc)
target_include_directories(glslc PUBLIC ${glslang_SOURCE_DIR})
target_link_libraries(glslc PRIVATE glslang OSDependent OGLCompiler
- HLSL glslang SPIRV ${CMAKE_THREAD_LIBS_INIT})
+ glslang SPIRV HLSL ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(glslc PRIVATE shaderc_util shaderc)
add_executable(glslc_exe src/main.cc)
diff --git a/libshaderc_util/CMakeLists.txt b/libshaderc_util/CMakeLists.txt
index 873540a..6d0c465 100644
--- a/libshaderc_util/CMakeLists.txt
+++ b/libshaderc_util/CMakeLists.txt
@@ -34,8 +34,8 @@ endif(SHADERC_ENABLE_INSTALL)
find_package(Threads)
target_link_libraries(shaderc_util PRIVATE
- glslang OSDependent OGLCompiler HLSL glslang SPIRV
- SPIRV-Tools-opt ${CMAKE_THREAD_LIBS_INIT})
+ glslang OSDependent OGLCompiler glslang HLSL SPIRV
+ SPIRV-Tools-opt SPIRV-Tools ${CMAKE_THREAD_LIBS_INIT})
shaderc_add_tests(
TEST_PREFIX shaderc_util

143
shaderc.spec Normal file
View File

@ -0,0 +1,143 @@
# Release 2017.2
%global commit 7a23a01742b88329fb2260eda007172135ba25d4
%global shortcommit %(c=%{commit}; echo ${c:0:7})
%global snapshotdate 20180924
%global gitversion beginning-449-g7a23a01
# Need to keep this in sync with spirv-tools
%global spirv_commit f508896d6487d09f5c9a2a3835595446fec0791a
Name: shaderc
Version: 2017.2
Release: 1%{?dist}
Summary: A collection of tools, libraries, and tests for Vulkan shader compilation
License: ASL 2.0
URL: https://github.com/google/shaderc
Source0: %url/archive/%{commit}/%{name}-%{shortcommit}.tar.gz
# https://github.com/google/shaderc/pull/463
Patch0: https://patch-diff.githubusercontent.com/raw/google/shaderc/pull/463.patch#/0001-Fix-the-link-order-of-libglslang-and-libHLSL.patch
# https://github.com/google/shaderc/pull/493
Patch1: https://patch-diff.githubusercontent.com/raw/google/shaderc/pull/493.patch#/0001-Add-SONAME-version-to-the-library.patch
# Patch to unbundle 3rd party code
Patch2: 0001-Drop-third-party-code-in-CMakeLists.txt.patch
BuildRequires: cmake3
BuildRequires: gcc-c++
BuildRequires: ninja-build
BuildRequires: python3-devel
BuildRequires: glslang-devel
BuildRequires: spirv-headers-devel
BuildRequires: spirv-tools
BuildRequires: spirv-tools-devel
%description
A collection of tools, libraries and tests for shader compilation.
Shaderc aims to to provide:
- a command line compiler with GCC- and Clang-like usage, for better
integration with build systems
- an API where functionality can be added without breaking existing clients
- an API supporting standard concurrency patterns across multiple
operating systems
- increased functionality such as file #include support
%package -n glslc
Summary: A command line compiler for GLSL/HLSL to SPIR-V
%description -n glslc
A command line compiler for GLSL/HLSL to SPIR-V.
%package -n libshaderc
Summary: A library for compiling shader strings into SPIR-V
%description -n libshaderc
A library for compiling shader strings into SPIR-V.
%package -n libshaderc-devel
Summary: Development files for libshaderc
Requires: libshaderc%{?_isa} = %{version}-%{release}
%description -n libshaderc-devel
A library for compiling shader strings into SPIR-V.
Development files for libshaderc.
%package -n libshaderc-static
Summary: A library for compiling shader strings into SPIR-V (static libraries)
%description -n libshaderc-static
A library for compiling shader strings into SPIR-V.
Static libraries for libshaderc.
%prep
%autosetup -p1 -n %{name}-%{commit}
rm -rf third_party
# Stolen from Gentoo
# Create build-version.inc since we want to use our packaged
# SPIRV-Tools and glslang
echo \"shaderc $(grep -m1 -o '^v[[:digit:]]\{4\}\.[[:digit:]]\(-dev\)\?' CHANGES) %{gitversion}\" \
> glslc/src/build-version.inc
echo \"spirv-tools $(grep -m1 -o '^v[[:digit:]]\{4\}\.[[:digit:]]\(-dev\)\?' /usr/share/doc/spirv-tools/CHANGES) %{spirv_commit}\" \
>> glslc/src/build-version.inc
echo \"glslang \'\'\" >> glslc/src/build-version.inc
%build
mkdir %_target_platform
cd %_target_platform
# We disable the tests because they don't work with our unbundling of 3rd party.
# See https://github.com/google/shaderc/issues/470
%cmake3 -DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_SKIP_RPATH=True \
-DSHADERC_SKIP_TESTS=True \
-DPYTHON_EXE=%{__python3} \
-GNinja ..
%ninja_build
%install
%ninja_install -C %_target_platform
%check
ctest -V
%files -n glslc
%doc glslc/README.asciidoc
%license LICENSE
%{_bindir}/glslc
%files -n libshaderc
%doc AUTHORS CHANGES CONTRIBUTORS README.md
%license LICENSE
%{_libdir}/libshaderc_shared.so.1*
%files -n libshaderc-devel
%{_includedir}/%{name}/
%{_libdir}/libshaderc_shared.so
%files -n libshaderc-static
%license LICENSE
%{_libdir}/libshaderc.a
%{_libdir}/libshaderc_combined.a
%{_libdir}/libshaderc_util.a
%changelog
* Mon Sep 24 2018 Robert-André Mauchin <zebob.m@gmail.com> - 2017.2-1
- Initial build

1
sources Normal file
View File

@ -0,0 +1 @@
SHA512 (shaderc-7a23a01.tar.gz) = 558447bc29b0c7610fda0f6c2a6b66f3c8fc7f2f5e336ad190ae959caa8c7aa1e09d3c2efe0e197cb2cbe1fa97e0c68623ce423c658b29fcbd1f1e1ea4c85f18