Skip to content

Commit a9e1f6b

Browse files
committed
feat: Add missing changes for Android build
1 parent c7a2daf commit a9e1f6b

File tree

9 files changed

+400
-86
lines changed

9 files changed

+400
-86
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,6 @@
7979
"packageManager": "[email protected]",
8080
"dependencies": {
8181
"nitrogen": "0.31.6",
82-
"react-native-nitro-modules": "0.31.6"
82+
"react-native-nitro-modules": "0.31.10"
8383
}
8484
}

packages/core-mobile/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@
200200
"react-native-mmkv": "3.2.0",
201201
"react-native-modal-datetime-picker": "18.0.0",
202202
"react-native-nitro-avalabs-crypto": "workspace:*",
203-
"react-native-nitro-modules": "0.31.6",
203+
"react-native-nitro-modules": "0.31.10",
204204
"react-native-os": "1.2.6",
205205
"react-native-pager-view": "6.7.1",
206206
"react-native-passkey": "3.1.0",
Lines changed: 43 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,57 @@
11
project(NitroAvalabsCrypto)
22
cmake_minimum_required(VERSION 3.9.0)
33

4-
set (PACKAGE_NAME NitroAvalabsCrypto)
5-
set (CMAKE_VERBOSE_MAKEFILE ON)
6-
set (CMAKE_CXX_STANDARD 20)
4+
set(PACKAGE_NAME NitroAvalabsCrypto)
5+
set(CMAKE_VERBOSE_MAKEFILE ON)
6+
set(CMAKE_CXX_STANDARD 20)
77

88
# Define C++ library and add all sources
9-
add_library(${PACKAGE_NAME} SHARED
10-
src/main/cpp/cpp-adapter.cpp
11-
)
9+
file(GLOB CPP_SOURCES "../cpp/*.cpp" "../cpp/*.hpp")
10+
add_library(${PACKAGE_NAME} SHARED src/main/cpp/cpp-adapter.cpp ${CPP_SOURCES})
1211

13-
# Add Nitrogen specs :)
12+
# Add Nitrogen specs
1413
include(${CMAKE_SOURCE_DIR}/../nitrogen/generated/android/NitroAvalabsCrypto+autolinking.cmake)
1514

1615
# Set up local includes
17-
include_directories(
18-
"src/main/cpp"
19-
"../cpp"
20-
)
16+
include_directories("src/main/cpp" "../cpp")
17+
18+
# Debug variables
19+
message("SECP256K1_ANDROID_ROOT: ${SECP256K1_ANDROID_ROOT}")
20+
message("ANDROID_ABI: ${ANDROID_ABI}")
21+
message("SECP256K1_LIB_DIR: ${SECP256K1_ANDROID_ROOT}/${ANDROID_ABI}/lib")
22+
file(GLOB LIB_FILES "${SECP256K1_ANDROID_ROOT}/${ANDROID_ABI}/lib/*")
23+
message("Files in SECP256K1_LIB_DIR: ${LIB_FILES}")
24+
25+
# Check for secp256k1 variables
26+
if(NOT DEFINED SECP256K1_INCLUDE_DIR OR NOT DEFINED SECP256K1_ANDROID_ROOT)
27+
message(FATAL_ERROR "SECP256K1 vars not provided. Ensure Gradle passes -DSECP256K1_INCLUDE_DIR and -DSECP256K1_ANDROID_ROOT.")
28+
endif()
29+
30+
# Set the library path directly
31+
set(SECP256K1_LIB_DIR "${SECP256K1_ANDROID_ROOT}/${ANDROID_ABI}/lib")
32+
file(REAL_PATH "${SECP256K1_LIB_DIR}" RESOLVED_LIB_DIR)
33+
message("Resolved SECP256K1_LIB_DIR: ${RESOLVED_LIB_DIR}")
34+
set(SECP256K1_LIB "${RESOLVED_LIB_DIR}/libsecp256k1.so")
35+
if(NOT EXISTS "${SECP256K1_LIB}")
36+
message(FATAL_ERROR "libsecp256k1.so does not exist at ${SECP256K1_LIB}")
37+
else()
38+
file(SIZE "${SECP256K1_LIB}" LIB_SIZE)
39+
message("libsecp256k1.so size: ${LIB_SIZE} bytes")
40+
if(LIB_SIZE EQUAL 0)
41+
message(FATAL_ERROR "libsecp256k1.so is empty at ${SECP256K1_LIB}")
42+
endif()
43+
message("Manually set libsecp256k1.so at: ${SECP256K1_LIB}")
44+
endif()
45+
46+
# Add headers for secp256k1
47+
include_directories("${SECP256K1_INCLUDE_DIR}")
2148

2249
find_library(LOG_LIB log)
2350

2451
# Link all libraries together
2552
target_link_libraries(
26-
${PACKAGE_NAME}
27-
${LOG_LIB}
28-
android # <-- Android core
29-
)
53+
${PACKAGE_NAME}
54+
${LOG_LIB}
55+
${SECP256K1_LIB}
56+
android
57+
)

0 commit comments

Comments
 (0)