diff --git a/graphics/glslang/README b/graphics/glslang/README index e93d06b191..d61381b370 100644 --- a/graphics/glslang/README +++ b/graphics/glslang/README @@ -1,2 +1,5 @@ Khronos-reference front end for GLSL/ESSL, partial front end for HLSL, and a SPIR-V generator. + +If SPIRV-Tools is not installed a package will be created where illegal +SPIRV may be generated for HLSL. diff --git a/graphics/glslang/SPIRV-Tools-shared.patch b/graphics/glslang/SPIRV-Tools-shared.patch new file mode 100644 index 0000000000..34cb8ad9bc --- /dev/null +++ b/graphics/glslang/SPIRV-Tools-shared.patch @@ -0,0 +1,61 @@ +From 1504af077935a0bfd1b1b59f77d8b1cd89f913b5 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= +Date: Mon, 10 Dec 2018 13:05:15 +0100 +Subject: [PATCH] CMake: Allow linking against system-installed SPIRV-Tools + +Fixes #1585. +--- + CMakeLists.txt | 7 ++++++- + SPIRV/CMakeLists.txt | 21 +++++++++++++-------- + 2 files changed, 19 insertions(+), 9 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index ada2b8fb9..22243f491 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -320,7 +320,12 @@ if(BUILD_EXTERNAL AND IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/External) + add_subdirectory(External) + endif() + +-if(NOT TARGET SPIRV-Tools-opt) ++find_package(PkgConfig) ++if(PkgConfig_FOUND) ++ pkg_check_modules(SPIRV-Tools SPIRV-Tools) ++endif() ++# Former would be system-installed, later is from External ++if(NOT SPIRV-Tools_FOUND AND NOT TARGET SPIRV-Tools-opt) + set(ENABLE_OPT OFF) + endif() + +diff --git a/SPIRV/CMakeLists.txt b/SPIRV/CMakeLists.txt +index d699daddb..28beb47bb 100644 +--- a/SPIRV/CMakeLists.txt ++++ b/SPIRV/CMakeLists.txt +@@ -91,14 +91,19 @@ if(WIN32 AND BUILD_SHARED_LIBS) + endif() + + if(ENABLE_OPT) +- target_include_directories(SPIRV +- PRIVATE ${spirv-tools_SOURCE_DIR}/include +- PRIVATE ${spirv-tools_SOURCE_DIR}/source +- ) +- target_link_libraries(SPIRV PRIVATE MachineIndependent SPIRV-Tools-opt) +- target_include_directories(SPIRV PUBLIC +- $ +- $) ++ if(SPIRV-Tools_FOUND) ++ target_include_directories(SPIRV PUBLIC ${SPIRV-Tools_INCLUDEDIR}) ++ target_link_libraries(SPIRV glslang ${SPIRV-Tools_LIBRARIES}) ++ else() ++ target_include_directories(SPIRV ++ PRIVATE ${spirv-tools_SOURCE_DIR}/include ++ PRIVATE ${spirv-tools_SOURCE_DIR}/source ++ ) ++ target_link_libraries(SPIRV PRIVATE MachineIndependent SPIRV-Tools-opt) ++ target_include_directories(SPIRV PUBLIC ++ $ ++ $) ++ endif() + else() + target_link_libraries(SPIRV PRIVATE MachineIndependent) + endif(ENABLE_OPT) diff --git a/graphics/glslang/glslang.SlackBuild b/graphics/glslang/glslang.SlackBuild index d51ff730b5..7aa9999698 100644 --- a/graphics/glslang/glslang.SlackBuild +++ b/graphics/glslang/glslang.SlackBuild @@ -22,12 +22,9 @@ # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# For best compatibility use git versions which vulkan-sdk upstream also uses. -# Vulkan-ValidationLayers/scripts/known_good.json -# https://github.com/KhronosGroup/Vulkan-ValidationLayers/issues/1082 - PRGNAM=glslang -VERSION=${VERSION:-bacaef3237c515e40d1a24722be48c0a0b30f75f} +VERSION=${VERSION:-11.0.0} +SRCVERS="10-$VERSION" BUILD=${BUILD:-1} TAG=${TAG:-_SBo} @@ -60,27 +57,12 @@ fi set -eu -# For best compatibility use git versions which glslang upstream also uses. -# glslang/known_good.json -SPIRV_HEADERS_VERSION=${SPIRV_HEADERS_VERSION:-060627f0b0d2fa8581b5acb939f46e3b9e500593} -SPIRV_TOOLS_VERSION=${SPIRV_TOOLS_VERSION:-0a1fb588cd365f7737cb121fdd64553923e0cef6} - rm -rf $PKG mkdir -p $TMP $PKG $OUTPUT cd $TMP -rm -rf $PRGNAM-$VERSION -tar xvf $CWD/$PRGNAM-$VERSION.tar.gz -cd $PRGNAM-$VERSION - -( - cd External - tar xvf $CWD/SPIRV-Tools-$SPIRV_TOOLS_VERSION.tar.gz - mv SPIRV-Tools-$SPIRV_TOOLS_VERSION spirv-tools - cd spirv-tools/external - tar xvf $CWD/SPIRV-Headers-$SPIRV_HEADERS_VERSION.tar.gz - mv SPIRV-Headers-$SPIRV_HEADERS_VERSION spirv-headers -) - +rm -rf $PRGNAM-$SRCVERS +tar xvf $CWD/$PRGNAM-$SRCVERS.tar.gz +cd $PRGNAM-$SRCVERS chown -R root:root . find -L . \ \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ @@ -88,13 +70,18 @@ find -L . \ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; +# CMake: Allow linking against system-installed SPIRV-Tools +# https://github.com/KhronosGroup/glslang/issues/1585 +# https://github.com/KhronosGroup/glslang/pull/1621 +patch -p1 < $CWD/SPIRV-Tools-shared.patch + mkdir -p build cd build cmake \ - -DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \ -DCMAKE_CXX_FLAGS:STRING="$SLKCFLAGS" \ -DCMAKE_INSTALL_PREFIX=/usr \ -DCMAKE_INSTALL_LIBDIR=lib$LIBDIRSUFFIX \ + -DBUILD_EXTERNAL=OFF \ -DBUILD_SHARED_LIBS=ON \ -DCMAKE_SKIP_RPATH=TRUE \ -DCMAKE_BUILD_TYPE=Release .. @@ -112,7 +99,6 @@ cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild mkdir -p $PKG/install cat $CWD/slack-desc > $PKG/install/slack-desc -#cat $CWD/doinst.sh > $PKG/install/doinst.sh cd $PKG /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} diff --git a/graphics/glslang/glslang.info b/graphics/glslang/glslang.info index 4ef3491d89..c03f4f5e84 100644 --- a/graphics/glslang/glslang.info +++ b/graphics/glslang/glslang.info @@ -1,14 +1,10 @@ PRGNAM="glslang" -VERSION="bacaef3237c515e40d1a24722be48c0a0b30f75f" +VERSION="11.0.0" HOMEPAGE="https://github.com/KhronosGroup/glslang" -DOWNLOAD="https://github.com/KhronosGroup/glslang/archive/bacaef3237c515e40d1a24722be48c0a0b30f75f/glslang-bacaef3237c515e40d1a24722be48c0a0b30f75f.tar.gz \ - https://github.com/KhronosGroup/SPIRV-Headers/archive/060627f0b0d2fa8581b5acb939f46e3b9e500593/SPIRV-Headers-060627f0b0d2fa8581b5acb939f46e3b9e500593.tar.gz \ - https://github.com/KhronosGroup/SPIRV-Tools/archive/0a1fb588cd365f7737cb121fdd64553923e0cef6/SPIRV-Tools-0a1fb588cd365f7737cb121fdd64553923e0cef6.tar.gz" -MD5SUM="3e631acd4c41c0d5a0b8dd42d32d32c6 \ - 459fc2b250130c38c31e2d9690d32e69 \ - 9ebcd80ceda36ee2df65daf33bb332b2" +DOWNLOAD="https://github.com/KhronosGroup/glslang/archive/10-11.0.0/glslang-10-11.0.0.tar.gz" +MD5SUM="c54870922c39b8c307678fdf4ae2e85e" DOWNLOAD_x86_64="" MD5SUM_x86_64="" -REQUIRES="python3" +REQUIRES="SPIRV-Tools" MAINTAINER="Hunter Sezen" EMAIL="orbea@riseup.net"