assaultcube / AC

AssaultCube
859 stars 221 forks source link

MacOS Apple Silicon build #447

Open naymapl opened 2 years ago

naymapl commented 2 years ago

Hello. I want to build macOS arm version of your game. How to build it ? Is it use cmake and make to build and where I find files for build and instruction/manual. Thank you so much for help.

Ok I found assaultcube.xcodeproj file and try to build but got error: Zrzut ekranu 2022-03-7 o 08 33 23

Zrzut ekranu 2022-03-7 o 08 33 16

Where fo find and where to place game data ?

RonaldReagan commented 2 years ago

@naymapl AC's launcher expects to be packaged in a very specific way. When building I'll tend to not build the launcher. You can choose what product gets built by going to xcode -> Product -> Scheme and select assault cube:

Screen Shot 2022-03-24 at 00 04 27

You will then notice a different error. It won't be able to find the packages dir. To fix this you can edit the scheme. Go to the Product -> Scheme menu again and select edit scheme. In here you can select a custom working directory. Here you can either make a new directory, copy the packages and config folders into it, or you can just be lazy and select the top level AC repository.

Screen Shot 2022-03-24 at 00 05 04
danielktdoranie commented 9 months ago

If you manage to build this, I would love it!

h0tgril commented 7 months ago

The other issue is all the linker errors when building on arm64, probably due to some included precompiled frameworks only having x86-64 symbols. To resolve that, I had to first get the libs from MacPorts using sudo port selfupdate && sudo port install libogg libvorbis (Homebrew libs I think were still Intel idk), open the Xcode proj, set the target to assaultcube (not launcher), delete the Ogg and Vorbis frameworks from AC/, also delete the ogg+vorbis dirs from AC/source/include, add the MacPorts /opt/local/lib as a library search path, add /opt/local/include as a header search path, add the libogg+libvorbis .a and .dylib files in /opt/local/lib to the build phases > link binary with libraries step, and also replace SDL.framework and SDL_image.framework with new releases from https://github.com/libsdl-org/SDL_image/releases and https://github.com/libsdl-org/SDL/releases.

After building in release mode like RonaldReagan said, it worked! I got a .dmg containing a fully arm64-native launcher and inner assaultcube.app. Seeing better fps on my M1 mini, for example the notoriously laggy custom map ac_syria sticks close to 200fps compared to 120fps on the Intel build.