Based on ANGLE master branch, current version is 8ef9aba7a42f015a35e1e318affe188c3806f539.
In file src/libANGLE/renderer/gl/eagl/DisplayEAGL.mm
change kEAGLRenderingAPIOpenGLES3
to kEAGLRenderingAPIOpenGLES2
.
This updates target OpenGLES version to 2, which is required for old 32-bit iOS devices (iPhone 5).
Set these parameters for 'MetalANGLE_static' target and 'OpenGLES' project:
Build Active Architecture Only: Yes
Deployment Postprocessing: Yes
Strip Linked Product: Yes
Strip Style: Non-Global Symbols
Perform Single-Object Prelink: Yes
Preserve Private External Symbols: No
Symbols Hidden By Default: No
Inline Methods Hidden: Yes
Preprocessor Macros: ANGLE_PLATFORM_EXPORT=, ANGLE_EXPORT=, ANGLE_UTIL_EXPORT=
Important: enable C++ exceptions via following options (otherwise exceptions may not work in dependent projects):
Enable C++ Exceptions: Yes
Enable C++ Runtime Types: Yes
Enable Objective C Exceptions: Yes
After changing the targets the static libraries can be built for all targets:
cd ios/xcode
./fetchDependencies.sh
xcodebuild -showsdks
rm -rf build
xcodebuild -project OpenGLES.xcodeproj -target MetalANGLE_static -configuration Release -arch arm64 -sdk iphoneos13.2 build
echo Output is in build/Release-iphoneos/libMetalANGLE_static.a
rm -rf build
xcodebuild -project OpenGLES.xcodeproj -target MetalANGLE_static -configuration Release -arch armv7 -sdk iphoneos13.2 build
echo Output is in build/Release-iphoneos/libMetalANGLE_static.a
rm -rf build
xcodebuild -project OpenGLES.xcodeproj -target MetalANGLE_static -configuration Release -arch x86_64 -sdk iphonesimulator13.2 build
echo Output is in build/Release-iphonesimulator/libMetalANGLE_static.a
rm -rf build
xcodebuild -project OpenGLES.xcodeproj -target MetalANGLE_static -configuration Release -arch i386 -sdk iphonesimulator13.2 build
echo Output is in build/Release-iphonesimulator/libMetalANGLE_static.a
rm -rf build
xcodebuild -project OpenGLES.xcodeproj -target MetalANGLE_static -configuration Release -arch arm64 -sdk iphonesimulator13.2 build
echo Output is in build/Release-iphonesimulator/libMetalANGLE_static.a
Note: to enable Bitcode, add OTHER_CFLAGS="-fembed-bitcode"
to command line arguments for arm64 and armv7 iOS targets.
In order to build libraries for Mac Catalyst, use the following commands:
xcodebuild -project OpenGLES.xcodeproj -scheme MetalANGLE_static -sdk macosx -configuration Release -destination 'platform=macOS,variant=Mac Catalyst' build SUPPORTS_MACCATALYST=YES
lipo <PATH_TO_OUTPUT>/libMetalANGLE_static.a -extract x86_64 -output libMetalANGLE_static_x86_64.a
lipo <PATH_TO_OUTPUT>/libMetalANGLE_static.a -extract arm64 -output libMetalANGLE_static_arm64.a