mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-02-18 19:03:16 +00:00
**New features** - Created a devicetree DTS and YAML parser in Python - Created new modules: - TactilityKernel (LGPL v3.0 license) - Platforms/PlatformEsp32 (LGPL v3.0 license) - Platforms/PlatformPosix (LGPL v3.0 license) - Tests/TactilityKernelTests Most boards have a placeholder DTS file, while T-Lora Pager has a few devices attached. **Licenses** Clarified licenses and copyrights better. - Add explanation about the intent behind them. - Added explanation about licenses for past and future subprojects - Added more details explanations with regards to the logo usage - Copied licenses to subprojects to make it more explicit
60 lines
2.3 KiB
CMake
60 lines
2.3 KiB
CMake
cmake_minimum_required(VERSION 3.20)
|
|
|
|
file(GLOB_RECURSE SOURCE_FILES "Source/*.c*")
|
|
|
|
# For Generate target below
|
|
if (DEFINED ENV{ESP_IDF_VERSION})
|
|
include("../Buildscripts/device.cmake")
|
|
init_tactility_globals("../sdkconfig")
|
|
get_property(TACTILITY_DEVICE_PROJECT GLOBAL PROPERTY TACTILITY_DEVICE_PROJECT)
|
|
else ()
|
|
set(TACTILITY_DEVICE_ID simulator)
|
|
set(COMPONENT_LIB FirmwareSim)
|
|
endif ()
|
|
|
|
set(DEVICETREE_LOCATION "${CMAKE_SOURCE_DIR}/Devices/${TACTILITY_DEVICE_ID}")
|
|
|
|
if (DEFINED ENV{ESP_IDF_VERSION})
|
|
|
|
idf_component_register(
|
|
SRCS ${SOURCE_FILES} "${CMAKE_SOURCE_DIR}/Firmware/Generated/devicetree.c"
|
|
REQUIRES Tactility TactilityC TactilityKernel PlatformEsp32 ${TACTILITY_DEVICE_PROJECT}
|
|
)
|
|
|
|
else ()
|
|
|
|
add_executable(FirmwareSim ${SOURCE_FILES} "${CMAKE_SOURCE_DIR}/Firmware/Generated/devicetree.c")
|
|
target_link_libraries(FirmwareSim PRIVATE
|
|
Tactility
|
|
TactilityCore
|
|
TactilityFreeRtos
|
|
TactilityKernel
|
|
Simulator
|
|
PlatformPosix
|
|
SDL2::SDL2-static SDL2-static
|
|
)
|
|
|
|
add_definitions(-D_Nullable=)
|
|
add_definitions(-D_Nonnull=)
|
|
endif ()
|
|
|
|
file(MAKE_DIRECTORY "${CMAKE_SOURCE_DIR}/Firmware/Generated")
|
|
|
|
# Generate devicetree code and attach to Firmware component
|
|
add_custom_command(
|
|
OUTPUT "${CMAKE_SOURCE_DIR}/Firmware/Generated/devicetree.c"
|
|
"${CMAKE_SOURCE_DIR}/Firmware/Generated/devicetree.h"
|
|
COMMAND pip install lark pyyaml
|
|
COMMAND python "${CMAKE_SOURCE_DIR}/Buildscripts/DevicetreeCompiler/compile.py"
|
|
"${DEVICETREE_LOCATION}" "Firmware/Generated"
|
|
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
|
DEPENDS "${DEVICETREE_LOCATION}/devicetree.yaml" # Optional: trigger rebuild if source changes
|
|
COMMENT "Generating devicetree source files..."
|
|
)
|
|
add_custom_target(Generated DEPENDS "${CMAKE_SOURCE_DIR}/Firmware/Generated/devicetree.c")
|
|
set_source_files_properties("${CMAKE_SOURCE_DIR}/Firmware/Generated/devicetree.c" PROPERTIES GENERATED TRUE)
|
|
set_source_files_properties("${CMAKE_SOURCE_DIR}/Firmware/Generated/devicetree.h" PROPERTIES GENERATED TRUE)
|
|
# Update target for generated code
|
|
target_sources(${COMPONENT_LIB} PRIVATE "${CMAKE_SOURCE_DIR}/Firmware/Generated/devicetree.c")
|
|
target_include_directories(${COMPONENT_LIB} PRIVATE "${CMAKE_SOURCE_DIR}/Firmware/Generated")
|