10 Building for macOS
Crimson-Hawk edited this page 2024-04-20 17:00:32 +08:00

Please note this article is intended for development, and suyu on macOS is not currently ready for regular use.

This article was written for developers. suyu support for macOS is not ready for casual use.

Method I: ninja


If you are compiling on Intel Mac or are using a Rosetta Homebrew installation, you must replace all references of /opt/homebrew to /usr/local.

Install dependencies from Homebrew:

brew install autoconf automake boost ccache ffmpeg fmt glslang hidapi libtool libusb lz4 ninja nlohmann-json openssl pkg-config qt@5 sdl2 speexdsp zlib zlib zstd cmake Catch2 molten-vk vulkan-loader

Clone the repo

git clone --recursive https://git.suyu.dev/suyu/suyu.git

cd suyu

Build for release

mkdir build && cd build

export Qt5_DIR="/opt/homebrew/opt/qt@5/lib/cmake"

export LIBVULKAN_PATH=/opt/homebrew/lib/libvulkan.dylib

cmake .. -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DSUYU_USE_BUNDLED_VCPKG=OFF -DSUYU_TESTS=OFF -DENABLE_WEB_SERVICE=ON -DENABLE_LIBUSB=OFF -DCLANG_FORMAT=ON -DSDL2_DISABLE_INSTALL=ON -DSDL_ALTIVEC=ON

ninja

You may also want to include support for Discord Rich Presence by adding -DUSE_DISCORD_PRESENCE=ON after cmake ..

Build with debug symbols (vcpkg is not currently used due to broken boost-context library):

mkdir build && cd build
export Qt5_DIR="/opt/homebrew/opt/qt@5/lib/cmake"
cmake .. -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -Dsuyu_USE_BUNDLED_VCPKG=OFF -Dsuyu_TESTS=OFF -DENABLE_WEB_SERVICE=OFF -DENABLE_LIBUSB=OFF
ninja

Run the output:

bin/suyu.app/Contents/MacOS/suyu

Method II: Xcode


If you are compiling on Intel Mac or are using a Rosetta Homebrew installation, you must replace all references of /opt/homebrew to /usr/local.

Install dependencies from Homebrew:

brew install autoconf automake boost ccache ffmpeg fmt glslang hidapi libtool libusb lz4 ninja nlohmann-json openssl pkg-config qt@5 sdl2 speexdsp zlib zlib zstd cmake Catch2 molten-vk vulkan-loader

Clone the repo

git clone --recursive https://git.suyu.dev/suyu/suyu.git

cd suyu

Build for release

mkdir build && cd build

export Qt5_DIR="/opt/homebrew/opt/qt@5/lib/cmake"

export LIBVULKAN_PATH=/opt/homebrew/lib/libvulkan.dylib

cmake .. -GXcode -DCMAKE_BUILD_TYPE=RelWithDebInfo -DSUYU_USE_BUNDLED_VCPKG=OFF -DSUYU_TESTS=OFF -DENABLE_WEB_SERVICE=ON -DENABLE_LIBUSB=OFF -DCLANG_FORMAT=ON -DSDL2_DISABLE_INSTALL=ON -DSDL_ALTIVEC=ON

xcodebuild build -project suyu.xcodeproj -scheme "suyu" -configuration "RelWithDebInfo"

You may also want to include support for Discord Rich Presence by adding -DUSE_DISCORD_PRESENCE=ON after cmake ..

Build with debug symbols (vcpkg is not currently used due to broken boost-context library):

mkdir build && cd build
export Qt5_DIR="/opt/homebrew/opt/qt@5/lib/cmake"
cmake .. -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -Dsuyu_USE_BUNDLED_VCPKG=OFF -Dsuyu_TESTS=OFF -DENABLE_WEB_SERVICE=OFF -DENABLE_LIBUSB=OFF
ninja

Run the output:

bin/suyu.app/Contents/MacOS/suyu

To run with MoltenVK, install additional dependencies:

brew install molten-vk vulkan-loader

Run with Vulkan loader path:

export LIBVULKAN_PATH=/opt/homebrew/lib/libvulkan.dylib
bin/suyu.app/Contents/MacOS/suyu