Qt: Fix Mac dylib not being included

This commit is contained in:
Stenzek 2024-05-14 18:48:54 +10:00
parent 18160a8e06
commit b204fd6860
No known key found for this signature in database
5 changed files with 19 additions and 7 deletions

View file

@ -4,14 +4,14 @@
# SHADERC_INCLUDE_DIRS - The SHADERC include directories
# SHADERC_LIBRARIES - The libraries needed to use SHADERC
FIND_PATH(
find_path(
SHADERC_INCLUDE_DIR shaderc/shaderc.h
${SHADERC_PATH_INCLUDES}
)
FIND_LIBRARY(
find_library(
SHADERC_LIBRARY
NAMES shaderc_shared
NAMES shaderc_shared.1 shaderc_shared
PATHS ${ADDITIONAL_LIBRARY_PATHS} ${SHADERC_PATH_LIB}
)

View file

@ -61,7 +61,7 @@ declare -a EXCLUDE_LIBS=(
)
declare -a MANUAL_LIBS=(
"libshaderc_shared.so"
"libshaderc_shared.so.1"
)
declare -a MANUAL_QT_LIBS=(

View file

@ -60,6 +60,7 @@ export CFLAGS="-I$INSTALLDIR/include $CFLAGS"
export CXXFLAGS="-I$INSTALLDIR/include $CXXFLAGS"
CMAKE_COMMON=(
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_SHARED_LINKER_FLAGS="-dead_strip -dead_strip_dylibs"
-DCMAKE_PREFIX_PATH="$INSTALLDIR"
-DCMAKE_INSTALL_PREFIX="$INSTALLDIR"
-DCMAKE_INSTALL_NAME_DIR='$<INSTALL_PREFIX>/lib'
@ -148,9 +149,9 @@ echo "Installing libpng..."
rm -fr "libpng-$LIBPNG"
tar xf "libpng-$LIBPNG.tar.xz"
cd "libpng-$LIBPNG"
cmake "${CMAKE_COMMON[@]}" "$CMAKE_ARCH_X64" -DBUILD_SHARED_LIBS=ON -DPNG_TESTS=OFF -B build
cmake "${CMAKE_COMMON[@]}" "$CMAKE_ARCH_X64" -DBUILD_SHARED_LIBS=ON -DPNG_TESTS=OFF -DPNG_FRAMEWORK=OFF -B build
make -C build "-j$NPROCS"
cmake "${CMAKE_COMMON[@]}" "$CMAKE_ARCH_ARM64" -DBUILD_SHARED_LIBS=ON -DPNG_TESTS=OFF -DPNG_ARM_NEON=on -B build-arm64
cmake "${CMAKE_COMMON[@]}" "$CMAKE_ARCH_ARM64" -DBUILD_SHARED_LIBS=ON -DPNG_TESTS=OFF -DPNG_ARM_NEON=on -DPNG_FRAMEWORK=OFF -B build-arm64
make -C build-arm64 "-j$NPROCS"
merge_binaries $(realpath build) $(realpath build-arm64)
make -C build install

View file

@ -241,6 +241,10 @@ elseif(APPLE)
endif()
endif()
# Copy shaderc into the bundle
target_sources(duckstation-qt PRIVATE "${SHADERC_LIBRARY}")
set_source_files_properties("${SHADERC_LIBRARY}" PROPERTIES MACOSX_PACKAGE_LOCATION Frameworks)
# Copy icon into the bundle
target_sources(duckstation-qt PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/DuckStation.icns")
set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/DuckStation.icns" PROPERTIES MACOSX_PACKAGE_LOCATION Resources)

View file

@ -1150,7 +1150,14 @@ bool dyn_shaderc::Open()
return true;
Error error;
if (!s_library.Open(DynamicLibrary::GetVersionedFilename("shaderc_shared").c_str(), &error))
#ifdef _WIN32
const std::string libname = DynamicLibrary::GetVersionedFilename("shaderc_shared");
#else
// Use versioned, bundle post-processing adds it..
const std::string libname = DynamicLibrary::GetVersionedFilename("shaderc_shared", 1);
#endif
if (!s_library.Open(libname.c_str(), &error))
{
Log_ErrorFmt("Failed to load shaderc: {}", error.GetDescription());
return false;