Conversation
|
Thanks so much for this. Sorry for the terribly late response. Currently reviewing in branch jb/cmake-rn. It looks great, I just need to make some additions to get it all working. Once I've managed that, I'll catch up with the recent changes in |
| if $BUILD_SIMULATOR; then | ||
| checkpoint "Building NativeScript for iPhone (simulator)" | ||
| if [[ $BUILD_SIMULATOR && "$TARGET_ENGINE" == "none" ]]; then | ||
| # TODO: Add x86_64-apple-ios-sim once supported | ||
| TRIPLETS+=("arm64-apple-ios-sim") | ||
| elif $BUILD_SIMULATOR; then | ||
| checkpoint "Building NativeScript for iPhone (simulator)" | ||
|
|
||
| cmake_build ios-sim x86_64 arm64 | ||
| cmake_build ios-sim x86_64 arm64 |
There was a problem hiding this comment.
Previously, cmake_build would be run for each platform, like this:
# Conditions for this example:
BUILD_IPHONE=true
BUILD_SIMULATOR=true
EMBED_METADATA=true
TARGET_ENGINE=none
# (1) Result of calling `cmake_build ios-sim x86_64 arm64`:
# (1a) Generate intermediate project
cmake \
--source=./NativeScript \
--build=dist/intermediates/ios-sim \
-GXcode \
-DTARGET_PLATFORM=ios-sim \
-DTARGET_ENGINE=none \
-DMETADATA_SIZE=1234 \
-DBUILD_CLI_BINARY=false
# (1b) Build intermediate project
cmake \
--build dist/intermediates/ios-sim \
--config RelWithDebInfo
# (2) Result of calling `cmake_build ios arm64`:
# (2a) Generate intermediate project
cmake \
--source=./NativeScript \
--build=dist/intermediates/ios \
-GXcode \
-DTARGET_PLATFORM=ios \
-DTARGET_ENGINE=none \
-DMETADATA_SIZE=1234 \
-DBUILD_CLI_BINARY=false
# (2b) Build intermediate project
cmake \
--build dist/intermediates/ios \
--config RelWithDebInfo
# etc.We still need to preserve that behaviour for React Native builds, i.e. TARGET_ENGINE=none, with any value of EMBED_METADATA (EMBED_METADATA may be true or false, depending on whether we want to provide metadata for the whole iOS SDK up-front, or let users generate it at app build time so that it can be specific to the code that their project is linking).
When using cmake-rn with TRIPLETS, I'm not clear how we can:
- In step a, separately specify the metadata size for each platform in the triplet (as it will indeed differ by platform)
- In step b, build the intermediate project for each triplet.
How can we solve that?
I wanted to show how I intended the React Native Node-API tooling to be used:
cmake-rntaking control of the building of Apple frameworks and construction of the Xcframework.It builds 🤷 But I haven't tried running it (because I don't know how to 🙈) and I am without a doubt missing context for what I'm suggesting here 😁 Feel free to pick whatever makes sense to the project (if any).
Arguably, you could also move the call to
cmake-rnall the way out to the package.json as a package script, like we do in the host when buildingweak-node-api.Note: This is currently missing linking with weak-node-api as per https://github.com/callstackincubator/react-native-node-api/tree/main/packages/cmake-rn#linking-against-node-api
☝️ is because callstackincubator/react-native-node-api#192 causing
weak-node-apito miss an x86_64 slice.