Skip to content

Commit

Permalink
[wip] xcframework build script
Browse files Browse the repository at this point in the history
  • Loading branch information
okwasniewski committed Sep 25, 2024
1 parent 1fd29d5 commit 45bb1d1
Show file tree
Hide file tree
Showing 12 changed files with 1,033 additions and 701 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ jobs:
run: npm install
working-directory: ./Apps/BRNPlayground

- name: Build Windows Bundle
- name: Build iOS Bundle
run: npm run build:ios
working-directory: ./Apps/BRNPlayground

Expand All @@ -140,6 +140,14 @@ jobs:
run: npx gulp buildIOSRNTA
working-directory: ./Package

- name: Cache XCFrameworks
uses: actions/cache@v2
with:
path: Modules/@babylonjs/react-native-iosandroid/ios/libs
key: ${{ runner.os }}-xcframeworks-${{ github.sha }}
restore-keys: |
${{ runner.os }}-xcframeworks
test-publish-android-ios:
runs-on: macos-latest
steps:
Expand Down
4 changes: 0 additions & 4 deletions Apps/BRNPlayground/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ options = {
:bridgeless_enabled => false,
:fabric_enabled => false,
:hermes_enabled => true,
# Fixes linking issue when using CMake > 3.24
:build_setting_overrides => {
'LIBRARY_SEARCH_PATHS' => '$(inherited) "$(PODS_ROOT)/../../../../Modules/@babylonjs/Build/iOS/build/"/**',
}
}

# react-native-permissions
Expand Down
27 changes: 23 additions & 4 deletions Apps/BRNPlayground/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1238,7 +1238,26 @@ PODS:
- ReactCommon/turbomodule/core
- Yoga
- react-native-babylon (0.0.1):
- React
- DoubleConversion
- glog
- hermes-engine
- RCT-Folly (= 2024.01.01.00)
- RCTRequired
- RCTTypeSafety
- React-Core
- React-debug
- React-Fabric
- React-featureflags
- React-graphics
- React-ImageManager
- React-NativeModulesApple
- React-RCTFabric
- React-rendererdebug
- React-utils
- ReactCodegen
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- react-native-slider (4.5.2):
- DoubleConversion
- glog
Expand Down Expand Up @@ -1802,7 +1821,7 @@ SPEC CHECKSUMS:
React-logger: 4072f39df335ca443932e0ccece41fbeb5ca8404
React-Mapbuffer: 714f2fae68edcabfc332b754e9fbaa8cfc68fdd4
React-microtasksnativemodule: 4943ad8f99be8ccf5a63329fa7d269816609df9e
react-native-babylon: d42edb0fcbf1aa406fda5947db408f6459f9b49a
react-native-babylon: 6234712503667b128f2a21b17d0d6dcc03c51552
react-native-slider: 97ce0bd921f40de79cead9754546d5e4e7ba44f8
React-nativeconfig: 4a9543185905fe41014c06776bf126083795aed9
React-NativeModulesApple: 0506da59fc40d2e1e6e12a233db5e81c46face27
Expand Down Expand Up @@ -1835,8 +1854,8 @@ SPEC CHECKSUMS:
ReactTestApp-Resources: 7db90c026cccdf40cfa495705ad436ccc4d64154
RNPermissions: 5a2dafe37c8e0a3fa1d6e0783a1490b1b7fd92d6
SocketRocket: abac6f5de4d4d62d24e11868d7a2f427e0ef940d
Yoga: 1354c027ab07c7736f99a3bef16172d6f1b12b47
Yoga: 4ef80d96a5534f0e01b3055f17d1e19a9fc61b63

PODFILE CHECKSUM: 1f9ff09dc4914f4ff0a83d4d955065ca4d613829
PODFILE CHECKSUM: c0272fe43d76243a8a0abcc5781bde0430d39023

