FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Use `cmake-rn` by kraenhansen · Pull Request #22 · NativeScript/runtimes · GitHub

Use cmake-rn - #22

Draft
kraenhansen wants to merge 3 commits into
NativeScript:mainfrom
kraenhansen:cmake-rn
Draft

Use cmake-rn#22
kraenhansen wants to merge 3 commits into
NativeScript:mainfrom
kraenhansen:cmake-rn

Conversation

kraenhansen commented Oct 24, 2025
edited
Loading

Copy link
Copy Markdown

I wanted to show how I intended the React Native Node-API tooling to be used: cmake-rn taking 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-rn all the way out to the package.json as a package script, like we do in the host when building weak-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

# Defines the "weak-node-api" target
include(${WEAK_NODE_API_CONFIG})
target_link_libraries(addon PRIVATE weak-node-api)

☝️ is because callstackincubator/react-native-node-api#192 causing weak-node-api to miss an x86_64 slice.

shirakaba commented Feb 7, 2026
edited
Loading

Copy link
Copy Markdown
Collaborator

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 main.

Comment thread build_nativescript.sh
Comment on lines -89 to +97
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

shirakaba Feb 7, 2026
edited
Loading

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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:

  1. In step a, separately specify the metadata size for each platform in the triplet (as it will indeed differ by platform)
  2. In step b, build the intermediate project for each triplet.

How can we solve that?

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL