Skip to content
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

Update CMakeLists.txt to resolve "react-native" #4466

Merged
merged 3 commits into from
Apr 1, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ x.x.x Release notes (yyyy-MM-dd)
### Fixed
* Logging out too fast can cause an error if the timeout behavior is set to `openLocalRealm` ([4453](https://github.com/realm/realm-js/issues/4453))
* Changed "react-native" main field to point to a `lib/index.native.js` file to help bundlers pick the right file when loading our library on React Native. ([#4459](https://github.com/realm/realm-js/issues/4459))
* Fixed resolving the "react-native" package when building from source, enabling developers to run the `./scripts/build-ios.sh` script themselves to build our iOS artifacts with the same version of Xcode / LLVM as they're building their app.

### Compatibility
* MongoDB Realm Cloud.
Expand Down
11 changes: 10 additions & 1 deletion src/jsi/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
set(REACT_NATIVE_ROOT_DIR "${PACKAGE_ROOT_DIR}/node_modules/react-native")
# Using Node.js to resolve the path to the "react-native" package.
# This enables building for iOS on the end-users machine,
# where "react-native" is installed as a sibling to our package instead of being a dev-dependency of our package.

execute_process(
COMMAND node --print "path.dirname(require.resolve('react-native/package.json'))"
OUTPUT_VARIABLE REACT_NATIVE_ROOT_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE
)
set(JSI_HEADER_DIR "${REACT_NATIVE_ROOT_DIR}/ReactCommon/jsi")
message(STATUS "Getting JSI headers from ${JSI_HEADER_DIR}")

add_library(realm-js-hermes OBJECT
jsi_init.cpp
Expand Down