8000 Fix building with non-beta Xcode 15 by tgoyne · Pull Request #7055 · realm/realm-core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix building with non-beta Xcode 15 #7055

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 30, 2023
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
### Fixed
* <How do the end-user experience this issue? what was the impact?> ([#????](https://github.com/realm/realm-core/issues/????), since v?.?.?)
* Potential stack-use-after-scope issue on changesets integration with msvc-2019 and mpack code ([PR #6911](https://github.com/realm/realm-core/pull/6911))
* Fix compilation with non-beta Xcode 15. Building for visionOS now requires explicitly specifying `-DCMAKE_XCODE_ATTRIBUTE_SDKROOT=xros` (PR [#7055](https://github.com/realm/realm-core/pull/7055)).

### Breaking changes
* None.
Expand Down
6 changes: 6 additions & 0 deletions tools/build-apple-device.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,19 @@ if [ "${platform}" == 'maccatalyst' ]; then
buildDestination='generic/platform=macOS,variant=Mac Catalyst'
fi

sdkroot=iphoneos
if [[ "${platform}" == xr* ]]; then
sdkroot=xros
fi

mkdir -p build-xcode-platforms
cd build-xcode-platforms
cmake \
-D CMAKE_TOOLCHAIN_FILE="../tools/cmake/xcode.toolchain.cmake" \
-D REALM_VERSION="${VERSION}" \
-D REALM_BUILD_LIB_ONLY=ON \
-D CPACK_PACKAGE_DIRECTORY=.. \
-D CMAKE_XCODE_ATTRIBUTE_SDKROOT="$sdkroot" \
${CMAKE_FLAGS} \
-G Xcode \
..
Expand Down
16 changes: 10 additions & 6 deletions tools/cmake/xcode.toolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,18 @@ set(CMAKE_XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY "1,2,3,4,7")

# With Xcode 14+ the base SDK *mostly* doesn't matter any more, as it
# officially supports multi-platform builds from a single target.
# However, as of Xcode 15 beta 2 xcodebuild (but not Xcode itself) requires the
# visionOS SDK to build for visionOS. Hopefully this is just a beta bug.
# However, as of Xcode 15 beta 8 xcodebuild (but not Xcode itself) requires the
# visionOS SDK to build for visionOS. 15.0 final doesn't include the visionOS
# SDK, so the SDKROOT is explicitly set by the invoker when building with the
# beta Xcode rather than here.
# Xcode 13 requires using the correct SDK. We no longer support Xcode 13, but
# still use it on evergreen to build the macOS tests (and nothing else).
set(CMAKE_XCODE_ATTRIBUTE_SDKROOT_1500 "xros")
set(CMAKE_XCODE_ATTRIBUTE_SDKROOT_1400 "iphoneos")
set(CMAKE_XCODE_ATTRIBUTE_SDKROOT_1300 "macosx")
set(CMAKE_XCODE_ATTRIBUTE_SDKROOT "$(SDKROOT_$(XCODE_VERSION_MAJOR))")
if(NOT DEFINED CMAKE_XCODE_ATTRIBUTE_SDKROOT)
set(CMAKE_XCODE_ATTRIBUTE_SDKROOT_1500 "iphoneos")
set(CMAKE_XCODE_ATTRIBUTE_SDKROOT_1400 "iphoneos")
set(CMAKE_XCODE_ATTRIBUTE_SDKROOT_1300 "macosx")
set(CMAKE_XCODE_ATTRIBUTE_SDKROOT "$(SDKROOT_$(XCODE_VERSION_MAJOR))")
endif()

set(CMAKE_XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET "11.0")
set(CMAKE_XCODE_ATTRIBUTE_MACOSX_DEPLOYMENT_TARGET_CATALYST_NO "10.13")
Expand Down
0