Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/postsubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ jobs:
with:
fetch-depth: 0
- uses: ./.github/actions/mac-prereq
- name: Select Xcode 16.2
run: sudo xcode-select -s /Applications/Xcode_16.2.app/Contents/Developer
- name: Run build script
run: |
cd build/ios && printf "y" | ./build.sh continuous
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@ jobs:
with:
fetch-depth: 0
- uses: ./.github/actions/mac-prereq
- name: Select Xcode 16.2
run: sudo xcode-select -s /Applications/Xcode_16.2.app/Contents/Developer
- name: Run build script
run: |
cd build/ios && printf "y" | ./build.sh presubmit
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,8 @@ jobs:
with:
ref: ${{ steps.git_ref.outputs.ref }}
- uses: ./.github/actions/mac-prereq
- name: Select Xcode 16.2
run: sudo xcode-select -s /Applications/Xcode_16.2.app/Contents/Developer
- name: Run build script
env:
TAG: ${{ steps.git_ref.outputs.tag }}
Expand Down
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -732,6 +732,9 @@ string(TOLOWER "${DIST_ARCH}" DIST_ARCH)
string(REPLACE "amd64" "x86_64" DIST_ARCH "${DIST_ARCH}")
if (NOT DIST_DIR)
set(DIST_DIR "${DIST_ARCH}")
if (PLATFORM_NAME)
set(DIST_DIR "${DIST_DIR}-${PLATFORM_NAME}")
endif()
endif()

# ==================================================================================================
Expand Down
1 change: 1 addition & 0 deletions NEW_RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ appropriate header in [RELEASE_NOTES.md](./RELEASE_NOTES.md).

## Release notes for next branch cut

- iOS: add Apple silicon (`arm64`) iOS Simulator support. The sample Xcode projects now require Xcode 16+ (CI is pinned to Xcode 16.2).
- WEBGL_PTHREADS renamed to WASM_PTHREADS in CMakeLists.txt
77 changes: 59 additions & 18 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ function print_help {
echo " -e"
echo " Enable EGL on Linux support for desktop builds."
echo " -l"
echo " Build arm64/x86_64 universal libraries."
echo " For iOS, this builds universal binaries for devices and the simulator (implies -s)."
echo " Build universal libraries/frameworks."
echo " For iOS, this builds XCFrameworks for devices and the simulator (implies -s)."
echo " For macOS, this builds universal binaries for both Apple silicon and Intel-based Macs."
echo " -k sample1,sample2,..."
echo " When building for Android, also build select sample APKs."
Expand Down Expand Up @@ -685,9 +685,9 @@ function build_ios_target {
local platform=$3

echo "Building iOS ${lc_target} (${arch}) for ${platform}..."
mkdir -p "out/cmake-ios-${lc_target}-${arch}"
mkdir -p "out/cmake-ios-${lc_target}-${arch}-${platform}"

pushd "out/cmake-ios-${lc_target}-${arch}" > /dev/null
pushd "out/cmake-ios-${lc_target}-${arch}-${platform}" > /dev/null

if [[ ! -d "CMakeFiles" ]] || [[ "${ISSUE_CMAKE_ALWAYS}" == "true" ]]; then
cmake \
Expand Down Expand Up @@ -746,38 +746,79 @@ function build_ios {
# only arm64 devices support OpenGL 3.0 / Metal

if [[ "${ISSUE_DEBUG_BUILD}" == "true" ]]; then
local out_dir="out/ios-debug/filament"
local lib_dir="${out_dir}/lib"

build_ios_target "Debug" "arm64" "iphoneos"

if [[ "${IOS_BUILD_SIMULATOR}" == "true" ]]; then
build_ios_target "Debug" "arm64" "iphonesimulator"
build_ios_target "Debug" "x86_64" "iphonesimulator"

# Create a universal library for the simulator
build/ios/create-universal-libs.sh \
-o "${lib_dir}/universal" \
"${lib_dir}/arm64-iphonesimulator" \
"${lib_dir}/x86_64-iphonesimulator"
fi

if [[ "${BUILD_UNIVERSAL_LIBRARIES}" == "true" ]]; then
build/ios/create-universal-libs.sh \
-o out/ios-debug/filament/lib/universal \
out/ios-debug/filament/lib/arm64 \
out/ios-debug/filament/lib/x86_64
rm -rf out/ios-debug/filament/lib/arm64
rm -rf out/ios-debug/filament/lib/x86_64
# Always create XCFrameworks
local xcframework_paths=("${lib_dir}/arm64-iphoneos")
if [[ -d "${lib_dir}/universal" ]]; then
xcframework_paths+=("${lib_dir}/universal")
elif [[ -d "${lib_dir}/arm64-iphonesimulator" ]]; then
# If we built only one simulator arch but not both
xcframework_paths+=("${lib_dir}/arm64-iphonesimulator")
elif [[ -d "${lib_dir}/x86_64-iphonesimulator" ]]; then
xcframework_paths+=("${lib_dir}/x86_64-iphonesimulator")
fi

build/ios/create-xc-frameworks.sh -o "${lib_dir}" "${xcframework_paths[@]}"

rm -rf \
"${lib_dir}/arm64-iphoneos" \
"${lib_dir}/arm64-iphonesimulator" \
"${lib_dir}/x86_64-iphonesimulator" \
"${lib_dir}/universal"

archive_ios "Debug"
fi

if [[ "${ISSUE_RELEASE_BUILD}" == "true" ]]; then
local out_dir="out/ios-release/filament"
local lib_dir="${out_dir}/lib"

build_ios_target "Release" "arm64" "iphoneos"

if [[ "${IOS_BUILD_SIMULATOR}" == "true" ]]; then
build_ios_target "Release" "arm64" "iphonesimulator"
build_ios_target "Release" "x86_64" "iphonesimulator"

# Create a universal library for the simulator
build/ios/create-universal-libs.sh \
-o "${lib_dir}/universal" \
"${lib_dir}/arm64-iphonesimulator" \
"${lib_dir}/x86_64-iphonesimulator"
fi

if [[ "${BUILD_UNIVERSAL_LIBRARIES}" == "true" ]]; then
build/ios/create-universal-libs.sh \
-o out/ios-release/filament/lib/universal \
out/ios-release/filament/lib/arm64 \
out/ios-release/filament/lib/x86_64
rm -rf out/ios-release/filament/lib/arm64
rm -rf out/ios-release/filament/lib/x86_64
# Always create XCFrameworks
local xcframework_paths=("${lib_dir}/arm64-iphoneos")
if [[ -d "${lib_dir}/universal" ]]; then
xcframework_paths+=("${lib_dir}/universal")
elif [[ -d "${lib_dir}/arm64-iphonesimulator" ]]; then
xcframework_paths+=("${lib_dir}/arm64-iphonesimulator")
elif [[ -d "${lib_dir}/x86_64-iphonesimulator" ]]; then
xcframework_paths+=("${lib_dir}/x86_64-iphonesimulator")
fi

build/ios/create-xc-frameworks.sh -o "${lib_dir}" "${xcframework_paths[@]}"

rm -rf \
"${lib_dir}/arm64-iphoneos" \
"${lib_dir}/arm64-iphonesimulator" \
"${lib_dir}/x86_64-iphonesimulator" \
"${lib_dir}/universal"

archive_ios "Release"
fi
}
Expand Down
87 changes: 87 additions & 0 deletions build/ios/create-xc-frameworks.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
#!/usr/bin/env bash

set -e

function print_help {
local SELF_NAME
SELF_NAME=$(basename "$0")
echo "$SELF_NAME. Combine multiple platform-specific libraries into XCFramework bundles."
echo ""
echo "Usage:"
echo " $SELF_NAME [options] <path>..."
echo ""
echo "Options:"
echo " -h"
echo " Print this help message."
echo " -o"
echo " Output directory to store the XCFrameworks."
echo ""
echo "Example:"
echo " $SELF_NAME -o xcframeworks/ iphoneos/ iphonesimulator/"
echo ""
}

OUTPUT_DIR=""
while getopts "ho:" opt; do
case ${opt} in
h)
print_help
exit 1
;;
o)
OUTPUT_DIR="${OPTARG}"
;;
*)
print_help
exit 1
;;
esac
done

