diff --git a/.ci/build-mac-arm64.sh b/.ci/build-mac-arm64.sh index d05b18150a0f..ff3c30e5ba90 100644 --- a/.ci/build-mac-arm64.sh +++ b/.ci/build-mac-arm64.sh @@ -1,6 +1,8 @@ #!/bin/sh -ex + brew update -brew install -f --overwrite nasm ninja git p7zip create-dmg ccache pipenv llvm@16 sdl2 glew cmake molten-vk vulkan-headers faudio qt@5 ffmpeg +brew install -f --overwrite nasm ninja git p7zip create-dmg ccache pipenv llvm@16 sdl2 glew cmake faudio qt@5 ffmpeg@6 molten-vk@1.2.4 vulkan-headers + brew link -f llvm@16 @@ -10,41 +12,28 @@ export CC=clang export BREW_PATH; BREW_PATH="$(brew --prefix)" -export BREW_BIN="/opt/homebrew/bin" +export BREW_BIN="$BREW_PATH/bin" export BREW_SBIN="$BREW_PATH/sbin" export CMAKE_EXTRA_OPTS='-DLLVM_TARGETS_TO_BUILD=AArch64;ARM' -export PATH="$(brew --prefix llvm@16)/bin:$BREW_BIN:$BREW_SBIN:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/Apple/usr/bin:$PATH" + +export PATH +PATH="$(brew --prefix llvm@16)/bin:$BREW_BIN:$BREW_SBIN:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/Apple/usr/bin:$PATH" export LDFLAGS="-L$BREW_PATH/lib -Wl,-rpath,$BREW_PATH/lib" export CPPFLAGS="-I$BREW_PATH/include" export LIBRARY_PATH="$BREW_PATH/lib" export LD_LIBRARY_PATH="$BREW_PATH/lib" -export Qt5_DIR="$(brew --prefix qt@5)/lib/cmake/Qt5" +export Qt5_DIR +Qt5_DIR="$(brew --prefix qt@5)/lib/cmake/Qt5" + export VULKAN_SDK VULKAN_SDK="$(brew --prefix molten-vk)" ln -s "$VULKAN_SDK/lib/libMoltenVK.dylib" "$VULKAN_SDK/lib/libvulkan.dylib" export VK_ICD_FILENAMES="$VULKAN_SDK/share/vulkan/icd.d/MoltenVK_icd.json" export LLVM_DIR LLVM_DIR="$(brew --prefix llvm@16)" -git submodule update --init ./3rdparty/asmjit && \ -git submodule update --init ./3rdparty/cubeb && \ -git submodule update --init ./3rdparty/curl && \ -git submodule update --init ./3rdparty/flatbuffers && \ -git submodule update --init ./3rdparty/glslang && \ -git submodule update --init ./3rdparty/GPUOpen && \ -git submodule update --init ./3rdparty/hidapi && \ -git submodule update --init ./3rdparty/libpng && \ -git submodule update --init ./3rdparty/libsdl-org && \ -git submodule update --init ./3rdparty/libusb && \ -git submodule update --init ./3rdparty/miniupnp && \ -git submodule update --init ./3rdparty/pine && \ -git submodule update --init ./3rdparty/pugixml && \ -git submodule update --init ./3rdparty/rtmidi && \ -git submodule update --init ./3rdparty/SoundTouch && \ -git submodule update --init ./3rdparty/SPIRV && \ -git submodule update --init ./3rdparty/stblib && \ -git submodule update --init ./3rdparty/wolfssl && \ -git submodule update --init ./3rdparty/xxHash && \ -git submodule update --init ./3rdparty/yaml-cpp + +# exclude FAudio, SPIRV, moltenvk and LLVM from submodule update +git submodule -q update --init --depth=1 --jobs=8 $(awk '/path/ && !/FAudio/ && !/MoltenVK && !/llvm/ && !/SPIRV/ { print $3 }' .gitmodules) # 3rdparty fixes sed -i '' "s/extern const double NSAppKitVersionNumber;/const double NSAppKitVersionNumber = 1343;/g" 3rdparty/hidapi/hidapi/mac/hid.c @@ -58,9 +47,9 @@ mkdir build && cd build || exit 1 -DLLVM_INCLUDE_UTILS=OFF -DLLVM_USE_PERF=OFF -DLLVM_ENABLE_Z3_SOLVER=OFF \ -DUSE_NATIVE_INSTRUCTIONS=OFF \ -DUSE_SYSTEM_FAUDIO=ON \ - -DUSE_SYSTEM_MVK=ON \ + -DUSE_SYSTEM_MVK=OFF \ -DUSE_SYSTEM_SDL=ON \ - -DUSE_SYSTEM_FFMPEG=ON \ + -DUSE_SYSTEM_FFMPEG=OFF \ -DPNG_ARM_NEON=on \ $CMAKE_EXTRA_OPTS \ -DLLVM_TARGET_ARCH="AArch64;ARM" -DCMAKE_OSX_ARCHITECTURES=arm64 \ diff --git a/.ci/build-mac.sh b/.ci/build-mac.sh index 7a05941b9349..509496057da2 100755 --- a/.ci/build-mac.sh +++ b/.ci/build-mac.sh @@ -1,10 +1,13 @@ #!/bin/sh -ex + brew install -f --overwrite nasm ninja git p7zip create-dmg ccache pipenv + #/usr/sbin/softwareupdate --install-rosetta --agree-to-license arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" arch -x86_64 /usr/local/bin/brew update -arch -x86_64 /usr/local/bin/brew install -f --overwrite llvm@16 sdl2 glew cmake molten-vk vulkan-headers faudio +arch -x86_64 /usr/local/bin/brew install -f --overwrite llvm@16 sdl2 glew cmake faudio moltenvk@1.2.4 vulkan-headers arch -x86_64 /usr/local/bin/brew link -f llvm@16 + #export MACOSX_DEPLOYMENT_TARGET=12.0 export CXX=clang++ export CC=clang @@ -19,6 +22,7 @@ export CMAKE_EXTRA_OPTS='-DLLVM_TARGETS_TO_BUILD=X86' export WORKDIR; WORKDIR="$(pwd)" + # Get Qt git clone https://github.com/engnr/qt-downloader.git cd qt-downloader @@ -28,8 +32,6 @@ git checkout f52efee0f18668c6d6de2dec0234b8c4bc54c597 cd .. export Qt5_DIR="$WORKDIR/qt-downloader/5.15.2/clang_64/lib/cmake/Qt5" - - export SDL2_DIR="$BREW_X64_PATH/opt/sdl2/lib/cmake/SDL2" export PATH="$BREW_X64_PATH/opt/llvm@16/bin:$WORKDIR/qt-downloader/5.15.2/clang_64/bin:$BREW_BIN:$BREW_SBIN:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/Apple/usr/bin:$PATH" @@ -37,32 +39,16 @@ export LDFLAGS="-L$BREW_X64_PATH/lib -Wl,-rpath,$BREW_X64_PATH/lib" export CPPFLAGS="-I$BREW_X64_PATH/include -msse -msse2 -mcx16 -no-pie" export LIBRARY_PATH="$BREW_X64_PATH/lib" export LD_LIBRARY_PATH="$BREW_X64_PATH/lib" + export VULKAN_SDK VULKAN_SDK="$BREW_X64_PATH/opt/molten-vk" ln -s "$VULKAN_SDK/lib/libMoltenVK.dylib" "$VULKAN_SDK/lib/libvulkan.dylib" export VK_ICD_FILENAMES="$VULKAN_SDK/share/vulkan/icd.d/MoltenVK_icd.json" + export LLVM_DIR LLVM_DIR="BREW_X64_PATH/opt/llvm@16" -git submodule update --init ./3rdparty/asmjit && \ -git submodule update --init ./3rdparty/cubeb && \ -git submodule update --init ./3rdparty/curl && \ -git submodule update --init ./3rdparty/ffmpeg && \ -git submodule update --init ./3rdparty/flatbuffers && \ -git submodule update --init ./3rdparty/glslang && \ -git submodule update --init ./3rdparty/GPUOpen && \ -git submodule update --init ./3rdparty/hidapi && \ -git submodule update --init ./3rdparty/libpng && \ -git submodule update --init ./3rdparty/libusb && \ -git submodule update --init ./3rdparty/miniupnp && \ -git submodule update --init ./3rdparty/pine && \ -git submodule update --init ./3rdparty/pugixml && \ -git submodule update --init ./3rdparty/rtmidi && \ -git submodule update --init ./3rdparty/SoundTouch && \ -git submodule update --init ./3rdparty/SPIRV && \ -git submodule update --init ./3rdparty/stblib && \ -git submodule update --init ./3rdparty/wolfssl && \ -git submodule update --init ./3rdparty/xxHash && \ -git submodule update --init ./3rdparty/yaml-cpp +# exclude FAudio, SPIRV, moltenvk and LLVM from submodule update +git submodule -q update --init --depth=1 --jobs=8 $(awk '/path/ && !/FAudio/ && !/MoltenVK && !/llvm/ && !/SPIRV/ { print $3 }' .gitmodules) # 3rdparty fixes sed -i '' "s/extern const double NSAppKitVersionNumber;/const double NSAppKitVersionNumber = 1343;/g" 3rdparty/hidapi/hidapi/mac/hid.c @@ -85,10 +71,9 @@ mkdir build && cd build || exit 1 "$BREW_PATH/bin/ninja"; build_status=$?; cd .. -export BUILDING_FOR="X64" { [ "$CI_HAS_ARTIFACTS" = "true" ]; } && SHOULD_DEPLOY="true" || SHOULD_DEPLOY="false" if [ "$build_status" -eq 0 ] && [ "$SHOULD_DEPLOY" = "true" ]; then .ci/deploy-mac.sh -fi +fi \ No newline at end of file diff --git a/.ci/deploy-mac.sh b/.ci/deploy-mac.sh index 4fb60a18168c..8fcd033ae2c2 100755 --- a/.ci/deploy-mac.sh +++ b/.ci/deploy-mac.sh @@ -16,14 +16,33 @@ cd bin mkdir "rpcs3.app/Contents/lib/" # check if we are on ARM or x86_64 -if [ $BUILDING_FOR = "arm64" ]; then +if [ "$BUILDING_FOR" = "arm64" ]; then cp "/opt/homebrew/opt/llvm@16/lib/c++/libc++abi.1.0.dylib" "rpcs3.app/Contents/lib/libc++abi.1.dylib" + # copy avfilter and avdevice as they are missing + cp "/opt/homebrew/opt/ffmpeg/lib/libavfilter.7.dylib" "rpcs3.app/Contents/Frameworks/libavfilter.7.dylib" + cp "/opt/homebrew/opt/ffmpeg/lib/libavdevice.60.dylib" "rpcs3.app/Contents/Frameworks/libavdevice.60.dylib" + +# we have ffmpeg libs bundled in the app bundle in rpcs3.app/Contents/Frameworks , now we need to change the rpath to point to it +# this is needed because we are using a homebrewed ffmpeg for arm64, and the rpath points to the system ffmpeg +# for example we want to point to rpcs3.app/Contents/Frameworks/libavcodec.60.dylib + install_name_tool -change "/opt/homebrew/opt/ffmpeg/lib/libavcodec.60.dylib" "@executable_path/../Frameworks/libavcodec.60.dylib" "rpcs3.app/Contents/MacOS/rpcs3" + install_name_tool -change "/opt/homebrew/opt/ffmpeg/lib/libavdevice.60.dylib" "@executable_path/../Frameworks/libavdevice.60.dylib" "rpcs3.app/Contents/MacOS/rpcs3" + install_name_tool -change "/opt/homebrew/opt/ffmpeg/lib/libavfilter.7.dylib" "@executable_path/../Frameworks/libavfilter.7.dylib" "rpcs3.app/Contents/MacOS/rpcs3" + install_name_tool -change "/opt/homebrew/opt/ffmpeg/lib/libavformat.60.dylib" "@executable_path/../Frameworks/libavformat.60.dylib" "rpcs3.app/Contents/MacOS/rpcs3" + install_name_tool -change "/opt/homebrew/opt/ffmpeg/lib/libavutil.58.dylib" "@executable_path/../Frameworks/libavutil.58.dylib" "rpcs3.app/Contents/MacOS/rpcs3" + install_name_tool -change "/opt/homebrew/opt/ffmpeg/lib/libswresample.4.dylib" "@executable_path/../Frameworks/libswresample.4.dylib" "rpcs3.app/Contents/MacOS/rpcs3" + install_name_tool -change "/opt/homebrew/opt/ffmpeg/lib/libswscale.7.dylib" "@executable_path/../Frameworks/libswscale.7.dylib" "rpcs3.app/Contents/MacOS/rpcs3" + + # do the same for sdl2 + install_name_tool -change "/opt/homebrew/opt/sdl2/lib/libSDL2-2.0.0.dylib" "@executable_path/../Frameworks/libSDL2-2.0.0.dylib" "rpcs3.app/Contents/MacOS/rpcs3" + + # now faudio + install_name_tool -change "/opt/homebrew/opt/faudio/lib/libFAudio.0.dylib" "@executable_path/../Frameworks/libFAudio.0.dylib" "rpcs3.app/Contents/MacOS/rpcs3" else cp "/usr/local/opt/llvm@16/lib/c++/libc++abi.1.0.dylib" "rpcs3.app/Contents/lib/libc++abi.1.dylib" fi - rm -rf "rpcs3.app/Contents/Frameworks/QtPdf.framework" \ "rpcs3.app/Contents/Frameworks/QtQml.framework" \ "rpcs3.app/Contents/Frameworks/QtQmlModels.framework" \ @@ -33,6 +52,9 @@ rm -rf "rpcs3.app/Contents/Frameworks/QtPdf.framework" \ "rpcs3.app/Contents/Plugins/virtualkeyboard" \ "rpcs3.app/Contents/Resources/git" + +# codesign it +codesign --force --deep --sign - "rpcs3.app/Contents/MacOS/rpcs3" # Need to do this rename hack due to case insensitive filesystem mv rpcs3.app RPCS3_.app mv RPCS3_.app RPCS3.app