File tree Expand file tree Collapse file tree 2 files changed +13
-7
lines changed
Expand file tree Collapse file tree 2 files changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -5,12 +5,7 @@ set(CMAKE_CXX_STANDARD 20)
55
66find_package (ReactAndroid REQUIRED CONFIG)
77find_package (hermes-engine REQUIRED CONFIG)
8-
9- add_library (weak-node-api INTERFACE )
10- target_include_directories (weak-node-api INTERFACE
11- ../../weak-node-api/generated
12- ../../weak-node-api/include
13- )
8+ find_package (weak-node-api REQUIRED CONFIG)
149
1510add_library (node-api-host SHARED
1611 src/main/cpp/OnLoad.cpp
Original file line number Diff line number Diff line change @@ -14,6 +14,17 @@ if (!System.getenv("REACT_NATIVE_OVERRIDE_HERMES_DIR")) {
1414 ]. join(' \n ' ))
1515}
1616
17+ def findWeakNodeApiDir () {
18+ def searchDir = rootDir. toPath()
19+ do {
20+ def p = searchDir. resolve(" node_modules/weak-node-api" )
21+ if (p. toFile(). exists()) {
22+ return p. toRealPath(). toString()
23+ }
24+ } while (searchDir = searchDir. getParent())
25+ throw new GradleException (" Could not find `weak-node-api`" );
26+ }
27+
1728buildscript {
1829 ext. getExtOrDefault = {name ->
1930 return rootProject. ext. has(name) ? rootProject. ext. get(name) : project. properties[' NodeApiModules_' + name]
@@ -86,7 +97,7 @@ android {
8697 cmake {
8798 targets " node-api-host"
8899 cppFlags " -frtti -fexceptions -Wall -fstack-protector-all"
89- arguments " -DANDROID_STL=c++_shared"
100+ arguments " -DANDROID_STL=c++_shared" , " -Dweak-node-api_DIR= ${ findWeakNodeApiDir() } "
90101 abiFilters (* reactNativeArchitectures())
91102
92103 buildTypes {
You can’t perform that action at this time.
0 commit comments