-
Notifications
You must be signed in to change notification settings - Fork 133
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
Binary packages : AAR, pod, nuget #1446
Comments
Hey @CedricGuillemet, I'm experimenting with the AAR and wanted to create a prebuilt for React Native. As I understand the flow would be to:
I'm hitting issues on the first step, when I set the variable I'm getting this error:
I guess I need to have JSI linked, which means that prebuilding won't be possible for React Native? Or do you have some idea how to make this work? I've tried to reference JSI in the CMake file of Babylon Native (just for testing) but it didn't work:
Can you point me in the right direction on how to get the AAR prebuild working? |
As an additional context I was able to take the build the AAR file, reference it in a React Native project: implementation files('libs/BabylonNative-release.aar') Render the Engine View that Babylon Native provides and load scripts using the view.loadScript method:
And it worked! Making the integration way simpler (Great work on that btw!) Now its the matter of having JSI in the middle 😅 |
That's excellent news! Yes, integration should be a lot easier and it should be possible to do the same for other platforms as well. |
@CedricGuillemet @bghgary any chance you can share what are the prerequisites for getting this prebuilt JSI to work? I think this is crucial for the new architecture to work properly, moving most of the integration layer back to Babylon Native would make it a lot easier. For now I'm struggling with getting new architecture to work properly due to some internal stack corruption errors.. I wanted to explore whether using your work on AAR this might make the new architecture migration easier. I've been trying out different ways of getting the prebuild of JSI to work, I think I'm getting there, this is a hacky way of getting this working there but we can polish the build system once it works. I've been modifying this file: set(REACT_NATIVE_PATH "~/workspace/react-native/packages/react-native" CACHE PATH "Path to React Native source")
# Add all JSI dependencies
add_subdirectory("${REACT_NATIVE_PATH}/ReactAndroid/src/main/jni/third-party/folly"
"${CMAKE_CURRENT_BINARY_DIR}/folly")
add_subdirectory("${REACT_NATIVE_PATH}/ReactAndroid/src/main/jni/third-party/boost"
"${CMAKE_CURRENT_BINARY_DIR}/boost")
add_subdirectory("${REACT_NATIVE_PATH}/ReactAndroid/src/main/jni/third-party/fmt"
"${CMAKE_CURRENT_BINARY_DIR}/fmt")
add_subdirectory("${REACT_NATIVE_PATH}/ReactAndroid/src/main/jni/third-party/double-conversion"
"${CMAKE_CURRENT_BINARY_DIR}/double-conversion")
add_subdirectory("${REACT_NATIVE_PATH}/ReactAndroid/src/main/jni/third-party/glog"
"${CMAKE_CURRENT_BINARY_DIR}/glog")
add_subdirectory("${REACT_NATIVE_PATH}/ReactCommon/jsi"
"${CMAKE_CURRENT_BINARY_DIR}/jsi")
target_include_directories(BabylonNativeJNI
PRIVATE "${REACT_NATIVE_PATH}/ReactCommon"
PRIVATE "${REACT_NATIVE_PATH}/ReactCommon/jsi")
target_link_libraries(BabylonNativeJNI
GLESv3
android
EGL
log
jsi # Add jsi here
-lz
AndroidExtensions
AppRuntime
Canvas
Console
GraphicsDevice
NativeCamera
NativeEngine
NativeInput
NativeOptimizations
NativeXr
ScriptLoader
XMLHttpRequest
Window) It looks like this is almost working, Im still struggling with the error that
Also I noticed that the new Babylon Native wrapper doesn't have methods to interface with JSI, should we create new ones? Where we will probably pass some JSI instance etc.? Just how the old Babylon React Native integration worked? |
Following this PR that adds .aar android package build:
#1440
Next steps to improve integration ease into user land projects:
Unkowns
Technical questions/small tasks:
extractNativeLibraries
https://github.com/BabylonJS/BabylonNative/pull/1440/files/f50ade5e205029a159ca17f690704b095851b8de#diff-8bbc0df4aecf373eeaede4c5aac76fa992054286de68dd0c91d2210971edc3d3 )iOS
Windows/Nuget
BRN
Next steps:
The text was updated successfully, but these errors were encountered: