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 Apr 24, 2024
1 parent 6285c8b commit b9a8dd2
Show file tree
Hide file tree
Showing 10 changed files with 347 additions and 72 deletions.
45 changes: 33 additions & 12 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ orbs:
android: circleci/android@2.0.3
node: circleci/node@4.7.0

commands:
# Install latest CMake version, needed for building Hermes for visionOS which requires at least CMake 3.29.
brew-install-cmake:
steps:
- run:
name: Install CMake
command: |
brew update
brew install cmake
workflows:
version: 2
build:
Expand Down Expand Up @@ -40,7 +50,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 @@ -168,7 +178,8 @@ jobs:
- run:
name: Install dependencies
command: |
brew install cmake ninja
brew install ninja
- brew-install-cmake
- run:
name: Build the test application
command: |
Expand All @@ -189,9 +200,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 +227,9 @@ jobs:
- run:
name: Install dependencies
command: |
brew install cmake ninja
brew install ninja
sudo gem install cocoapods
- brew-install-cmake
- run:
name: Build the iOS frameworks
command: ./utils/build-ios-framework.sh
Expand All @@ -222,6 +243,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 +259,9 @@ jobs:
- run:
name: Install dependencies
command: |
brew install cmake ninja
brew install cmake
sudo gem install cocoapods
- brew-install-cmake
- run:
name: Package the framework
command: |
Expand Down Expand Up @@ -265,7 +289,7 @@ jobs:

macos:
macos:
xcode: 13.4.1
xcode: 15.3
steps:
- checkout:
path: hermes
Expand Down Expand Up @@ -303,14 +327,11 @@ jobs:

test-macos:
macos:
xcode: 13.4.1
xcode: 15.3
steps:
- checkout:
path: hermes
- run:
name: Install dependencies
command: |
brew install cmake
- brew-install-cmake
- run:
name: Run MacOS regression tests in debug mode
command: |
Expand Down Expand Up @@ -680,7 +701,7 @@ jobs:

test-macos-test262:
macos:
xcode: 13.4.1
xcode: 15.3
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 b9a8dd2

Please sign in to comment.