Skip to content

Commit

Permalink
Merge pull request #168 from keepkey/smarter-ethereum_tokens-update-l…
Browse files Browse the repository at this point in the history
…ogic

build: update ethereum_tokens.def only if it changed
  • Loading branch information
keepkeyjon authored Sep 17, 2019
2 parents 6a00882 + 1935644 commit 6f0422f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/firmware/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,13 @@ include_directories(
add_library(kkfirmware ${sources})
add_dependencies(kkfirmware kktransport.pb trezorcrypto qrcodegenerator ethereum_tokens.def)

file(GLOB_RECURSE ethereum_tokens_json ${CMAKE_SOURCE_DIR}/deps/python-keepkey/keepkeylib/eth/dist/tokens/*.*)
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/include/keepkey/firmware/ethereum_tokens.def
DEPENDS ${ethereum_tokens_json}
set(ETHEREUM_TOKENS ${CMAKE_BINARY_DIR}/include/keepkey/firmware/ethereum_tokens)

add_custom_command(OUTPUT ${ETHEREUM_TOKENS}.def ${ETHEREUM_TOKENS}.phony
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/include/keepkey/firmware
COMMAND python ${CMAKE_SOURCE_DIR}/deps/python-keepkey/keepkeylib/eth/ethereum_tokens.py ${CMAKE_BINARY_DIR}/include/keepkey/firmware/ethereum_tokens.def)
COMMAND test -f ${ETHEREUM_TOKENS}.def || touch ${ETHEREUM_TOKENS}.def
COMMAND python ${CMAKE_SOURCE_DIR}/deps/python-keepkey/keepkeylib/eth/ethereum_tokens.py ${ETHEREUM_TOKENS}.temp
COMMAND diff -q ${ETHEREUM_TOKENS}.temp ${ETHEREUM_TOKENS}.def || cp ${ETHEREUM_TOKENS}.temp ${ETHEREUM_TOKENS}.def)

add_custom_target(ethereum_tokens.def
DEPENDS ${CMAKE_BINARY_DIR}/include/keepkey/firmware/ethereum_tokens.def)
Expand Down

0 comments on commit 6f0422f

Please sign in to comment.