Skip to content

Commit

Permalink
Merge pull request #4 from mmmoussa/rn-0.71.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mateioprea authored Mar 4, 2023
2 parents 00d58b3 + aac6697 commit 06c08eb
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 334 deletions.
40 changes: 6 additions & 34 deletions android/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,64 +1,36 @@
project(reactnativerandomvaluesjsihelper)
cmake_minimum_required(VERSION 3.9.0)

set (PACKAGE_NAME "react-native-random-values-jsi-helper")
set (BUILD_DIR ${CMAKE_SOURCE_DIR}/build)
set(CMAKE_VERBOSE_MAKEFILE ON)
set(CMAKE_CXX_STANDARD 17)

include_directories(
"../cpp"
"${NODE_MODULES_DIR}/react-native/React"
"${NODE_MODULES_DIR}/react-native/React/Base"
"${NODE_MODULES_DIR}/react-native/ReactCommon/jsi"
)

if(${REACT_NATIVE_VERSION} LESS 66)
set (
INCLUDE_JSI_CPP
"${NODE_MODULES_DIR}/react-native/ReactCommon/jsi/jsi/jsi.cpp"
)
endif()

add_library(reactnativerandomvaluesjsihelper
SHARED
cpp-adapter.cpp
"../cpp/TypedArray.cpp"
${INCLUDE_JSI_CPP}
)
set_target_properties(
reactnativerandomvaluesjsihelper PROPERTIES
CXX_STANDARD 14
CXX_STANDARD 17
CXX_EXTENSIONS OFF
POSITION_INDEPENDENT_CODE ON
)

file (GLOB LIBRN_DIR "${PREBUILT_DIR}/${ANDROID_ABI}")

find_package(ReactAndroid REQUIRED CONFIG)
find_library(
log-lib
log
)
find_library(
REACT_NATIVE_JNI_LIB
reactnativejni
PATHS ${LIBRN_DIR}
NO_CMAKE_FIND_ROOT_PATH
)
if(${REACT_NATIVE_VERSION} LESS 66)
# JSI lib didn't exist on RN 0.65 and before. Simply omit it.
set (JSI_LIB "")
else()
# RN 0.66 distributes libjsi.so, can be used instead of compiling jsi.cpp manually.
find_library(
JSI_LIB
jsi
PATHS ${LIBRN_DIR}
NO_CMAKE_FIND_ROOT_PATH
)
endif()

target_link_libraries(
reactnativerandomvaluesjsihelper
${log-lib}
${JSI_LIB}
${REACT_NATIVE_JNI_LIB}
ReactAndroid::jsi
android
)
Loading

0 comments on commit 06c08eb

Please sign in to comment.