-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
123 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,51 @@ | ||
message(STATUS "compile rust") | ||
|
||
set(CARGO_ARM_TARGET thumbv7em-none-eabihf) | ||
set(RUST_DIR ${CMAKE_SOURCE_DIR}/rust) | ||
|
||
find_program(RUST_CARGO_EXECUTABLE cargo) | ||
find_program(BINDGEN_EXE bindgen) | ||
find_program(CBINDGEN_EXE cbindgen) | ||
include(rust_c.cmake) | ||
|
||
if(NOT BUILD_TYPE STREQUAL "Simulator") | ||
set(TARGET_PATH ${CMAKE_BINARY_DIR}/rust-builds) | ||
if(BTC_ONLY) | ||
set(CARGO_FLAG --release --target ${CARGO_ARM_TARGET} -p rust_c --no-default-features --features firmware-btc-only) | ||
else() | ||
set(CARGO_FLAG --release --target ${CARGO_ARM_TARGET} -p rust_c --no-default-features --features firmware) | ||
endif() | ||
|
||
|
||
if(DEFINED DEBUG_MEMORY) | ||
message(STATUS "build with DEBUG_MEMORY") | ||
set(CARGO_FLAG ${CARGO_FLAG} --features debug-memory) | ||
endif() | ||
|
||
message(STATUS "cargo build command: " ${CARGO_FLAG}) | ||
message(STATUS ${TARGET_PATH}) | ||
|
||
set(COPY_COMMAND cp ${RUST_DIR}/target/${CARGO_ARM_TARGET}/release/${LIB_NAME} ${TARGET_PATH}) | ||
|
||
add_custom_target(rust_c ALL | ||
COMMAND ${CBINDGEN_EXE} ${CBINDGEN_FLAG} | ||
COMMAND rustup run nightly-2023-12-01 ${RUST_CARGO_EXECUTABLE} build ${CARGO_FLAG} | ||
COMMAND ${COPY_COMMAND} | ||
WORKING_DIRECTORY ${RUST_DIR} | ||
) | ||
else() | ||
set(TARGET_PATH ${CMAKE_SOURCE_DIR}/ui_simulator/lib/rust-builds) | ||
endif() | ||
if(BTC_ONLY) | ||
set(CARGO_FLAG --release -p rust_c --no-default-features --features simulator_btc_only) | ||
else() | ||
set(CARGO_FLAG --release -p rust_c --no-default-features --features simulator) | ||
endif() | ||
|
||
message(STATUS "build target path: " ${TARGET_PATH}) | ||
if(DEFINED DEBUG_MEMORY) | ||
message(STATUS "build with DEBUG_MEMORY") | ||
set(CARGO_FLAG ${CARGO_FLAG} --features debug-memory) | ||
endif() | ||
|
||
option(LIB_RUST_C "Set to switch to Compile the RUST_C library" OFF) | ||
message(STATUS "Cargo Flags: ${CARGO_FLAG}") | ||
|
||
if(NOT EXISTS ${TARGET_PATH}) | ||
file(MAKE_DIRECTORY ${TARGET_PATH}) | ||
endif() | ||
set(COPY_COMMAND cp ${RUST_DIR}/target/release/${LIB_NAME} ${TARGET_PATH}) | ||
|
||
add_subdirectory(rust_c) | ||
add_custom_target(rust_c ALL | ||
COMMAND ${CBINDGEN_EXE} ${CBINDGEN_FLAG} | ||
COMMAND rustup run nightly-2023-12-01 ${RUST_CARGO_EXECUTABLE} build ${CARGO_FLAG} | ||
COMMAND ${COPY_COMMAND} | ||
WORKING_DIRECTORY ${RUST_DIR} | ||
) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,23 +66,6 @@ app_utils = { path = "apps/utils" } | |
app_wallets = { path = "apps/wallets" } | ||
app_xrp = { path = "apps/xrp" } | ||
|
||
aptos_rust_c = { path = "rust_c/src/aptos" } | ||
arweave_rust_c = { path = "rust_c/src/arweave" } | ||
bitcoin_rust_c = { path = "rust_c/src/bitcoin", default-features = false } | ||
cardano_rust_c = { path = "rust_c/src/cardano" } | ||
common_rust_c = { path = "rust_c/src/common", default-features = false } | ||
cosmos_rust_c = { path = "rust_c/src/cosmos" } | ||
ethereum_rust_c = { path = "rust_c/src/ethereum" } | ||
near_rust_c = { path = "rust_c/src/near" } | ||
solana_rust_c = { path = "rust_c/src/solana" } | ||
stellar_rust_c = { path = "rust_c/src/stellar" } | ||
sui_rust_c = { path = "rust_c/src/sui" } | ||
ton_rust_c = { path = "rust_c/src/ton" } | ||
tron_rust_c = { path = "rust_c/src/tron" } | ||
xrp_rust_c = { path = "rust_c/src/xrp" } | ||
wallet_rust_c = { path = "rust_c/src/wallet", default-features = false } | ||
simulator_rust_c = { path = "rust_c/src/simulator", default-features = false } | ||
|
||
keystore = { path = "keystore", default-features = false } | ||
tools = { path = "tools" } | ||
sim_qr_reader = { path = "sim_qr_reader" } | ||
|
@@ -112,7 +95,7 @@ ur-parse-lib = { git = "https://[email protected]/KeystoneHQ/keystone-sdk-rust.git" | |
ed25519-bip32-core = { version = "0.1.1", default-features = false } | ||
cryptoxide = "0.4" | ||
arrayref = "0.3.6" | ||
num-bigint-dig = { version = "0.8.2", default-features=false } | ||
num-bigint-dig = { version = "0.8.2", default-features = false } | ||
base64 = { version = "0.11.0", default-features = false, features = ["alloc"] } | ||
unicode-blocks = "0.1.6" | ||
bcs = { git = "https://github.com/KeystoneHQ/bcs.git", tag = "0.1.1" } | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
set(LIB_NAME librust_c.a) | ||
|
||
find_program(RUST_CARGO_EXECUTABLE cargo) | ||
find_program(BINDGEN_EXE bindgen) | ||
find_program(CBINDGEN_EXE cbindgen) | ||
|
||
if(NOT BUILD_TYPE STREQUAL "Simulator") | ||
set(TARGET_PATH ${CMAKE_BINARY_DIR}/rust-builds) | ||
else() | ||
set(TARGET_PATH ${CMAKE_SOURCE_DIR}/ui_simulator/lib/rust-builds) | ||
endif() | ||
|
||
message(STATUS "build target path: " ${TARGET_PATH}) | ||
|
||
option(LIB_RUST_C "Set to switch to Compile the RUST_C library" OFF) | ||
|
||
if(NOT EXISTS ${TARGET_PATH}) | ||
file(MAKE_DIRECTORY ${TARGET_PATH}) | ||
endif() | ||
|
||
set(RUST_DIR ${CMAKE_SOURCE_DIR}/rust) | ||
set(RUST_C_DIR ${RUST_DIR}/rust_c) | ||
set(CARGO_ARM_TARGET thumbv7em-none-eabihf) | ||
|
||
if(COMPILE_SIMULATOR) | ||
if(BTC_ONLY) | ||
set(CBINDGEN_CONFIG_PATH ${RUST_C_DIR}/cbindgens/simulator/btc_only.toml) | ||
else() | ||
set(CBINDGEN_CONFIG_PATH ${RUST_C_DIR}/cbindgens/simulator/multi_coin.toml) | ||
endif() | ||
else() | ||
if(BTC_ONLY) | ||
set(CBINDGEN_CONFIG_PATH ${RUST_C_DIR}/cbindgens/release/btc_only.toml) | ||
else() | ||
set(CBINDGEN_CONFIG_PATH ${RUST_C_DIR}/cbindgens/release/multi_coin.toml) | ||
endif() | ||
endif() | ||
set(CBINDGEN_FLAG ${RUST_C_DIR} --config ${CBINDGEN_CONFIG_PATH} --output ${TARGET_PATH}/librust_c.h --lang c) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.