mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
d07575b1c6
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/35138 Changelog: [General][Added] - Add a C++ only TurboModule example (for Android/iOS/macOS/Windows) react-native@0.69 introduced a new bridging layer to ease integration for pure C++ TurboModules using C++ std:: types directly instead of the lower level jsi:: types: https://github.com/facebook/react-native/tree/v0.69.0/ReactCommon/react/bridging This bridging layer can be used in JSI functions or more conveniently in C++ TurboModules. Here is a example of an C++ only TurboModule which will work on Android and iOS and macOS/Windows (using microsoft/react-native-macos|windows) only using flow/TypeScript and standard C++ types. C++ only TurboModules are very handy as they do not require to work with JSI APIs - instead std:: or custom C++ can by used. Reviewed By: javache Differential Revision: D39011736 fbshipit-source-id: 84c833d8540671fde8505f1aeb0265074b248730
30 lines
861 B
CMake
30 lines
861 B
CMake
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
#
|
|
# This source code is licensed under the MIT license found in the
|
|
# LICENSE file in the root directory of this source tree.
|
|
|
|
cmake_minimum_required(VERSION 3.13)
|
|
set(CMAKE_VERBOSE_MAKEFILE on)
|
|
|
|
add_compile_options(
|
|
-fexceptions
|
|
-frtti
|
|
-std=c++17
|
|
-Wall
|
|
-Wpedantic
|
|
-Wno-gnu-zero-variadic-macro-arguments
|
|
-DFOLLY_NO_CONFIG=1
|
|
-DLOG_TAG=\"ReactNative\")
|
|
|
|
file(GLOB nativecxxmoduleexample_SRC CONFIGURE_DEPENDS *.cpp)
|
|
add_library(nativecxxmoduleexample STATIC ${nativecxxmoduleexample_SRC})
|
|
|
|
target_include_directories(nativecxxmoduleexample PUBLIC .)
|
|
target_include_directories(react_codegen_AppSpecs PUBLIC .)
|
|
|
|
target_link_libraries(nativecxxmoduleexample
|
|
fbjni
|
|
jsi
|
|
react_nativemodule_core
|
|
react_codegen_AppSpecs)
|