Modding, Mission Design, and Coding > Cross-Platform Development

FS2 Open native on Apple Silicon

<< < (3/5) > >>

The E:

--- Quote from: ShivanSpS on February 19, 2021, 08:14:36 am ---Actually, the performance is not too bad for the M1. Specially if you are talking about 1080p, AMD Vega 11 is not that much faster really.

What i do find interesting is that you were able to run mediavps on the M1 on arm64 with the unaligned models and shields system not causing crashes, i really had to solve quitte of a few issues to do that on the RPI, it looks like Apple handles that a lot better.

--- End quote ---

The M1 does include some special bits for memory access in order to speed up x86 emulation, I think that may be the reason why?

ShivanSpS:
Yeah, i guess they really had to ensure the CPU could properly handle that. It could also be their kernel, the linux kernel actually does a good job in fixing some of the unaligned memory access, because if i disable the unaligned access fixing in linux, FSO will still crash in... i think it was the scripting area.

meego:
For anyone else stumbling on this thread and trying to self-compile, i confirm that the current latest stable release (23.0.0) can be built on Apple Silicon Macs by following these steps:

* ensure you have all dependencies (freetype, ffmpeg, sdl2) installed w/ homebrew
* edit lib/freetype.cmake and lib/libpng/CMakeLists.txt as outlined in PR4337 to disable NEON and use the system freetype library
* follow Linux build instructions:
--- Code: ---mkdir build && cd build
cmake -DFFMPEG_USE_PRECOMPILED=OFF -DFSO_FREESPACE_PATH=/path/to/Freespace2 ..
make -j<N> # Note we don't use the "install" target because it's broken

--- End code ---

* application bundle should be in build/bin
I can submit a PR with the NEON & freetype fixes, along with updating relevant "Build on Mac" docs/wikis. How does that sound?

I know this has less value than actually fixing the production of redistributable Mac builds in CI, but that's the best I can offer right now considering my current knowledge of cmake and available time.

chief1983:
Is the only thing needed to make a distributable build a new set of the libs compiled for Silicon?  Also I tend to use xcodebuild on Mac, and generate an xcode project file with CMake, any reason that wouldn't still work?  I just got a new Silicon Macbook at work again (had one back in February but changed jobs then) and would be interested in helping out if there are solvable problems to get this going again.

meego:
There is also the requirement of signing/notarization. It sounds complicated but can be actually pretty straightforward in my experience.

E.g. our build script at work for a native Mac app looks like this:

--- Code: ---# Build, archive, notarize
xcodebuild \
   -scheme "$env" \
   -configuration Release \
   -archivePath "$PWD/Release/App/$env.xcarchive" \
   archive
xcodebuild \
   -exportArchive \
   -allowProvisioningUpdates \
   -archivePath "$PWD/Release/App/$env.xcarchive" \
   -exportOptionsPlist $PWD/ExportOptions.plist
until xcodebuild \
  -exportNotarizedApp \
  -archivePath "$PWD/Release/App/$env.xcarchive" \
  -exportPath $PWD/Release/App; \
do \
   echo wait 10s...; \
   sleep 10; \
done

# Zip exported app
ditto -c -k --sequesterRsrc --keepParent "$PWD/Release/App/$env.app" "$PWD/Release/App/$1.zip"

--- End code ---

Xcode will need an Apple developper account. I understand they're free for open-source projects. Do we have one already?

If you're familiar w/ generating xcode projects w/ CMake, that could be useful since it might be an easier path than getting notarization up & running without Xcode (example)

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version