From 37e69cb83d5d228030ccc6a7d1b75aa8823a4a2c Mon Sep 17 00:00:00 2001 From: fgsfds Date: Sat, 23 Nov 2024 21:07:21 +0100 Subject: [PATCH] readme: add osx build instructions --- README.md | 38 +++++++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 1a8f3245f..807bb598f 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ There are minor graphics- and gameplay-related issues, and possibly occasional c * in practice the game will have issues running faster than ~165 FPS, so use VSync or `Video.FramerateLimit` to cap it. * emulate the Transfer Pak functionality the game has on the Nintendo 64 to unlock some cheats automatically. -The following platforms are officially supported and tested: +**The following platforms are officially supported and tested:** * Windows 7+: i686, x86_64 * Linux: i686, x86_64 * MacOS: x86_64 (OS 10.9+), arm64 (OS 11.0+) @@ -136,6 +136,32 @@ Controls can be rebound in `pd.ini`. Default control scheme is as follows: 4. Run `cmake --build build -j4`. 5. The resulting executable will be at `build/pd.` (for example `build/pd.x86_64`). +### MacOS + +1. Set up Homebrew. +2. Install dependencies: + * Execute command: `brew install cmake gcc python3 zlib git` +3. Install SDL2: + * Execute commands: + ``` + wget http://libsdl.org/release/SDL2-2.30.9.dmg -O SDL2.dmg + hdiutil mount SDL2.dmg + sudo cp -vr /Volumes/SDL2/SDL2.framework /Library/Frameworks + hdiutil detach /Volumes/SDL2 + ``` + * This installs SDL2 system-wide and this is how the automatic builds are done. The game will also look for it in the executable path, so you could + download it locally instead. +4. Get the source code: + `git clone --recursive https://github.com/fgsfdsfgs/perfect_dark.git && cd perfect_dark` +5. Configure: + * Execute command: `cmake -G"Unix Makefiles" -Bbuild -DCMAKE_OSX_ARCHITECTURES=x86_64 .` + * Replace `x86_64` with `arm64` if building for an ARM64 Mac. + * Add ` -DROMID=pal-final` or ` -DROMID=jpn-final` at the end of the command if you want to build a PAL or JPN executable respectively. +6. Build: + * Execute command: `cmake --build build --target pd -j4 --clean-first` +7. The resulting executable will be at `build/pd.` (for example `build/pd.x86_64`). + * You might need to execute `chmod +x build/pd.x86-64` before you can run it. + ### Nintendo Switch 1. Set up the [devkitA64 environment](https://devkitpro.org/wiki/Getting_Started). @@ -151,15 +177,17 @@ Controls can be rebound in `pd.ini`. Default control scheme is as follows: dkp-pacman -S devkitA64 libnx switch-zlib switch-sdl2 switch-cmake dkp-toolchain-vars ``` * If in MSYS2 or `dkp-pacman` doesn't work, replace it with just `pacman`. -4. Ensure devkitA64 environment variables are set: +4. Get the source code: + `git clone --recursive https://github.com/fgsfdsfgs/perfect_dark.git && cd perfect_dark` +5. Ensure devkitA64 environment variables are set: * Execute command: `source /opt/devkitpro/switchvars.sh` * If your `$DEVKITPRO` path is different, substitute that instead or set the variables manually. -5. Configure: +6. Configure: * Execute command: `aarch64-none-elf-cmake -G"Unix Makefiles" -Bbuild .` * Add ` -DROMID=pal-final` or ` -DROMID=jpn-final` at the end of the command if you want to build a PAL or JPN executable respectively. -6. Build: +7. Build: * Execute command: `make -C build -j4` -7. The resulting executable will be at `build/pd.arm64.nro`. +8. The resulting executable will be at `build/pd.arm64.nro`. ### Notes