shift $((OPTIND - 1))

PATHS=("$@")

if [[ ! "${PATHS[*]}" ]]; then
echo "One or more paths required."
print_help
exit 1
fi

if [[ ! "${OUTPUT_DIR}" ]]; then
echo "Output directory required."
print_help
exit 1
fi

mkdir -p "${OUTPUT_DIR}"

# Use the first path as the leader to find all .a files
LEADER_PATH="${PATHS[0]}"

for FILE in "${LEADER_PATH}"/*.a; do
[ -f "${FILE}" ] || continue

LIBRARY_NAME="${FILE##*/}"
FRAMEWORK_NAME="${LIBRARY_NAME%.a}.xcframework"

echo "Creating XCFramework for: ${LIBRARY_NAME}"

CMD="xcodebuild -create-xcframework"

for PLATFORM_PATH in "${PATHS[@]}"; do
LIB_PATH="${PLATFORM_PATH}/${LIBRARY_NAME}"
if [[ -f "${LIB_PATH}" ]]; then
CMD="${CMD} -library ${LIB_PATH}"
else
echo "Warning: ${LIB_PATH} does not exist, skipping this platform for ${LIBRARY_NAME}"
fi
done

CMD="${CMD} -output ${OUTPUT_DIR}/${FRAMEWORK_NAME}"

# Remove existing framework if it exists
rm -rf "${OUTPUT_DIR}/${FRAMEWORK_NAME}"

eval "${CMD}"
done
3 changes: 3 additions & 0 deletions filament/backend/src/metal/MetalDriver.mm
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* limitations under the License.
*/

#include <TargetConditionals.h>
#include "backend/PresentCallable.h"
#include "private/backend/CommandStream.h"
#include "CommandStreamDispatcher.h"
Expand Down Expand Up @@ -160,9 +161,11 @@
}

mContext->supportsDepthClamp = false;
#if !TARGET_OS_SIMULATOR
if (@available(macOS 10.11, iOS 11.0, *)) {
mContext->supportsDepthClamp = true;
}
#endif

// In order to support resolve store action on depth attachment, the GPU needs to support it.
// Note that support for depth resolve implies support for stencil resolve using .sample0 resolve filter.
Expand Down
Loading