Skip to content

Commit

Permalink
feat: add visionOS support
Browse files Browse the repository at this point in the history
ci: update to Xcode 15.2

feat: add visionos to podspec

add xr framework metadata

fix: set correct target for xros

feat: temp workaround for CMake bug
  • Loading branch information
okwasniewski committed May 6, 2024
1 parent 6285c8b commit b9f6431
Show file tree
Hide file tree
Showing 10 changed files with 340 additions and 71 deletions.
37 changes: 26 additions & 11 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ workflows:
# Default settings for Apple jobs (apple-runtime, test-apple-runtime)
apple_defaults: &apple_defaults
macos:
xcode: 13.4.1
xcode: 15.3
resource_class: macos.m1.medium.gen1
working_directory: ~/hermes
environment:
Expand Down Expand Up @@ -165,10 +165,6 @@ jobs:
- checkout
- restore_cache:
key: v4-repo-{{ .Environment.CIRCLE_SHA1 }}
- run:
name: Install dependencies
command: |
brew install cmake ninja
- run:
name: Build the test application
command: |
Expand All @@ -189,9 +185,18 @@ jobs:
xcodebuild test \
-workspace ApplePlatformsIntegrationTests.xcworkspace \
-configuration Debug \
-destination 'platform=iOS Simulator,name=iPhone 11' \
-destination 'platform=iOS Simulator,name=iPhone 15' \
-scheme ApplePlatformsIntegrationMobileTests
working_directory: test/ApplePlatformsIntegrationTestApp
- run:
name: Test Apple Vision application
command: |
xcodebuild test \
-workspace ApplePlatformsIntegrationTests.xcworkspace \
-configuration Debug \
-destination 'platform=visionOS Simulator,name=Apple Vision Pro' \
-scheme ApplePlatformsIntegrationVisionOSTests
working_directory: test/ApplePlatformsIntegrationTestApp

build-apple-runtime:
<<: *apple_defaults
Expand All @@ -207,8 +212,13 @@ jobs:
- run:
name: Install dependencies
command: |
brew install cmake ninja
brew install ninja
sudo gem install cocoapods
# TODO: Building for Apple Vision Pro requires a newer version of
# CMake than is available by default. Remove "brew update" once the
# CircleCI image contains CMake > 3.29.2.
brew update
brew install cmake
- run:
name: Build the iOS frameworks
command: ./utils/build-ios-framework.sh
Expand All @@ -222,6 +232,8 @@ jobs:
- ~/hermes/build_catalyst
- ~/hermes/build_iphonesimulator
- ~/hermes/build_macosx
- ~/hermes/build_xros
- ~/hermes/build_xrsimulator
- ~/hermes/destroot

package-apple-runtime:
Expand All @@ -236,8 +248,11 @@ jobs:
- run:
name: Install dependencies
command: |
brew install cmake ninja
brew install cmake
sudo gem install cocoapods
# TODO: See comment in build-apple-runtime.
brew update
brew install cmake
- run:
name: Package the framework
command: |
Expand Down Expand Up @@ -265,7 +280,7 @@ jobs:

macos:
macos:
xcode: 13.4.1
xcode: 13.4.1
steps:
- checkout:
path: hermes
Expand Down Expand Up @@ -303,7 +318,7 @@ jobs:

test-macos:
macos:
xcode: 13.4.1
xcode: 13.4.1
steps:
- checkout:
path: hermes
Expand Down Expand Up @@ -680,7 +695,7 @@ jobs:

test-macos-test262:
macos:
xcode: 13.4.1
xcode: 13.4.1
steps:
- checkout:
path: hermes
Expand Down
8 changes: 8 additions & 0 deletions API/hermes/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,14 @@ if(APPLE AND HERMES_BUILD_APPLE_FRAMEWORK)
add_custom_command(TARGET libhermes POST_BUILD
COMMAND /usr/libexec/PlistBuddy -c "Add :LSMinimumSystemVersion string ${CMAKE_OSX_DEPLOYMENT_TARGET}" $<TARGET_FILE_DIR:libhermes>/Resources/Info.plist
)
elseif(HERMES_APPLE_TARGET_PLATFORM MATCHES "xr")
if(CMAKE_VERSION VERSION_LESS 3.28.4)
message("VisionOS Simulator requires CMake version >= 3.28.4")
endif()

add_custom_command(TARGET libhermes POST_BUILD
COMMAND /usr/libexec/PlistBuddy -c "Add :MinimumOSVersion string ${CMAKE_OSX_DEPLOYMENT_TARGET}" $<TARGET_FILE_DIR:libhermes>/Info.plist
)
endif()
endif()

Expand Down
3 changes: 2 additions & 1 deletion hermes-engine.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@ Pod::Spec.new do |spec|
# The podspec would be serialized to JSON and people will download prebuilt binaries instead of the source.
# TODO(use the hash field as a validation mechanism when the process is stable)
spec.source = ENV['hermes-artifact-url'] ? { http: ENV['hermes-artifact-url'] } : { git: "https://github.com/facebook/hermes.git", tag: "v#{spec.version}" }
spec.platforms = { :osx => "10.13", :ios => "11.0" }
spec.platforms = { :osx => "10.13", :ios => "12.0", :visionos => "1.0" }

spec.preserve_paths = ["destroot/bin/*"].concat(HermesHelper::BUILD_TYPE == :debug ? ["**/*.{h,c,cpp}"] : [])
spec.source_files = "destroot/include/**/*.h"
spec.header_mappings_dir = "destroot/include"

spec.ios.vendored_frameworks = "destroot/Library/Frameworks/universal/hermes.xcframework"
spec.visionos.vendored_frameworks = "destroot/Library/Frameworks/universal/hermes.xcframework"
spec.osx.vendored_frameworks = "destroot/Library/Frameworks/macosx/hermes.framework"

spec.xcconfig = { "CLANG_CXX_LANGUAGE_STANDARD" => "c++17", "CLANG_CXX_LIBRARY" => "compiler-default", "GCC_PREPROCESSOR_DEFINITIONS" => "HERMES_ENABLE_DEBUGGER=1" }
Expand Down
1 change: 1 addition & 0 deletions lib/Platform/Logging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <android/log.h>
#elif defined(__APPLE__)
#include <os/log.h>
#include <stdio.h>
#else
#include <cstdio>
#endif
Expand Down

0 comments on commit b9f6431

Please sign in to comment.