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

C++-only TurboModules library creation and AutoLinking #698

Open
ShamKarthik-TA opened this issue Aug 9, 2023 · 3 comments
Open

C++-only TurboModules library creation and AutoLinking #698

ShamKarthik-TA opened this issue Aug 9, 2023 · 3 comments

Comments

@ShamKarthik-TA
Copy link

Introduction

C++ pure turbo modules library

Details

I have seen the pure C++ Turbo modules implementation of the react in the react documentation
https://reactnative.dev/docs/the-new-architecture/cxx-cxxturbomodules

lets say I am using a existing C++ library with the C++ pure Turbo module

Discussion points

How can we create a isolated library without tm folder tightly coupling the logic ?

@cortinico
Copy link
Member

How can we create a isolated library without tm folder tightly coupling the logic ?

Sorry can you clarify your question?

@ShamKarthik-TA
Copy link
Author

ShamKarthik-TA commented Aug 9, 2023

this is the file structure we have to follow but we can see the tm folder is within the react native project but I want to maintain it as a separate library which can be installed as a independent package like react-native-mmkv

but as far as I have seen the react-native-mmkv implementation it is having a dependency with java and it needs java folder in android

and I want a library which should not have java implementation with jni instead use c++ implementation as mentioned in
https://reactnative.dev/docs/the-new-architecture/cxx-cxxturbomodules to create library

CxxTurboModulesGuide
├── android
│   └── app
│       │── src
│       │   └── main
│       │       └── jni
│       │           ├── CMakeLists.txt
│       │           └── OnLoad.cpp
│       └── build.gradle (updated)
├── ios
│   └── CxxTurboModulesGuide
│       └── AppDelegate.mm (updated)
├── js
│   └── App.tsx|jsx (updated)
└── tm
    ├── CMakeLists.txt
    ├── NativeSampleModule.h
    ├── NativeSampleModule.cpp
    ├── NativeSampleModule.ts|js
    └── TurboModules.podspec

@cortinico
Copy link
Member

I understand. What you're asking for today is quite advanced and we don't have a guide for it.
Practically is possible to create a library that has only js and c++ code, but it won't be autolinked automatically (you'll have to tell to your users how to do it, edit the CMakeLists.txt file and so on).

This has already been requested in the past and we'll probably look into it in the future.

@cortinico cortinico changed the title C++ pure Turbo modules library creation C++-only TurboModules library creation and AutoLinking Aug 9, 2023
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

No branches or pull requests

2 participants