diff --git a/scripts/build-dependencies-mac.sh b/scripts/build-dependencies-mac.sh index ab3980e97..5afc1a433 100755 --- a/scripts/build-dependencies-mac.sh +++ b/scripts/build-dependencies-mac.sh @@ -28,6 +28,7 @@ fi export MACOSX_DEPLOYMENT_TARGET=11.0 NPROCS="$(getconf _NPROCESSORS_ONLN)" +SCRIPTDIR=$(realpath $(dirname "${BASH_SOURCE[0]}")) INSTALLDIR="$1" if [ "${INSTALLDIR:0:1}" != "/" ]; then INSTALLDIR="$PWD/$INSTALLDIR" @@ -44,6 +45,11 @@ LIBWEBP=1.3.2 MOLTENVK=1.2.8 QT=6.7.0 +SHADERC=2024.0 +SHADERC_GLSLANG=d73712b8f6c9047b09e99614e20d456d5ada2390 +SHADERC_SPIRVHEADERS=8b246ff75c6615ba4532fe4fde20f1be090c3764 +SHADERC_SPIRVTOOLS=04896c462d9f3f504c99a4698605b6524af813c1 + mkdir -p deps-build cd deps-build @@ -76,6 +82,10 @@ cat > SHASUMS <, size_t> Compiler::Compile( + options.generateDebugInfo = generate_debug_info_; + options.disableOptimizer = true; + options.optimizeSize = false; ++ if (generate_debug_info_) { ++ options.emitNonSemanticShaderDebugInfo = true; ++ options.emitNonSemanticShaderDebugSource = true; ++ } + // Note the call to GlslangToSpv also populates compilation_output_data. + glslang::GlslangToSpv(*program.getIntermediate(used_shader_stage), spirv, + &options); +--- a/third_party/CMakeLists.txt ++++ b/third_party/CMakeLists.txt +@@ -20,9 +20,9 @@ set(SHADERC_TINT_DIR "${SHADERC_THIRD_PARTY_ROOT_DIR}/tint" CACHE STRING + set(SHADERC_ABSL_DIR "${SHADERC_THIRD_PARTY_ROOT_DIR}/abseil_cpp" CACHE STRING + "Location of re2 source") + +-set( SKIP_GLSLANG_INSTALL ${SHADERC_SKIP_INSTALL} ) +-set( SKIP_SPIRV_TOOLS_INSTALL ${SHADERC_SKIP_INSTALL} ) +-set( SKIP_GOOGLETEST_INSTALL ${SHADERC_SKIP_INSTALL} ) ++set( SKIP_GLSLANG_INSTALL ON ) ++set( SKIP_SPIRV_TOOLS_INSTALL ON ) ++set( SKIP_GOOGLETEST_INSTALL ON ) + + # Configure third party projects. + if(${SHADERC_ENABLE_TESTS}) +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -117,6 +117,10 @@ + endif() + endif(MSVC) + ++if(NOT WIN32) ++ add_definitions("-fvisibility=hidden") ++endif() ++ + + # Configure subdirectories. + # We depend on these for later projects, so they should come first. +@@ -158,5 +162,4 @@ + endfunction() + + define_pkg_config_file(shaderc -lshaderc_shared) +-define_pkg_config_file(shaderc_static "-lshaderc ${EXTRA_STATIC_PKGCONFIG_LIBS} -lshaderc_util") +-define_pkg_config_file(shaderc_combined -lshaderc_combined) ++ + +--- a/libshaderc/CMakeLists.txt ++++ b/libshaderc/CMakeLists.txt +@@ -54,7 +54,7 @@ + DESTINATION + ${CMAKE_INSTALL_INCLUDEDIR}/shaderc) + +- install(TARGETS shaderc shaderc_shared ++ install(TARGETS shaderc_shared + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + BUNDLE DESTINATION ${CMAKE_INSTALL_BINDIR} +@@ -96,10 +96,6 @@ + + shaderc_combine_static_lib(shaderc_combined shaderc) + +-if(SHADERC_ENABLE_INSTALL) +- install(TARGETS shaderc_combined DESTINATION ${CMAKE_INSTALL_LIBDIR}) +-endif(SHADERC_ENABLE_INSTALL) +- + shaderc_add_tests( + TEST_PREFIX shaderc_combined + LINK_LIBS shaderc_combined ${CMAKE_THREAD_LIBS_INIT} diff --git a/scripts/flatpak/org.duckstation.DuckStation.json b/scripts/flatpak/org.duckstation.DuckStation.json index 1981a0cc4..a1295aa86 100644 --- a/scripts/flatpak/org.duckstation.DuckStation.json +++ b/scripts/flatpak/org.duckstation.DuckStation.json @@ -20,6 +20,7 @@ "modules": [ "modules/20-sdl2.json", "modules/21-libbacktrace.json", + "modules/22-shaderc.json", { "name": "duckstation", "buildsystem": "cmake-ninja", diff --git a/scripts/shaderc-install.patch b/scripts/shaderc-install.patch new file mode 100644 index 000000000..6c83f5523 --- /dev/null +++ b/scripts/shaderc-install.patch @@ -0,0 +1,71 @@ +--- a/libshaderc_util/src/compiler.cc ++++ b/libshaderc_util/src/compiler.cc +@@ -341,6 +341,10 @@ std::tuple, size_t> Compiler::Compile( + options.generateDebugInfo = generate_debug_info_; + options.disableOptimizer = true; + options.optimizeSize = false; ++ if (generate_debug_info_) { ++ options.emitNonSemanticShaderDebugInfo = true; ++ options.emitNonSemanticShaderDebugSource = true; ++ } + // Note the call to GlslangToSpv also populates compilation_output_data. + glslang::GlslangToSpv(*program.getIntermediate(used_shader_stage), spirv, + &options); +--- a/third_party/CMakeLists.txt ++++ b/third_party/CMakeLists.txt +@@ -20,9 +20,9 @@ set(SHADERC_TINT_DIR "${SHADERC_THIRD_PARTY_ROOT_DIR}/tint" CACHE STRING + set(SHADERC_ABSL_DIR "${SHADERC_THIRD_PARTY_ROOT_DIR}/abseil_cpp" CACHE STRING + "Location of re2 source") + +-set( SKIP_GLSLANG_INSTALL ${SHADERC_SKIP_INSTALL} ) +-set( SKIP_SPIRV_TOOLS_INSTALL ${SHADERC_SKIP_INSTALL} ) +-set( SKIP_GOOGLETEST_INSTALL ${SHADERC_SKIP_INSTALL} ) ++set( SKIP_GLSLANG_INSTALL ON ) ++set( SKIP_SPIRV_TOOLS_INSTALL ON ) ++set( SKIP_GOOGLETEST_INSTALL ON ) + + # Configure third party projects. + if(${SHADERC_ENABLE_TESTS}) +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -117,6 +117,10 @@ + endif() + endif(MSVC) + ++if(NOT WIN32) ++ add_definitions("-fvisibility=hidden") ++endif() ++ + + # Configure subdirectories. + # We depend on these for later projects, so they should come first. +@@ -158,5 +162,4 @@ + endfunction() + + define_pkg_config_file(shaderc -lshaderc_shared) +-define_pkg_config_file(shaderc_static "-lshaderc ${EXTRA_STATIC_PKGCONFIG_LIBS} -lshaderc_util") +-define_pkg_config_file(shaderc_combined -lshaderc_combined) ++ + +--- a/libshaderc/CMakeLists.txt ++++ b/libshaderc/CMakeLists.txt +@@ -54,7 +54,7 @@ + DESTINATION + ${CMAKE_INSTALL_INCLUDEDIR}/shaderc) + +- install(TARGETS shaderc shaderc_shared ++ install(TARGETS shaderc_shared + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + BUNDLE DESTINATION ${CMAKE_INSTALL_BINDIR} +@@ -96,10 +96,6 @@ + + shaderc_combine_static_lib(shaderc_combined shaderc) + +-if(SHADERC_ENABLE_INSTALL) +- install(TARGETS shaderc_combined DESTINATION ${CMAKE_INSTALL_LIBDIR}) +-endif(SHADERC_ENABLE_INSTALL) +- + shaderc_add_tests( + TEST_PREFIX shaderc_combined + LINK_LIBS shaderc_combined ${CMAKE_THREAD_LIBS_INIT}