Skip to content

Commit

Permalink
Add ios build files
Browse files Browse the repository at this point in the history
I have no idea what I'm doing
  • Loading branch information
SolDev69 committed Jan 19, 2024
1 parent 644aeae commit 57260e5
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 0 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/pojav-gallium-ios.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@

name: Build iOS

on:
[push, pull_request]

jobs:
build:
runs-on: macos-latest

steps:
- uses: actions/checkout@v2

- name: Build iOS
run: |
git clone --depth 1 https://github.com/KhronosGroup/MoltenVK
brew install meson pkg-config
# sudo apt install -y meson libxrandr-dev libxxf86vm-dev libxshmfence-dev libxcb-*-dev libx11-xcb-dev libxfixes-dev libdrm-dev libx11-dev
# cp -R /usr/include/X11 include/
# cp -R /usr/include/xcb include/
# cp -R /usr/include/GL/* include/GL/
pip3 install mako
# -Dglx=gallium-xlib \
# -Dglx=dri
envsubst <ios-drm-${{matrix.arch}} >build-crossfile-drm
git clone --depth 1 https://gitlab.freedesktop.org/mesa/drm.git
cd drm
meson setup "build-ios-libdrm" \
--prefix=/Users/runner/work/unified-mesa-project/unified-mesa-project/libdrm \
--cross-file "../build-crossfile-drm" \
-Ddefault_library=static \
-Dintel=disabled \
-Dradeon=disabled \
-Damdgpu=disabled \
-Dnouveau=disabled \
-Dvmwgfx=disabled \
-Dfreedreno=disabled \
-Dvc4=disabled \
-Detnaviv=disabled
ninja -C build-ios-libdrm install
cd ..
envsubst <ios-${{matrix.arch}} >build-crossfile
meson build-ios-aarch64 \
--prefix="/tmp/mesa" \
--cross-file "build-crossfile" \
-Dmoltenvk-dir=../../../../MoltenVK/MoltenVK \
-Db_lundef=false \
-Dllvm=disabled \
-Dxlib-lease=disabled \
-Degl=disabled \
-Dgbm=disabled \
-Dglx=dri \
-Dglx-direct=true \
-Dopengl=true \
-Dosmesa=true \
-Dvulkan-drivers= \
-Dgallium-drivers=zink
ninja -C build-ios-aarch64 install
# cp build-ios-aarch64/src/gallium/drivers/zink/libzink.a /tmp/zink/lib/
install_name_tool -change /tmp/zink/lib/libglapi.0.dylib @executable_path/Frameworks/libglapi.0.dylib.framework/libglapi.0.dylib -add_rpath @executable_path/Frameworks/libMoltenVK.dylib.framework /tmp/zink/lib/libOSMesa.8.dylib
- name: Upload libraries
uses: actions/upload-artifact@v2
with:
name: libOSMesa
path: /tmp/mesa
19 changes: 19 additions & 0 deletions ios-aarch64
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[binaries]

ar = 'ar'
c = ['ccache', 'clang', '-O3', '-DVK_USE_PLATFORM_IOS_MVK', '-DVK_USE_PLATFORM_METAL_EXT', '-DVK_ENABLE_BETA_EXTENSIONS', '-arch', 'arm64', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk', '-miphoneos-version-min=12.0', '-fPIC']
cpp = ['ccache', 'clang++', '-O3', '-DVK_USE_PLATFORM_IOS_MVK', '-DVK_USE_PLATFORM_METAL_EXT', '-DVK_ENABLE_BETA_EXTENSIONS', '-arch', 'arm64', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk', '-miphoneos-version-min=12.0', '-fPIC', '-fno-exceptions', '-fno-unwind-tables', '-fno-asynchronous-unwind-tables', '-static-libstdc++']
c_ld = 'ld'
cpp_ld = 'ld'
strip = 'strip'
# Android doesn't come with a pkg-config, but we need one for meson to be happy not
# finding all the optional deps it looks for. Use system pkg-config pointing at a
# directory we get to populate with any .pc files we want to add for Android
pkgconfig = ['env', 'PKG_CONFIG_LIBDIR=/Users/runner/work/unified-mesa-project/unified-mesa-project/libdrm', 'pkg-config']

[host_machine]
# or linux?
system = 'darwin'
cpu_family = 'arm'
cpu = 'armv8'
endian = 'little'
19 changes: 19 additions & 0 deletions ios-drm-aarch64
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[binaries]

ar = 'ar'
c = ['ccache', 'clang', '-O3', '-DVK_USE_PLATFORM_IOS_MVK', '-DVK_USE_PLATFORM_METAL_EXT', '-DVK_ENABLE_BETA_EXTENSIONS', '-arch', 'arm64', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk', '-miphoneos-version-min=12.0', '-fPIC']
cpp = ['ccache', 'clang++', '-O3', '-DVK_USE_PLATFORM_IOS_MVK', '-DVK_USE_PLATFORM_METAL_EXT', '-DVK_ENABLE_BETA_EXTENSIONS', '-arch', 'arm64', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk', '-miphoneos-version-min=12.0', '-fPIC', '-fno-exceptions', '-fno-unwind-tables', '-fno-asynchronous-unwind-tables', '-static-libstdc++']
c_ld = 'ld'
cpp_ld = 'ld'
strip = 'strip'
# Android doesn't come with a pkg-config, but we need one for meson to be happy not
# finding all the optional deps it looks for. Use system pkg-config pointing at a
# directory we get to populate with any .pc files we want to add for Android
pkgconfig = ['env', 'PKG_CONFIG_LIBDIR=.', 'pkg-config']

[host_machine]
# or linux?
system = 'darwin'
cpu_family = 'arm'
cpu = 'armv8'
endian = 'little'

0 comments on commit 57260e5

Please sign in to comment.