|
1 | 1 | cmake_minimum_required(VERSION 3.8) |
2 | 2 |
|
3 | | -file(GLOB_RECURSE WORKLETS_COMMON_CPP_SOURCES CONFIGURE_DEPENDS "${COMMON_CPP_DIR}/worklets/*.cpp") |
4 | | -file(GLOB_RECURSE WORKLETS_ANDROID_CPP_SOURCES CONFIGURE_DEPENDS "${ANDROID_CPP_DIR}/worklets/*.cpp") |
| 3 | +file(GLOB_RECURSE WORKLETS_COMMON_CPP_SOURCES CONFIGURE_DEPENDS |
| 4 | + "${COMMON_CPP_DIR}/worklets/*.cpp") |
| 5 | +file(GLOB_RECURSE WORKLETS_ANDROID_CPP_SOURCES CONFIGURE_DEPENDS |
| 6 | + "${ANDROID_CPP_DIR}/worklets/*.cpp") |
5 | 7 |
|
6 | 8 | # Consume shared libraries and headers from prefabs |
7 | 9 | find_package(fbjni REQUIRED CONFIG) |
8 | 10 | find_package(ReactAndroid REQUIRED CONFIG) |
9 | 11 |
|
10 | 12 | if(${JS_RUNTIME} STREQUAL "hermes") |
11 | | - find_package(hermes-engine REQUIRED CONFIG) |
| 13 | + find_package(hermes-engine REQUIRED CONFIG) |
12 | 14 | endif() |
13 | 15 |
|
14 | | -add_library( |
15 | | - worklets |
16 | | - SHARED |
17 | | - ${WORKLETS_COMMON_CPP_SOURCES} |
18 | | - ${WORKLETS_ANDROID_CPP_SOURCES} |
19 | | -) |
| 16 | +add_library(worklets SHARED ${WORKLETS_COMMON_CPP_SOURCES} |
| 17 | + ${WORKLETS_ANDROID_CPP_SOURCES}) |
20 | 18 |
|
21 | 19 | # includes |
22 | | -target_include_directories( |
23 | | - worklets |
24 | | - PUBLIC |
25 | | - "${COMMON_CPP_DIR}" |
26 | | - "${ANDROID_CPP_DIR}" |
27 | | -) |
| 20 | +target_include_directories(worklets PUBLIC "${COMMON_CPP_DIR}" |
| 21 | + "${ANDROID_CPP_DIR}") |
28 | 22 |
|
29 | 23 | target_include_directories( |
30 | | - worklets |
31 | | - PRIVATE |
32 | | - "${REACT_NATIVE_DIR}/ReactCommon" |
33 | | - "${REACT_NATIVE_DIR}/ReactAndroid/src/main/jni/react/turbomodule" |
34 | | - "${REACT_NATIVE_DIR}/ReactCommon/react/nativemodule/core/ReactCommon" |
35 | | - "${REACT_NATIVE_DIR}/ReactCommon/callinvoker" |
36 | | - "${REACT_NATIVE_DIR}/ReactCommon/runtimeexecutor" |
37 | | -) |
| 24 | + worklets |
| 25 | + PRIVATE "${REACT_NATIVE_DIR}/ReactCommon" |
| 26 | + "${REACT_NATIVE_DIR}/ReactAndroid/src/main/jni/react/turbomodule" |
| 27 | + "${REACT_NATIVE_DIR}/ReactCommon/react/nativemodule/core/ReactCommon" |
| 28 | + "${REACT_NATIVE_DIR}/ReactCommon/callinvoker" |
| 29 | + "${REACT_NATIVE_DIR}/ReactCommon/runtimeexecutor") |
38 | 30 |
|
39 | 31 | if(${IS_NEW_ARCHITECTURE_ENABLED}) |
40 | | - target_include_directories( |
41 | | - worklets |
42 | | - PRIVATE |
43 | | - "${REACT_NATIVE_DIR}/ReactCommon/yoga" |
44 | | - "${REACT_NATIVE_DIR}/ReactCommon/react/renderer/graphics/platform/cxx" |
45 | | - ) |
| 32 | + target_include_directories( |
| 33 | + worklets |
| 34 | + PRIVATE |
| 35 | + "${REACT_NATIVE_DIR}/ReactCommon/yoga" |
| 36 | + "${REACT_NATIVE_DIR}/ReactCommon/react/renderer/graphics/platform/cxx") |
46 | 37 |
|
47 | | - if(ReactAndroid_VERSION_MINOR LESS 76) |
48 | | - target_link_libraries( |
49 | | - worklets |
50 | | - ReactAndroid::fabricjni |
51 | | - ReactAndroid::react_debug |
52 | | - ReactAndroid::react_render_core |
53 | | - ReactAndroid::react_render_componentregistry |
54 | | - ReactAndroid::rrc_view |
55 | | - ) |
56 | | - endif() |
| 38 | + if(ReactAndroid_VERSION_MINOR LESS 76) |
| 39 | + target_link_libraries( |
| 40 | + worklets ReactAndroid::fabricjni ReactAndroid::react_debug |
| 41 | + ReactAndroid::react_render_core |
| 42 | + ReactAndroid::react_render_componentregistry ReactAndroid::rrc_view) |
| 43 | + endif() |
57 | 44 | endif() |
58 | 45 |
|
59 | 46 | # build shared lib |
60 | | -set_target_properties( |
61 | | - worklets |
62 | | - PROPERTIES |
63 | | - LINKER_LANGUAGE |
64 | | - CXX |
65 | | -) |
| 47 | +set_target_properties(worklets PROPERTIES LINKER_LANGUAGE CXX) |
66 | 48 |
|
67 | | -target_link_libraries( |
68 | | - worklets |
69 | | - log |
70 | | - ReactAndroid::jsi |
71 | | - fbjni::fbjni |
72 | | -) |
| 49 | +target_link_libraries(worklets log ReactAndroid::jsi fbjni::fbjni) |
73 | 50 |
|
74 | 51 | if(ReactAndroid_VERSION_MINOR GREATER_EQUAL 76) |
75 | | - target_link_libraries( |
76 | | - worklets |
77 | | - ReactAndroid::reactnative |
78 | | - ) |
| 52 | + target_link_libraries(worklets ReactAndroid::reactnative) |
79 | 53 | else() |
80 | | - target_link_libraries( |
81 | | - worklets |
82 | | - ReactAndroid::react_nativemodule_core |
83 | | - ReactAndroid::folly_runtime |
84 | | - ReactAndroid::glog |
85 | | - ReactAndroid::reactnativejni |
86 | | - ) |
| 54 | + target_link_libraries( |
| 55 | + worklets ReactAndroid::react_nativemodule_core ReactAndroid::folly_runtime |
| 56 | + ReactAndroid::glog ReactAndroid::reactnativejni) |
87 | 57 | endif() |
88 | 58 |
|
89 | 59 | if(${JS_RUNTIME} STREQUAL "hermes") |
90 | | - target_link_libraries( |
91 | | - worklets |
92 | | - hermes-engine::libhermes |
93 | | - ) |
| 60 | + target_link_libraries(worklets hermes-engine::libhermes) |
94 | 61 |
|
95 | | - if(${HERMES_ENABLE_DEBUGGER}) |
96 | | - if(ReactAndroid_VERSION_MINOR GREATER_EQUAL 76) |
97 | | - target_link_libraries( |
98 | | - worklets |
99 | | - ReactAndroid::hermestooling |
100 | | - ) |
101 | | - else() |
102 | | - target_link_libraries( |
103 | | - worklets |
104 | | - ReactAndroid::hermes_executor |
105 | | - ) |
106 | | - endif() |
107 | | - endif() |
108 | | -elseif(${JS_RUNTIME} STREQUAL "jsc") |
| 62 | + if(${HERMES_ENABLE_DEBUGGER}) |
109 | 63 | if(ReactAndroid_VERSION_MINOR GREATER_EQUAL 76) |
110 | | - target_link_libraries( |
111 | | - worklets |
112 | | - ReactAndroid::jsctooling |
113 | | - ) |
| 64 | + target_link_libraries(worklets ReactAndroid::hermestooling) |
114 | 65 | else() |
115 | | - target_link_libraries( |
116 | | - worklets |
117 | | - ReactAndroid::jscexecutor |
118 | | - ) |
| 66 | + target_link_libraries(worklets ReactAndroid::hermes_executor) |
119 | 67 | endif() |
| 68 | + endif() |
| 69 | +elseif(${JS_RUNTIME} STREQUAL "jsc") |
| 70 | + if(ReactAndroid_VERSION_MINOR GREATER_EQUAL 76) |
| 71 | + target_link_libraries(worklets ReactAndroid::jsctooling) |
| 72 | + else() |
| 73 | + target_link_libraries(worklets ReactAndroid::jscexecutor) |
| 74 | + endif() |
120 | 75 | elseif(${JS_RUNTIME} STREQUAL "v8") |
121 | | - # TODO: Refactor this when adding support for newest V8 |
122 | | - target_include_directories( |
123 | | - worklets |
124 | | - PRIVATE |
125 | | - "${JS_RUNTIME_DIR}/src" |
126 | | - ) |
127 | | - file(GLOB V8_SO_DIR "${JS_RUNTIME_DIR}/android/build/intermediates/library_jni/**/jni/${ANDROID_ABI}") |
128 | | - find_library( |
129 | | - V8EXECUTOR_LIB |
130 | | - v8executor |
131 | | - PATHS ${V8_SO_DIR} |
132 | | - NO_DEFAULT_PATH |
133 | | - NO_CMAKE_FIND_ROOT_PATH |
134 | | - ) |
135 | | - target_link_libraries( |
136 | | - worklets |
137 | | - ${V8EXECUTOR_LIB} |
138 | | - ) |
| 76 | + # TODO: Refactor this when adding support for newest V8 |
| 77 | + target_include_directories(worklets PRIVATE "${JS_RUNTIME_DIR}/src") |
| 78 | + file( |
| 79 | + GLOB |
| 80 | + V8_SO_DIR |
| 81 | + "${JS_RUNTIME_DIR}/android/build/intermediates/library_jni/**/jni/${ANDROID_ABI}" |
| 82 | + ) |
| 83 | + find_library( |
| 84 | + V8EXECUTOR_LIB v8executor |
| 85 | + PATHS ${V8_SO_DIR} |
| 86 | + NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) |
| 87 | + target_link_libraries(worklets ${V8EXECUTOR_LIB}) |
139 | 88 | endif() |
0 commit comments