Skip to content

Commit

Permalink
fix kdf static linking on android
Browse files Browse the repository at this point in the history
  • Loading branch information
takenagain committed Jan 21, 2025
1 parent cc2167d commit 3b34b45
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 42 deletions.

This file was deleted.

13 changes: 0 additions & 13 deletions packages/komodo_defi_framework/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,6 @@ android {
// the plugin to fail to compile for some customers of the plugin.
// version "3.10.2"
}

// Link
cmake {
path = "app/src/main/cpp/CMakeLists.txt"

// The default CMake version for the Android Gradle Plugin is 3.10.2.
// https://developer.android.com/studio/projects/install-ndk#vanilla_cmake
//
// The Flutter tooling requires that developers have CMake 3.10 or later
// installed. You should not increase this version, as doing so will cause
// the plugin to fail to compile for some customers of the plugin.
// version "3.10.2"
}
}

compileOptions {
Expand Down
4 changes: 2 additions & 2 deletions packages/komodo_defi_framework/app_build/build_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
],
"platforms": {
"web": {
"matching_pattern": "^kdf_[a-f0-9]+-wasm\\.zip$",
"matching_pattern": "wasm",
"valid_zip_sha256_checksums": [
"f82e330a8d9bc1c2011604648233922cf216a732858c5a6a935ad77a286b1993"
],
Expand Down Expand Up @@ -62,7 +62,7 @@
"coins": {
"fetch_at_build_enabled": true,
"update_commit_on_build": true,
"bundled_coins_repo_commit": "eae824b3502f9da19cce891f93e8c2f98fbf534f",
"bundled_coins_repo_commit": "8a37a6cdb8f4f334f305899006b31415e3a49bf1",
"coins_repo_api_url": "https://api.github.com/repos/KomodoPlatform/coins",
"coins_repo_content_url": "https://komodoplatform.github.io/coins",
"coins_repo_branch": "master",
Expand Down
17 changes: 17 additions & 0 deletions packages/komodo_defi_framework/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,20 @@ set_target_properties(komodo_defi_framework PROPERTIES
)

target_compile_definitions(komodo_defi_framework PUBLIC DART_SHARED_LIB)

if(ANDROID)
set(KDFLIB_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../android/app/src/main/cpp/libs")
set(KDFLIB_PATH "${KDFLIB_DIR}/${ANDROID_ABI}/libmm2.a")

find_library(KDFLIB_PATH mm2 PATHS "${CMAKE_SOURCE_DIR}/path/to/library/directory" NO_DEFAULT_PATH )

if(NOT EXISTS "${KDFLIB_PATH}")
message(FATAL_ERROR "Static library '${KDFLIB_PATH}' not found. Please ensure it is present.")
endif()

target_link_libraries(komodo_defi_framework PRIVATE
"-Wl,--whole-archive"
"${KDFLIB_PATH}"
"-Wl,--no-whole-archive"
)
endif()

0 comments on commit 3b34b45

Please sign in to comment.