Skip to content

Commit 27f3907

Browse files
committed
Add UF2TOOL_PATH CMake variable to avoid download during build time
By default, `uf2tool` source will be downloaded from `hex` mirrors. Setting `UF2TOOL_PATH` variable allow to use a local checkout of the source tree, thus removing this download at build time. Signed-off-by: Paul Guyot <pguyot@kallisys.net>
1 parent c60d126 commit 27f3907

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

doc/src/build-instructions.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,14 @@ Source code is organized as follows:
7171

7272
The `src` directory is broken up into the core platform-independent AtomVM library (`libAtomVM`), and platform-dependent code for each of the supported platforms (Generic UNIX, ESP32, and STM32).
7373

74+
## External dependencies
75+
76+
### `uf2tool`
77+
78+
AtomVM depends on `uf2tool`. It is used to pack both native and Erlang/Elixir/Gleam code for RP2. uf2tool is downloaded automatically by `rebar3` from `hex` mirrors.
79+
80+
It is possible to use a local copy of uf2tool by setting `UF2TOOL_PATH` variable to a path to a source checkout of [`uf2tool`](https://github.com/pguyot/uf2tool) when invoking CMake.
81+
7482
## Platform Specific Build Instructions
7583

7684
* [Generic UNIX](#building-for-generic-unix)

tools/uf2tool/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@
2121
cmake_minimum_required (VERSION 3.13)
2222
project (UF2Tool)
2323

24+
set(UF2TOOL_PATH "" CACHE PATH "Path to UF2Tool source tree. If unset, hex package will be used")
25+
26+
if(NOT UF2TOOL_PATH STREQUAL "")
27+
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/_checkouts)
28+
file(CREATE_LINK ${UF2TOOL_PATH} ${CMAKE_CURRENT_BINARY_DIR}/_checkouts/uf2tool SYMBOLIC)
29+
endif()
30+
2431
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/rebar.config
2532
DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
2633
)

0 commit comments

Comments
 (0)