.package(url: "https://github.com/mesqueeb/FuegoOnAppleSilicon", from: "0.3.1")
Fuego On Apple Silicon is the Fuego C++ Go engine to play and analyse Go games. Built as multi-platform XCframework for iOS, macOS and visionOS. Wrapped as a modernised Swift Package that can be included in any Swift project and can build on all Apple platforms.
This project
- Modernised the original C++ source code to compile with modern (20+) C++ standard
- No longer requires the entire Boost library to be built, but now relies only on the Boost header libraries and is compatible with the latest Boost version (1.85)
- Migrated to a CMake-based build system so the project can be supported with a more modern IDEs
- Created a new SH build script that builds XCframeworks for iOS, macOS, visionOS (xrOS), and related simulators
- Wrapped everything nicely into a Swift Package that includes the pre-compiled binaries, has a Swift bridge class so that it can be easily used in any Swift project
It builds upon a fork of both the original Fuego C++ code on Source Forge and the Fuego on iOS repository. (Fuego on iOS only compiles to iOS and relies on GNU++98 & Boost 1.75.0)
When installing the package via Xcode 14.x you might run into the error:
invalid archive returned from https://github.com/...
The fix is to remove the dependency again, quit Xcode, and execute:
rm -rf $HOME/Library/Caches/org.swift.swiftpm/
Then re-open Xcode and it should install correctly.
./build-xcframework.sh
This script builds gtpengine
, smartgame
, go
and gouct
libraries, merges them into a single lib (per platform), and packs libs from different platforms into ./build/Fuego.xcframework
.
This script also downloads Boost (before building), however, now there is no need to build Boost libraries because the Boost libraries that need to be built are no longer used for these fuego subprojects. Only fuegomain
and fuegotest
depend on the boost.program_options
library that needs to be built. But they are not part of Fuego.xcframework
.
You can check this build file and enable / disable output by toggling if true; then
to if false; then
. Currently it is set to build:
- xros-simulator arm64,x86_64
- xros arm64
- ios arm64
- ios simulator arm64,x86_64
- osx arm64,x86_64
build-xcframework.sh
is a multipurpose build script. It also creates another FuegoTest.xcframework
by merging the simpleplayers
and unittestmain
subprojects. While unittestmain
is intended to be an executable, it's built as a static library where the main
method is renamed to run_unit_tests
with the same signature. So any iOS/macOS/visionOS application is able to run Fuego unit tests just by embedding this FuegoTest.xcframework
(in addition to Fuego.xcframework
) and calling the run_unit_tests
method. An example of such an application is xcode\FuegoTest\FuegoTest.xcodeproj, which represents a simple SwitUI application where tests are started when a button is clicked.
The Fuego on iOS repository was a source of inspiration which gave birth to this library.
Modernising the C++ code and build scripts was done with the help of Alexander Pototskiy.
Thank you, everybody!