fix: Fix "REACT_NATIVE_UTILS_LIB not found" build error (#295)

* Remove `REACT_NATIVE_UTILS_LIB`

* Clean up CMakeLists.txt
This commit is contained in:
Marc Rousavy 2021-07-23 14:28:38 +02:00 committed by GitHub
parent 01104e0932
commit 5eaed05f47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -54,12 +54,32 @@ target_include_directories(
# find libraries # find libraries
file (GLOB LIBRN_DIR "${BUILD_DIR}/react-native-0*/jni/${ANDROID_ABI}") file (GLOB LIBRN_DIR "${BUILD_DIR}/react-native-0*/jni/${ANDROID_ABI}")
file (GLOB LIBJSC_DIR "${BUILD_DIR}/android-jsc*.aar/jni/${ANDROID_ABI}")
file (GLOB LIBHERMES_DIR "${BUILD_DIR}/third-party-ndk/hermes/jni/${ANDROID_ABI}")
if(${FOR_HERMES}) if(${FOR_HERMES})
else()
endif()
if(${FOR_HERMES})
file (GLOB LIBHERMES_DIR "${BUILD_DIR}/third-party-ndk/hermes/jni/${ANDROID_ABI}")
# Use Hermes
find_library(
JS_ENGINE_LIB
hermes
PATHS ${LIBHERMES_DIR}
NO_CMAKE_FIND_ROOT_PATH
)
# Use Reanimated Hermes
file (GLOB LIBREANIMATED_DIR "${BUILD_DIR}/react-native-reanimated-*-hermes.aar/jni/${ANDROID_ABI}") file (GLOB LIBREANIMATED_DIR "${BUILD_DIR}/react-native-reanimated-*-hermes.aar/jni/${ANDROID_ABI}")
else() else()
file (GLOB LIBJSC_DIR "${BUILD_DIR}/android-jsc*.aar/jni/${ANDROID_ABI}")
# Use JSC
find_library(
JS_ENGINE_LIB
jscexecutor
PATHS ${LIBRN_DIR}
NO_CMAKE_FIND_ROOT_PATH
)
# Use Reanimated JSC
file (GLOB LIBREANIMATED_DIR "${BUILD_DIR}/react-native-reanimated-*-jsc.aar/jni/${ANDROID_ABI}") file (GLOB LIBREANIMATED_DIR "${BUILD_DIR}/react-native-reanimated-*-jsc.aar/jni/${ANDROID_ABI}")
endif() endif()
@ -95,52 +115,16 @@ find_library(
NO_CMAKE_FIND_ROOT_PATH NO_CMAKE_FIND_ROOT_PATH
) )
find_library(
REACT_NATIVE_UTILS_LIB
reactnativeutilsjni
PATHS ${LIBRN_DIR}
NO_CMAKE_FIND_ROOT_PATH
)
find_library(
HERMES_LIB
hermes
PATHS ${LIBHERMES_DIR}
NO_CMAKE_FIND_ROOT_PATH
)
find_library(
JSEXECUTOR_LIB
jscexecutor
PATHS ${LIBRN_DIR}
NO_CMAKE_FIND_ROOT_PATH
)
# linking # linking
message(WARNING "VisionCamera linking: FOR_HERMES=${FOR_HERMES}") message(WARNING "VisionCamera linking: FOR_HERMES=${FOR_HERMES}")
target_link_libraries(
if(${FOR_HERMES}) ${PACKAGE_NAME}
target_link_libraries( ${LOG_LIB}
${PACKAGE_NAME} ${JS_ENGINE_LIB} # <-- Hermes or JSC
${LOG_LIB} ${REANIMATED_LIB}
${HERMES_LIB} ${REACT_NATIVE_JNI_LIB}
${REANIMATED_LIB} ${FBJNI_LIB}
${REACT_NATIVE_JNI_LIB} ${FOLLY_JSON_LIB}
${REACT_NATIVE_UTILS_LIB} android
${FBJNI_LIB} )
${FOLLY_JSON_LIB}
android
)
else()
target_link_libraries(
${PACKAGE_NAME}
${LOG_LIB}
${JSEXECUTOR_LIB}
${REANIMATED_LIB}
${REACT_NATIVE_JNI_LIB}
${REACT_NATIVE_UTILS_LIB}
${FBJNI_LIB}
${FOLLY_JSON_LIB}
android
)
endif()