Skip to content

Commit 4bbfb84

Browse files
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

17 files changed

+3738
-17
lines changed

Apps/PackageTest/ios/PackageTest.xcodeproj/project.pbxproj

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,6 @@
194194
C5056CCD3641216F351DE750 /* Pods-PackageTest-tvOSTests.debug.xcconfig */,
195195
C671E95B56582A5129BD9DC3 /* Pods-PackageTest-tvOSTests.release.xcconfig */,
196196
);
197-
name = Pods;
198197
path = Pods;
199198
sourceTree = "<group>";
200199
};
@@ -828,7 +827,7 @@
828827
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
829828
GCC_WARN_UNUSED_FUNCTION = YES;
830829
GCC_WARN_UNUSED_VARIABLE = YES;
831-
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
830+
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
832831
LD_RUNPATH_SEARCH_PATHS = "/usr/lib/swift $(inherited)";
833832
LIBRARY_SEARCH_PATHS = (
834833
"\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"",
@@ -881,7 +880,7 @@
881880
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
882881
GCC_WARN_UNUSED_FUNCTION = YES;
883882
GCC_WARN_UNUSED_VARIABLE = YES;
884-
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
883+
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
885884
LD_RUNPATH_SEARCH_PATHS = "/usr/lib/swift $(inherited)";
886885
LIBRARY_SEARCH_PATHS = (
887886
"\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"",

Apps/PackageTest/ios/PackageTest.xcworkspace/contents.xcworkspacedata

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Apps/PackageTest/ios/Podfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ SPEC CHECKSUMS:
454454
React-jsi: b6dc94a6a12ff98e8877287a0b7620d365201161
455455
React-jsiexecutor: 1540d1c01bb493ae3124ed83351b1b6a155db7da
456456
React-jsinspector: 512e560d0e985d0e8c479a54a4e5c147a9c83493
457-
react-native-babylon: fb07a9209a7236b70d93bee5c6404d97b6eddfca
457+
react-native-babylon: aefdca46971b35a7dbe99cd9c8ba4ea7d6d0b8b4
458458
React-RCTActionSheet: f41ea8a811aac770e0cc6e0ad6b270c644ea8b7c
459459
React-RCTAnimation: 49ab98b1c1ff4445148b72a3d61554138565bad0
460460
React-RCTBlob: a332773f0ebc413a0ce85942a55b064471587a71

Apps/PackageTest/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Apps/PackageTest/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
},
1212
"dependencies": {
1313
"@babylonjs/core": "^4.2.0-alpha.21",
14-
"@babylonjs/react-native": "file:../Playground/node_modules/@babylonjs/react-native/babylonjs-react-native-0.0.1.tgz",
14+
"@babylonjs/react-native": "file:../../Package/Assembled/babylonjs-react-native-0.0.1.tgz",
1515
"react": "16.11.0",
1616
"react-native": "0.62.2",
1717
"react-native-permissions": "^2.1.5"

Apps/Playground/ios/Podfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ SPEC CHECKSUMS:
366366
React-jsi: 600d8e42510c3254fd2abd702f4b9d3f598d8f52
367367
React-jsiexecutor: e9698dee4fd43ceb44832baf15d5745f455b0157
368368
React-jsinspector: f74a62727e5604119abd4a1eda52c0a12144bcd5
369-
react-native-babylon: fb07a9209a7236b70d93bee5c6404d97b6eddfca
369+
react-native-babylon: 004630b2838450727c093bfcc30e05d5b08206c1
370370
react-native-slider: e51492f1264d882a8815b71c5870f8978e52887d
371371
React-RCTActionSheet: af8f28dd82fec89b8fe29637b8c779829e016a88
372372
React-RCTAnimation: 0d21fff7c20fb8ee41de5f2ebb63221127febd96

Apps/Playground/node_modules/@babylonjs/react-native/ios/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Apps/Playground/node_modules/@babylonjs/react-native/react-native-babylon.podspec

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Assembled
2+
Build
3+
node_modules

0 commit comments

Comments
 (0)