@@ -2,30 +2,10 @@ cmake_minimum_required(VERSION 3.4.1)
22
33set (CMAKE_VERBOSE_MAKEFILE ON )
44set (CMAKE_CXX_STANDARD 14)
5- set (PACKAGE_NAME "rnmultithreading" )
6- set (build_DIR ${CMAKE_SOURCE_DIR} /build )
7-
8- # fbjni
5+ set (CMAKE_CXX_FLAGS "-DFOLLY_NO_CONFIG=1 -DFOLLY_HAVE_CLOCK_GETTIME=1 -DFOLLY_HAVE_MEMRCHR=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_MOBILE=1" )
96
10- file (GLOB libfbjni_link_DIRS "${build_DIR} /fbjni*.aar/jni/${ANDROID_ABI} " )
11- file (GLOB libfbjni_include_DIRS "${build_DIR} /fbjni-*-headers.jar/" )
12-
13- # includes
14-
15- include_directories (
16- "${RN_ANDROID_ROOT_DIR} /../node_modules/react-native/React"
17- "${RN_ANDROID_ROOT_DIR} /../node_modules/react-native/React/Base"
18- "${RN_ANDROID_ROOT_DIR} /../node_modules/react-native/ReactCommon"
19- "${RN_ANDROID_ROOT_DIR} /../node_modules/react-native/ReactCommon/callinvoker"
20- "${RN_ANDROID_ROOT_DIR} /../node_modules/react-native/ReactCommon/jsi"
21- "${RN_ANDROID_ROOT_DIR} /../node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/jni"
22- "${RN_ANDROID_ROOT_DIR} /../node_modules/react-native/ReactAndroid/src/main/jni"
23- "${RN_ANDROID_ROOT_DIR} /../node_modules/react-native-reanimated/Common/cpp/headers/Tools"
24- "${RN_ANDROID_ROOT_DIR} /../node_modules/react-native-reanimated/Common/cpp/headers/SpecTools"
25- "${RN_ANDROID_ROOT_DIR} /../node_modules/react-native-reanimated/Common/cpp/headers/SharedItems"
26- "${RN_ANDROID_ROOT_DIR} /../node_modules/react-native-reanimated/Common/cpp/headers/Registries"
27- "../cpp"
28- )
7+ set (PACKAGE_NAME "rnmultithreading" )
8+ set (BUILD_DIR ${CMAKE_SOURCE_DIR} /build )
299
3010# rnmultithreading shared
3111
@@ -38,51 +18,71 @@ add_library(
3818 ../cpp/ThreadPool.cpp
3919)
4020
41- # reanimated shared
42-
43- add_library (
44- reanimated
45- SHARED
46- IMPORTED
47- )
48- set_target_properties (
49- reanimated
50- PROPERTIES IMPORTED_LOCATION
51- ${CMAKE_SOURCE_DIR} /ndk-deps/reanimated/jni/${ANDROID_ABI} /libreanimated.so
52- )
21+ # includes
5322
54- # jsc shared
23+ file (GLOB LIBFBJNI_INCLUDE_DIR " ${BUILD_DIR} /fbjni-*-headers.jar/" )
5524
56- add_library (
57- jsc
58- SHARED
59- IMPORTED
60- )
61- set_target_properties (
62- jsc
63- PROPERTIES IMPORTED_LOCATION
64- ${CMAKE_SOURCE_DIR} /ndk-deps//jsc/jni/${ANDROID_ABI} /libjsc.so
25+ target_include_directories (
26+ ${PACKAGE_NAME}
27+ PRIVATE
28+ ${LIBFBJNI_INCLUDE_DIR}
29+ ${BUILD_DIR} /third-party-ndk/boost
30+ ${BUILD_DIR} /third-party-ndk/double-conversion
31+ ${BUILD_DIR} /third-party-ndk/folly
32+ ${BUILD_DIR} /third-party-ndk/glog
33+ "${NODE_MODULES_DIR} /react-native/React"
34+ "${NODE_MODULES_DIR} /react-native/React/Base"
35+ "${NODE_MODULES_DIR} /react-native/ReactAndroid/src/main/jni"
36+ "${NODE_MODULES_DIR} /react-native/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/jni"
37+ "${NODE_MODULES_DIR} /react-native/ReactCommon"
38+ "${NODE_MODULES_DIR} /react-native/ReactCommon/callinvoker"
39+ "${NODE_MODULES_DIR} /react-native/ReactCommon/jsi"
40+ "${NODE_MODULES_DIR} /react-native/ReactCommon/jsi"
41+ "${NODE_MODULES_DIR} /react-native-reanimated/Common/cpp/headers/Tools"
42+ "${NODE_MODULES_DIR} /react-native-reanimated/Common/cpp/headers/SpecTools"
43+ "${NODE_MODULES_DIR} /react-native-reanimated/Common/cpp/headers/SharedItems"
44+ "${NODE_MODULES_DIR} /react-native-reanimated/Common/cpp/headers/Registries"
45+ "${NODE_MODULES_DIR} /react-native-reanimated/Common/cpp/hidden_headers"
46+ "../cpp"
6547)
6648
67- # rn shared
49+ # find libraries
6850
69- add_library (
70- rn
71- SHARED
72- IMPORTED
73- )
74- set_target_properties (
75- rn
76- PROPERTIES IMPORTED_LOCATION
77- ${CMAKE_SOURCE_DIR} /ndk-deps/rn/jni/${ANDROID_ABI} /libjscexecutor.so
78- )
51+ file (GLOB LIBRN_DIR "${BUILD_DIR} /react-native-0*/jni/${ANDROID_ABI} " )
52+ file (GLOB LIBJSC_DIR "${BUILD_DIR} /android-jsc*.aar/jni/${ANDROID_ABI} " )
53+ file (GLOB LIBREANIMATED_DIR "${BUILD_DIR} /react-native-reanimated-*.aar/jni/${ANDROID_ABI} " )
7954
80- # find packages
8155
8256find_library (
83- log -lib
57+ LOG_LIB
8458 log
8559)
60+ find_library (
61+ FBJNI_LIB
62+ fbjni
63+ PATHS ${LIBRN_DIR}
64+ NO_CMAKE_FIND_ROOT_PATH
65+ )
66+ find_library (
67+ JSEXECUTOR_LIB
68+ jscexecutor
69+ PATHS ${LIBRN_DIR}
70+ NO_CMAKE_FIND_ROOT_PATH
71+ )
72+ find_library (
73+ JSC_LIB
74+ jsc
75+ PATHS ${LIBJSC_DIR}
76+ NO_CMAKE_FIND_ROOT_PATH
77+ )
78+ find_library (
79+ REANIMATED_LIB
80+ reanimated
81+ PATHS ${LIBREANIMATED_DIR}
82+ NO_CMAKE_FIND_ROOT_PATH
83+ )
84+
85+ # linking
8686
8787find_library (
8888 FBJNI_LIBRARY fbjni
@@ -92,17 +92,12 @@ find_library(
9292
9393# build shared lib
9494
95- target_include_directories (
96- ${PACKAGE_NAME} PRIVATE
97- ${libfbjni_include_DIRS}
98- )
99-
10095target_link_libraries (
10196 ${PACKAGE_NAME}
102- reanimated
103- jsc
104- rn
105- ${FBJNI_LIBRARY }
106- ${log -lib }
97+ ${LOG_LIB}
98+ ${REANIMATED_LIB}
99+ ${JSC_LIB}
100+ ${JSEXECUTOR_LIB }
101+ ${FBJNI_LIB }
107102 android
108- )
103+ )
0 commit comments