Commit 4bbfb84
authored
Binary package build (#44)
This change supports building an NPM package with pre-compiled binaries. Notable pieces of this change:
- There is a new Package directory, which contains a few static support files, and a Gulp based build script. I decided to use Gulp because it is cross platform, commonly used for web-tech based projects, and makes it easy to break the build script into separable pieces. My plan is to have a PR build that does gulp buildIOS and gulp buildAndroid in parallel, and have the CI build that does gulp (invokes the default function) to build both iOS and Android and then publish the package. These PR/CI build changes will come in a later PR.
- The build script builds Android by just building the Playground app and then copying over the libBabylonNative.so files for different architectures, plus some Android specific interop source code files that are compiled into the consuming app.
- For Android, we additionally include a static build.gradle that is exactly what is generated by the React Native CLI tools for new packages (which is compatible with React Native consuming apps), plus two additions: 1) It produces a build error if the min SDK version is less than 18 (required for GLES3), 2) it adds a dependency on ARCore.
- The build script builds iOS through a CMakeLists.txt that includes the regular iOS CMakeLists.txt from the source package, and then adds a few extra steps to scoop up all the static libs we care about into a single directory. These libs are run through the lipo tool to combine the different architectures for each lib into a set of "universal libs" for all supported architectures. This makes them compatible with CocoaPods, where we do not have the ability to specify different static libs for different architectures. The "universal libs" plus some iOS specific interop source code files are copied over to the precompiled package directory.
- For iOS, we additionally include a static podspec that includes all the static libs, plus the loose source files that the consuming app needs to compile.
- The PackageTest app's @babylonjs/react-native dependency now points to the locally built binary package (rather than the source package).
- The PackageTest app's xcworkspace no longer references a ReactNativeBabylon xcodeproj since it is now pulling in precompiled binaries.
Other smaller changes included in this PR:
- Update to the BabylonNative submodule to the latest master, which includes fixes for warnings as errors on iOS and Android. This pulled in an updated version of glslang, which produces two additional libs, which needed to be added to the list of libs to link in the source-based package's podspec.
- I updated the iOS deployment target of the PackageTest app to be 12 instead of 9. This just got missed on the initial checkin, and actually results in build errors for Release (since the Babylon React Native package declares a minimum deployment target of 12).
- The iOS CMakeLists.txt now explicitly uses ${CMAKE_CURRENT_LIST_DIR} since paths are relative to the CMakeLists.txt file itself. Without specifying this, paths are relative to the "top level" CMakeLists.txt (in this case, the one in the Package directory that includes this CMakeLists.txt.
- Updates to the README.md to reflect the changes around the binary packaging.1 parent 4503451 commit 4bbfb84
File tree
17 files changed
+3738
-17
lines changed- Apps
- PackageTest
- ios
- PackageTest.xcodeproj
- PackageTest.xcworkspace
- Playground
- ios
- node_modules/@babylonjs/react-native
- ios
- submodules
- Package
- Android
- iOS
17 files changed
+3738
-17
lines changedLines changed: 2 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
194 | 194 | | |
195 | 195 | | |
196 | 196 | | |
197 | | - | |
198 | 197 | | |
199 | 198 | | |
200 | 199 | | |
| |||
828 | 827 | | |
829 | 828 | | |
830 | 829 | | |
831 | | - | |
| 830 | + | |
832 | 831 | | |
833 | 832 | | |
834 | 833 | | |
| |||
881 | 880 | | |
882 | 881 | | |
883 | 882 | | |
884 | | - | |
| 883 | + | |
885 | 884 | | |
886 | 885 | | |
887 | 886 | | |
| |||
Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
454 | 454 | | |
455 | 455 | | |
456 | 456 | | |
457 | | - | |
| 457 | + | |
458 | 458 | | |
459 | 459 | | |
460 | 460 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
366 | 366 | | |
367 | 367 | | |
368 | 368 | | |
369 | | - | |
| 369 | + | |
370 | 370 | | |
371 | 371 | | |
372 | 372 | | |
| |||
Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Submodule BabylonNative updated 29 files
- Apps/ValidationTests/Scripts/validation_native.js+17-17
- Dependencies/glslang+1-1
- Dependencies/xr/Source/ARKit/XR.mm+139-65
- Documentation/DebugRenderedFrameMetal.md+74
- Documentation/Images/FrameCaptureiOS/CaptureDrawCall.jpg
- Documentation/Images/FrameCaptureiOS/CaptureFragmentShaderSource.jpg
- Documentation/Images/FrameCaptureiOS/CaptureFragmentUniforms.jpg
- Documentation/Images/FrameCaptureiOS/CaptureFrameMenu.jpg
- Documentation/Images/FrameCaptureiOS/CaptureGeometry.jpg
- Documentation/Images/FrameCaptureiOS/CaptureGeometryReview.jpg
- Documentation/Images/FrameCaptureiOS/CaptureResult.jpg
- Documentation/Images/FrameCaptureiOS/CaptureVertexShaderSource.jpg
- Documentation/Images/FrameCaptureiOS/CaptureVertexUniforms.jpg
- Documentation/Images/FrameCaptureiOS/ReleaseFrameCapture.jpg
- Documentation/Images/FrameCaptureiOS/Sampler.jpg
- Documentation/Images/FrameCaptureiOS/SimulatorFrameToCapture.jpg
- Documentation/Images/FrameCaptureiOS/Texture.jpg
- Documentation/Readme.md+21
- Plugins/NativeEngine/Source/BgfxCallback.cpp+31-4
- Plugins/NativeEngine/Source/BgfxCallback.h+8-2
- Plugins/NativeEngine/Source/NativeEngine.cpp+4-36
- Plugins/NativeEngine/Source/NativeEngine.h+122-56
- Plugins/NativeEngine/Source/ResourceLimits.cpp+1
- Plugins/NativeEngine/Source/ShaderCompiler.cpp-4
- Plugins/NativeEngine/Source/ShaderCompilerD3D.cpp-4
- Plugins/NativeEngine/Source/ShaderCompilerTraversers.cpp-4
- Plugins/NativeXr/Source/NativeXr.cpp+5-1
- README.md+4
- azure-pipelines.yml+4-2
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
0 commit comments