-
Notifications
You must be signed in to change notification settings - Fork 6
/
rp2040_v6_hat_c-patch.cmake
63 lines (52 loc) · 2.46 KB
/
rp2040_v6_hat_c-patch.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# CMake minimum required version
cmake_minimum_required(VERSION 3.12)
# Find git
find_package(Git)
if(NOT Git_FOUND)
message(FATAL_ERROR "Could not find 'git' tool for RP2040-v6-HAT-C patching")
endif()
message("RP2040-v6-HAT-C patch utils found")
set(RP2040_V6_HAT_C_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
set(IO6LIBRARY_SRC_DIR "${RP2040_V6_HAT_C_SRC_DIR}/libraries/io6Library")
set(MBEDTLS_SRC_DIR "${RP2040_V6_HAT_C_SRC_DIR}/libraries/mbedtls")
set(PICO_EXTRAS_SRC_DIR "${RP2040_V6_HAT_C_SRC_DIR}/libraries/pico-extras")
set(PICO_SDK_SRC_DIR "${RP2040_V6_HAT_C_SRC_DIR}/libraries/pico-sdk")
set(PICO_SDK_TINYUSB_SRC_DIR "${RP2040_V6_HAT_C_SRC_DIR}/libraries/lib/tinyusb")
set(RP2040_HAT_C_PATCH_DIR "${RP2040_V6_HAT_C_SRC_DIR}/patches")
# Delete untracked files in io6Library
if(EXISTS "${IO6LIBRARY_SRC_DIR}/.git")
message("cleaning io6Library...")
execute_process(COMMAND ${GIT_EXECUTABLE} -C ${IO6LIBRARY_SRC_DIR} clean -fdx)
execute_process(COMMAND ${GIT_EXECUTABLE} -C ${IO6LIBRARY_SRC_DIR} reset --hard)
message("io6Library cleaned")
endif()
# Delete untracked files in mbedtls
if(EXISTS "${MBEDTLS_SRC_DIR}/.git")
message("cleaning mbedtls...")
execute_process(COMMAND ${GIT_EXECUTABLE} -C ${MBEDTLS_SRC_DIR} clean -fdx)
execute_process(COMMAND ${GIT_EXECUTABLE} -C ${MBEDTLS_SRC_DIR} reset --hard)
message("mbedtls cleaned")
endif()
# Delete untracked files in pico-extras
if(EXISTS "${PICO_EXTRAS_SRC_DIR}/.git")
message("cleaning pico-extras...")
execute_process(COMMAND ${GIT_EXECUTABLE} -C ${PICO_EXTRAS_SRC_DIR} clean -fdx)
execute_process(COMMAND ${GIT_EXECUTABLE} -C ${PICO_EXTRAS_SRC_DIR} reset --hard)
message("pico-extras cleaned")
endif()
# Delete untracked files in pico-sdk
if(EXISTS "${PICO_SDK_SRC_DIR}/.git")
message("cleaning pico-sdk...")
execute_process(COMMAND ${GIT_EXECUTABLE} -C ${PICO_SDK_SRC_DIR} clean -fdx)
execute_process(COMMAND ${GIT_EXECUTABLE} -C ${PICO_SDK_SRC_DIR} reset --hard)
message("pico-sdk cleaned")
endif()
execute_process(COMMAND ${GIT_EXECUTABLE} -C ${RP2040_V6_HAT_C_SRC_DIR} submodule update --init)
# Delete untracked files in tinyusb
if(EXISTS "${PICO_SDK_TINYUSB_SRC_DIR}/.git")
message("cleaning pico-sdk tinyusb...")
execute_process(COMMAND ${GIT_EXECUTABLE} -C ${PICO_SDK_TINYUSB_SRC_DIR} clean -fdx)
execute_process(COMMAND ${GIT_EXECUTABLE} -C ${PICO_SDK_TINYUSB_SRC_DIR} reset --hard)
message("pico-sdk tinyusb cleaned")
endif()
execute_process(COMMAND ${GIT_EXECUTABLE} -C ${PICO_SDK_SRC_DIR} submodule update --init)