Skip to content

Commit

Permalink
[Kotlin] Fix CMakeLists for Android (#2929)
Browse files Browse the repository at this point in the history
  • Loading branch information
MaximPestryakov authored Feb 14, 2023
1 parent 428290c commit 9998a8a
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,22 +53,27 @@ if (${ANDROID})
message("Configuring for JNI")
file(GLOB_RECURSE core_sources src/*.c src/*.cc src/*.cpp src/*.h jni/cpp/*.c jni/cpp/*.cpp jni/cpp/*.h)
if (${KOTLIN})
file(GLOB_RECURSE specific_sources jni/kotlin/*.h jni/kotlin/*.c)
file(GLOB_RECURSE specific_sources
jni/kotlin/*.h
jni/kotlin/*.c
kotlin/wallet-core-kotlin/src/androidMain/cpp/generated/*.h
kotlin/wallet-core-kotlin/src/androidMain/cpp/generated/*.c
)
else ()
file(GLOB_RECURSE specific_sources jni/android/*.h jni/android/*.c)
endif()
endif ()
set(sources ${core_sources} ${specific_sources})
add_library(TrustWalletCore SHARED ${sources} ${PROTO_SRCS} ${PROTO_HDRS})
find_library(log-lib log)
if (${CMAKE_ANDROID_ARCH_ABI} STREQUAL "arm64-v8a")
set(WALLET_CORE_BINDGEN ${WALLET_CORE_RS_TARGET_DIR}/aarch64-linux-android/release/${WALLET_CORE_RS_LIB})
elseif(${CMAKE_ANDROID_ARCH_ABI} STREQUAL "x86")
elseif (${CMAKE_ANDROID_ARCH_ABI} STREQUAL "x86")
set(WALLET_CORE_BINDGEN ${WALLET_CORE_RS_TARGET_DIR}/i686-linux-android/release/${WALLET_CORE_RS_LIB})
elseif(${CMAKE_ANDROID_ARCH_ABI} STREQUAL "armeabi-v7a")
elseif (${CMAKE_ANDROID_ARCH_ABI} STREQUAL "armeabi-v7a")
set(WALLET_CORE_BINDGEN ${WALLET_CORE_RS_TARGET_DIR}/armv7-linux-androideabi/release/${WALLET_CORE_RS_LIB})
elseif(${CMAKE_ANDROID_ARCH_ABI} STREQUAL "x86_64")
elseif (${CMAKE_ANDROID_ARCH_ABI} STREQUAL "x86_64")
set(WALLET_CORE_BINDGEN ${WALLET_CORE_RS_TARGET_DIR}/x86_64-linux-android/release/${WALLET_CORE_RS_LIB})
endif()
endif ()
target_link_libraries(TrustWalletCore PUBLIC ${WALLET_CORE_BINDGEN} ${PROJECT_NAME}_INTERFACE PRIVATE TrezorCrypto protobuf ${log-lib} Boost::boost)
else ()
message("Configuring standalone")
Expand Down Expand Up @@ -118,11 +123,11 @@ if (TW_UNITY_BUILD)
set_target_properties(TrustWalletCore PROPERTIES UNITY_BUILD ON)

file(GLOB_RECURSE PROTOBUF_SOURCE_FILES CONFIGURE_DEPENDS src/Cosmos/Protobuf/*.pb.cc src/Hedera/Protobuf/*.pb.cc src/proto/*.pb.cc)
foreach(file ${PROTOBUF_SOURCE_FILES})
foreach (file ${PROTOBUF_SOURCE_FILES})
set_property(SOURCE ${file} PROPERTY SKIP_UNITY_BUILD_INCLUSION ON)
endforeach()
endforeach ()
message(STATUS "Unity build activated")
endif()
endif ()

configure_file(${CMAKE_CURRENT_SOURCE_DIR}/swift/cpp.xcconfig.in ${CMAKE_CURRENT_SOURCE_DIR}/swift/cpp.xcconfig @ONLY)

Expand Down

0 comments on commit 9998a8a

Please sign in to comment.