COCOAPODS: 1.15.2
1 change: 1 addition & 0 deletions Apps/BRNPlayground/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Apps/BRNPlayground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"start": "react-native start",
"test": "jest",
"windows": "react-native run-windows --sln windows/BRNPlayground.sln",
"postinstall": "node ./postinstall.js"
"postinstall": "node ./postinstall.js",
"build-xcframeworks": "cd ../../Package && npx gulp createXCFrameworks"
},
"dependencies": {
"@babylonjs/core": ">=5.53.1",
Expand Down
3 changes: 2 additions & 1 deletion Modules/@babylonjs/react-native-iosandroid/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ DerivedData
*.ipa
*.xcuserstate
project.xcworkspace
ios/libs

# Android/IntelliJ
#
Expand All @@ -51,4 +52,4 @@ CMakeCache.txt
cmake_install.cmake
ReactNativeBabylon.xcodeproj
*.tgz
jsi
jsi
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ require "json"

package = JSON.parse(File.read(File.join(__dir__, "package.json")))

# This Podspec is used for local development

Pod::Spec.new do |s|
s.name = "react-native-babylon"
s.version = package["version"]
Expand All @@ -17,47 +19,73 @@ Pod::Spec.new do |s|
s.requires_arc = true
s.xcconfig = { 'USER_HEADER_SEARCH_PATHS' => '$(inherited) ${PODS_TARGET_SRCROOT}/shared ${PODS_TARGET_SRCROOT}/../react-native/shared' }

s.libraries = 'astc-encoder',
'etc1',
'etc2',
'nvtt',
'squish',
'pvrtc',
'iqa',
'edtaa3',
'tinyexr',
'BabylonNative',
'bgfx',
'bimg',
'bx',
'Canvas',
'GenericCodeGen',
'glslang',
'glslang-default-resource-limits',
'Graphics',
'jsRuntime',
'OGLCompiler',
'OSDependent',
'MachineIndependent',
'napi',
'NativeCamera',
'NativeCapture',
'NativeEngine',
'NativeInput',
'NativeOptimizations',
'NativeTracing',
'NativeXR',
'SPIRV',
'spirv-cross-core',
'spirv-cross-msl',
'tinyexr',
'UrlLib',
'Window',
'XMLHttpRequest',
'xr'
if ENV['BUILD_BABYLON_FROM_SOURCE'] == 'true' then
s.libraries = 'astc-encoder',
'etc1',
'etc2',
'nvtt',
'squish',
'pvrtc',
'iqa',
'edtaa3',
'tinyexr',
'BabylonNative',
'bgfx',
'bimg',
'bx',
'Canvas',
'GenericCodeGen',
'glslang',
'glslang-default-resource-limits',
'Graphics',
'jsRuntime',
'OGLCompiler',
'OSDependent',
'MachineIndependent',
'napi',
'NativeCamera',
'NativeCapture',
'NativeEngine',
'NativeInput',
'NativeOptimizations',
'NativeTracing',
'NativeXR',
'SPIRV',
'spirv-cross-core',
'spirv-cross-msl',
'tinyexr',
'UrlLib',
'Window',
'XMLHttpRequest',
'xr'
else
s.vendored_frameworks = "ios/libs/*.xcframework"
end

s.frameworks = "MetalKit", "ARKit"

s.dependency "React"
# install_modules_dependencies has been defined in RN 0.70
# This check ensure that the library can work on older versions of RN
if defined?(install_modules_dependencies)
install_modules_dependencies(s)
else
s.dependency "React-Core"

# Don't install the dependencies when we run `pod install` in the old architecture.
if new_arch_enabled then
s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
s.pod_target_xcconfig = {
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
"OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
}
s.dependency "React-Codegen"
s.dependency "RCT-Folly"
s.dependency "RCTRequired"
s.dependency "RCTTypeSafety"
s.dependency "ReactCommon/turbomodule/core"
s.dependency "React-RCTFabric"
end
end
end

2 changes: 1 addition & 1 deletion Modules/@babylonjs/react-native/NativeEngineHook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ function useAppState(): string {

return () => {
if (!!removeListener) {
removeListener();
} else {
// @ts-ignore removeEventListener is available on older RN versions
AppState.removeEventListener("change", onAppStateChanged);
}
};
Expand Down
Loading

0 comments on commit 45bb1d1

Please sign in to comment.