Skip to content

Commit

Permalink
feat: Added an updater script for CMake
Browse files Browse the repository at this point in the history
  • Loading branch information
massonal committed Aug 12, 2022
1 parent b31bbf3 commit fe5794c
Show file tree
Hide file tree
Showing 17 changed files with 113 additions and 17 deletions.
2 changes: 1 addition & 1 deletion cmake/boards_db.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ set(ACSIP_S76S_MCU cortex-m0plus)
set(ACSIP_S76S_FPCONF "-")
add_library(ACSIP_S76S INTERFACE)
target_compile_options(ACSIP_S76S INTERFACE
"SHELL:-DSTM32L073xx -D__CORTEX_SC=0"
"SHELL:-DSTM32L073xx "
"SHELL:-DCUSTOM_PERIPHERAL_PINS"
"SHELL:"
"SHELL: "
Expand Down
44 changes: 44 additions & 0 deletions cmake/scripts/cmake_updater_hook.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/usr/bin/env python3

"""
This file centralizes all the operations needed to regenerate the CMakeLists.txt scattered along this repo.
Hint: it would be a good practice to run it before committing...
"""

import subprocess
import pathlib

script_dir = pathlib.Path(__file__).parent # Arduino_Core_STM32/cmake/scripts
base_dir = script_dir.parent.parent # Arduino_Core_STM32
script_dir = pathlib.Path(__file__).parent # Arduino_Core_STM32/cmake/scripts
templates_dir = base_dir/"cmake"/"templates"

print("Updating core/arduino...")
subprocess.run(
("python3", script_dir/"cmake_core.py", base_dir/"cores"/"arduino"),
check=True,
)

print("Updating libraries/...")
subprocess.run(
("python3", script_dir/"cmake_libs.py", "-L", base_dir/"libraries"),
check=True,
)

print("Updating variants/...")
subprocess.run(
("python3", script_dir/"cmake_variant.py", base_dir/"variants"),
check=True,
)
print("Updating board database...")
subprocess.run(
("python3", script_dir/"parse_boards.py",
"-b", base_dir/"boards.txt",
"-p", base_dir/"platform.txt",
"-t", templates_dir/"boards_db.cmake",
"-o", base_dir/"cmake"/"boards_db.cmake",
),
check=True,
)

print("All done !")
3 changes: 0 additions & 3 deletions cores/arduino/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ target_link_libraries(core INTERFACE core_usage)

add_library(core_bin STATIC EXCLUDE_FROM_ALL
HardwareSerial.cpp
HardwareTimer.cpp
IPAddress.cpp
Print.cpp
RingBuffer.cpp
Expand All @@ -35,11 +34,9 @@ add_library(core_bin STATIC EXCLUDE_FROM_ALL
abi.cpp
avr/dtostrf.c
board.c
core_debug.c
hooks.c
itoa.c
main.cpp
new.cpp
pins_arduino.c
stm32/OpenAMP/libmetal/device.c
stm32/OpenAMP/libmetal/generic/condition.c
Expand Down
3 changes: 3 additions & 0 deletions libraries/SrcWrapper/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ add_library(SrcWrapper_bin OBJECT EXCLUDE_FROM_ALL
src/HAL/stm32yyxx_hal_gfxmmu.c
src/HAL/stm32yyxx_hal_gpio.c
src/HAL/stm32yyxx_hal_gpio_ex.c
src/HAL/stm32yyxx_hal_gpu2d.c
src/HAL/stm32yyxx_hal_gtzc.c
src/HAL/stm32yyxx_hal_hash.c
src/HAL/stm32yyxx_hal_hash_ex.c
Expand Down Expand Up @@ -130,6 +131,8 @@ add_library(SrcWrapper_bin OBJECT EXCLUDE_FROM_ALL
src/HAL/stm32yyxx_hal_usart.c
src/HAL/stm32yyxx_hal_usart_ex.c
src/HAL/stm32yyxx_hal_wwdg.c
src/HAL/stm32yyxx_hal_xspi.c
src/HardwareTimer.cpp
src/LL/stm32yyxx_ll_adc.c
src/LL/stm32yyxx_ll_bdma.c
src/LL/stm32yyxx_ll_comp.c
Expand Down
6 changes: 5 additions & 1 deletion variants/STM32G4xx/GBK1CBT/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# v3.21 implemented semantic changes regarding $<TARGET_OBJECTS:...>
# See https://cmake.org/cmake/help/v3.21/command/target_link_libraries.html#linking-object-libraries-via-target-objects
cmake_minimum_required(VERSION 3.21)

add_library(variant INTERFACE)
add_library(variant_usage INTERFACE)

Expand All @@ -7,7 +11,7 @@ target_include_directories(variant_usage INTERFACE


target_link_libraries(variant_usage INTERFACE
core_config
base_config
)

target_link_libraries(variant INTERFACE variant_usage)
Expand Down
6 changes: 5 additions & 1 deletion variants/STM32H7xx/H725V(E-G)H/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# v3.21 implemented semantic changes regarding $<TARGET_OBJECTS:...>
# See https://cmake.org/cmake/help/v3.21/command/target_link_libraries.html#linking-object-libraries-via-target-objects
cmake_minimum_required(VERSION 3.21)

add_library(variant INTERFACE)
add_library(variant_usage INTERFACE)

Expand All @@ -7,7 +11,7 @@ target_include_directories(variant_usage INTERFACE


target_link_libraries(variant_usage INTERFACE
core_config
base_config
)

target_link_libraries(variant INTERFACE variant_usage)
Expand Down
6 changes: 5 additions & 1 deletion variants/STM32H7xx/H725V(E-G)T/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# v3.21 implemented semantic changes regarding $<TARGET_OBJECTS:...>
# See https://cmake.org/cmake/help/v3.21/command/target_link_libraries.html#linking-object-libraries-via-target-objects
cmake_minimum_required(VERSION 3.21)

add_library(variant INTERFACE)
add_library(variant_usage INTERFACE)

Expand All @@ -7,7 +11,7 @@ target_include_directories(variant_usage INTERFACE


target_link_libraries(variant_usage INTERFACE
core_config
base_config
)

target_link_libraries(variant INTERFACE variant_usage)
Expand Down
6 changes: 5 additions & 1 deletion variants/STM32H7xx/H730IBKxQ/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# v3.21 implemented semantic changes regarding $<TARGET_OBJECTS:...>
# See https://cmake.org/cmake/help/v3.21/command/target_link_libraries.html#linking-object-libraries-via-target-objects
cmake_minimum_required(VERSION 3.21)

add_library(variant INTERFACE)
add_library(variant_usage INTERFACE)

Expand All @@ -7,7 +11,7 @@ target_include_directories(variant_usage INTERFACE


target_link_libraries(variant_usage INTERFACE
core_config
base_config
)

target_link_libraries(variant INTERFACE variant_usage)
Expand Down
6 changes: 5 additions & 1 deletion variants/STM32H7xx/H730VB(H-T)/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# v3.21 implemented semantic changes regarding $<TARGET_OBJECTS:...>
# See https://cmake.org/cmake/help/v3.21/command/target_link_libraries.html#linking-object-libraries-via-target-objects
cmake_minimum_required(VERSION 3.21)

add_library(variant INTERFACE)
add_library(variant_usage INTERFACE)

Expand All @@ -7,7 +11,7 @@ target_include_directories(variant_usage INTERFACE


target_link_libraries(variant_usage INTERFACE
core_config
base_config
)

target_link_libraries(variant INTERFACE variant_usage)
Expand Down
6 changes: 5 additions & 1 deletion variants/STM32H7xx/H730ZBT/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# v3.21 implemented semantic changes regarding $<TARGET_OBJECTS:...>
# See https://cmake.org/cmake/help/v3.21/command/target_link_libraries.html#linking-object-libraries-via-target-objects
cmake_minimum_required(VERSION 3.21)

add_library(variant INTERFACE)
add_library(variant_usage INTERFACE)

Expand All @@ -7,7 +11,7 @@ target_include_directories(variant_usage INTERFACE


target_link_libraries(variant_usage INTERFACE
core_config
base_config
)

target_link_libraries(variant INTERFACE variant_usage)
Expand Down
6 changes: 5 additions & 1 deletion variants/STM32H7xx/H735VGH/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# v3.21 implemented semantic changes regarding $<TARGET_OBJECTS:...>
# See https://cmake.org/cmake/help/v3.21/command/target_link_libraries.html#linking-object-libraries-via-target-objects
cmake_minimum_required(VERSION 3.21)

add_library(variant INTERFACE)
add_library(variant_usage INTERFACE)

Expand All @@ -7,7 +11,7 @@ target_include_directories(variant_usage INTERFACE


target_link_libraries(variant_usage INTERFACE
core_config
base_config
)

target_link_libraries(variant INTERFACE variant_usage)
Expand Down
6 changes: 5 additions & 1 deletion variants/STM32H7xx/H735VGT/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# v3.21 implemented semantic changes regarding $<TARGET_OBJECTS:...>
# See https://cmake.org/cmake/help/v3.21/command/target_link_libraries.html#linking-object-libraries-via-target-objects
cmake_minimum_required(VERSION 3.21)

add_library(variant INTERFACE)
add_library(variant_usage INTERFACE)

Expand All @@ -7,7 +11,7 @@ target_include_directories(variant_usage INTERFACE


target_link_libraries(variant_usage INTERFACE
core_config
base_config
)

target_link_libraries(variant INTERFACE variant_usage)
Expand Down
6 changes: 5 additions & 1 deletion variants/STM32WBxx/WB30CEUxA/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# v3.21 implemented semantic changes regarding $<TARGET_OBJECTS:...>
# See https://cmake.org/cmake/help/v3.21/command/target_link_libraries.html#linking-object-libraries-via-target-objects
cmake_minimum_required(VERSION 3.21)

add_library(variant INTERFACE)
add_library(variant_usage INTERFACE)

Expand All @@ -7,7 +11,7 @@ target_include_directories(variant_usage INTERFACE


target_link_libraries(variant_usage INTERFACE
core_config
base_config
)

target_link_libraries(variant INTERFACE variant_usage)
Expand Down
6 changes: 5 additions & 1 deletion variants/STM32WBxx/WB35C(C-E)UxA/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# v3.21 implemented semantic changes regarding $<TARGET_OBJECTS:...>
# See https://cmake.org/cmake/help/v3.21/command/target_link_libraries.html#linking-object-libraries-via-target-objects
cmake_minimum_required(VERSION 3.21)

add_library(variant INTERFACE)
add_library(variant_usage INTERFACE)

Expand All @@ -7,7 +11,7 @@ target_include_directories(variant_usage INTERFACE


target_link_libraries(variant_usage INTERFACE
core_config
base_config
)

target_link_libraries(variant INTERFACE variant_usage)
Expand Down
6 changes: 5 additions & 1 deletion variants/STM32WBxx/WB50CGU/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# v3.21 implemented semantic changes regarding $<TARGET_OBJECTS:...>
# See https://cmake.org/cmake/help/v3.21/command/target_link_libraries.html#linking-object-libraries-via-target-objects
cmake_minimum_required(VERSION 3.21)

add_library(variant INTERFACE)
add_library(variant_usage INTERFACE)

Expand All @@ -7,7 +11,7 @@ target_include_directories(variant_usage INTERFACE


target_link_libraries(variant_usage INTERFACE
core_config
base_config
)

target_link_libraries(variant INTERFACE variant_usage)
Expand Down
6 changes: 5 additions & 1 deletion variants/STM32WBxx/WB55C(C-E-G)U/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# v3.21 implemented semantic changes regarding $<TARGET_OBJECTS:...>
# See https://cmake.org/cmake/help/v3.21/command/target_link_libraries.html#linking-object-libraries-via-target-objects
cmake_minimum_required(VERSION 3.21)

add_library(variant INTERFACE)
add_library(variant_usage INTERFACE)

Expand All @@ -7,7 +11,7 @@ target_include_directories(variant_usage INTERFACE


target_link_libraries(variant_usage INTERFACE
core_config
base_config
)

target_link_libraries(variant INTERFACE variant_usage)
Expand Down
6 changes: 5 additions & 1 deletion variants/STM32WLxx/WL55UCY_WLE5U(8-B)Y/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# v3.21 implemented semantic changes regarding $<TARGET_OBJECTS:...>
# See https://cmake.org/cmake/help/v3.21/command/target_link_libraries.html#linking-object-libraries-via-target-objects
cmake_minimum_required(VERSION 3.21)

add_library(variant INTERFACE)
add_library(variant_usage INTERFACE)

Expand All @@ -7,7 +11,7 @@ target_include_directories(variant_usage INTERFACE


target_link_libraries(variant_usage INTERFACE
core_config
base_config
)

target_link_libraries(variant INTERFACE variant_usage)
Expand Down

0 comments on commit fe5794c

Please sign in to comment.