Skip to content

Commit d54bf53

Browse files
committed
Initial Release
0 parents  commit d54bf53

14 files changed

+4681
-0
lines changed

CMakeLists.txt

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
cmake_minimum_required(VERSION 3.12)
2+
3+
project(picotool)
4+
5+
if (DEFINED ENV{PICO_SDK_PATH} AND (NOT PICO_SDK_PATH))
6+
set(PICO_SDK_PATH $ENV{PICO_SDK_PATH})
7+
message("Using PICO_SDK_PATH from environment ('${PICO_SDK_PATH}')")
8+
endif ()
9+
if (NOT PICO_SDK_PATH)
10+
message(FATAL_ERROR "PICO_SDK_PATH is not defined")
11+
endif()
12+
get_filename_component(PICO_SDK_PATH "${PICO_SDK_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}")
13+
if (NOT EXISTS ${PICO_SDK_PATH})
14+
message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' not found")
15+
endif ()
16+
17+
set(CMAKE_CXX_STANDARD 14)
18+
19+
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake)
20+
21+
add_subdirectory(picoboot_connection)
22+
23+
find_package(LIBUSB)
24+
if (NOT LIBUSB_FOUND)
25+
message(FATAL_ERROR "picotool cannot be built because libUSB is not found")
26+
else()
27+
add_subdirectory(${PICO_SDK_PATH}/src/common/pico_binary_info pico_binary_info)
28+
add_subdirectory(${PICO_SDK_PATH}/src/common/boot_uf2 boot_uf2_headers)
29+
add_subdirectory(${PICO_SDK_PATH}/src/common/boot_picoboot boot_picoboot_headers)
30+
add_subdirectory(${PICO_SDK_PATH}/src/host/pico_platform pico_platform)
31+
32+
add_executable(picotool main.cpp)
33+
target_include_directories(picotool PRIVATE ${LIBUSB_INCLUDE_DIR})
34+
target_link_libraries(picotool pico_binary_info boot_uf2_headers boot_picoboot_headers pico_platform_headers picoboot_connection_cxx ${LIBUSB_LIBRARIES})
35+
endif()

0 commit comments

Comments
 (0)