mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-06-19 12:25:05 +00:00
* Bluetooth LE addition * fixes * use the psram! helps a little on S3 (t-deck) * custom device name * Update symbols.c * Feedback + fixes Fixes external app start/stop server (child devices) Fixes BtManage causing a full system hang upon disabling bt when a device is connected to the host. * updoot * more updoot * move back! * Revert "move back!" This reverts commit d3694365c634acc5db62ac59771c496cb971a727. * fix some of the things * Addressing feedback? hmm * Fixes Bug 1 — Reconnect loop / Reconnect not working fixed Bug 2 — Name-only advertising overwrites HID advertising Bug 3 — BleHidDeviceCtx leak on re-enable Enhancement — HID device auto-start on radio re-enable * stuff... * update for consistency with others * fix crashes and some bonus symbols * a few symbols, i2c speed, cdn message 100kHz i2c speed seems to be more compatible with m5stack modules...and probably in general. cdn message no longer applies * Hide BT Settings when bt not enabled * Addressing things and device fixes * Missed one! * stuff
122 lines
3.7 KiB
CMake
122 lines
3.7 KiB
CMake
cmake_minimum_required(VERSION 3.20)
|
|
|
|
file(GLOB_RECURSE SOURCE_FILES "Source/*.c*")
|
|
|
|
get_filename_component(PROJECT_ROOT "${CMAKE_CURRENT_LIST_DIR}/.." ABSOLUTE)
|
|
|
|
# Get the project and device id
|
|
if (DEFINED ENV{ESP_IDF_VERSION})
|
|
include("../Buildscripts/device.cmake")
|
|
init_tactility_globals("../sdkconfig")
|
|
get_property(TACTILITY_DEVICE_PROJECT GLOBAL PROPERTY TACTILITY_DEVICE_PROJECT)
|
|
get_property(TACTILITY_DEVICE_ID GLOBAL PROPERTY TACTILITY_DEVICE_ID)
|
|
else ()
|
|
set(TACTILITY_DEVICE_ID simulator)
|
|
set(COMPONENT_LIB FirmwareSim)
|
|
set(TACTILITY_DEVICE_PROJECT Simulator)
|
|
endif ()
|
|
|
|
set(DEVICETREE_LOCATION "${PROJECT_ROOT}/Devices/${TACTILITY_DEVICE_ID}")
|
|
|
|
# Check if device has Bluetooth enabled
|
|
# Fixes the sdkconfig bluetooth enable options from getting nuked on non-P4+C6 builds when idf build runs
|
|
if (DEFINED ENV{ESP_IDF_VERSION})
|
|
file(READ "${DEVICETREE_LOCATION}/device.properties" device_properties_content)
|
|
if (device_properties_content MATCHES "bluetooth=true")
|
|
list(APPEND REQUIRES_LIST bt)
|
|
endif()
|
|
endif()
|
|
|
|
#
|
|
# DTS compiler python dependencies
|
|
#
|
|
|
|
execute_process(
|
|
COMMAND python -m pip install lark==1.3.1 pyyaml==6.0.3
|
|
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
|
)
|
|
|
|
#
|
|
# Devicetree dependency collection
|
|
#
|
|
|
|
execute_process(
|
|
COMMAND python "${PROJECT_ROOT}/Buildscripts/DevicetreeCompiler/dependencies.py" "${DEVICETREE_LOCATION}"
|
|
WORKING_DIRECTORY "${PROJECT_ROOT}"
|
|
OUTPUT_VARIABLE DEVICE_DEPENDENCIES
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
)
|
|
# Tokenize to array of lines
|
|
separate_arguments(DEVICE_DEPENDENCIES UNIX_COMMAND "${DEVICE_DEPENDENCIES}")
|
|
|
|
#
|
|
# "Generated/" directory creation
|
|
#
|
|
|
|
set(GENERATED_DIR "${CMAKE_CURRENT_BINARY_DIR}/Generated")
|
|
# Ensure the directory is built in the correct CMake build phase
|
|
# If the check is not done, then another directory is created in the root of the build folder.
|
|
if (DEFINED CMAKE_CURRENT_BINARY_DIR)
|
|
file(MAKE_DIRECTORY "${GENERATED_DIR}")
|
|
endif ()
|
|
|
|
#
|
|
# Component
|
|
#
|
|
|
|
list(APPEND REQUIRES_LIST
|
|
Tactility
|
|
TactilityKernel
|
|
)
|
|
|
|
# Add devicetree dependencies
|
|
foreach(dts_dependency IN LISTS DEVICE_DEPENDENCIES)
|
|
message("Adding DTS dependency ${dts_dependency}")
|
|
list(APPEND REQUIRES_LIST ${dts_dependency})
|
|
endforeach()
|
|
|
|
if (DEFINED ENV{ESP_IDF_VERSION})
|
|
list(APPEND REQUIRES_LIST
|
|
TactilityC
|
|
)
|
|
|
|
idf_component_register(
|
|
SRCS ${SOURCE_FILES} "${GENERATED_DIR}/devicetree.c"
|
|
REQUIRES ${REQUIRES_LIST}
|
|
)
|
|
else ()
|
|
list(APPEND REQUIRES_LIST
|
|
TactilityCore
|
|
TactilityFreeRtos
|
|
hal-device-module
|
|
lvgl-module
|
|
SDL2::SDL2-static
|
|
SDL2-static
|
|
)
|
|
add_executable(FirmwareSim ${SOURCE_FILES} "${GENERATED_DIR}/devicetree.c")
|
|
target_link_libraries(FirmwareSim PRIVATE ${REQUIRES_LIST})
|
|
endif ()
|
|
|
|
#
|
|
# Devicetree code generation
|
|
#
|
|
|
|
add_custom_target(AlwaysRun
|
|
COMMAND ${CMAKE_COMMAND} -E rm -f "${GENERATED_DIR}/devicetree.c"
|
|
)
|
|
add_custom_command(
|
|
OUTPUT "${GENERATED_DIR}/devicetree.c"
|
|
"${GENERATED_DIR}/devicetree.h"
|
|
COMMAND python "${CMAKE_SOURCE_DIR}/Buildscripts/DevicetreeCompiler/compile.py"
|
|
"${DEVICETREE_LOCATION}" "${GENERATED_DIR}"
|
|
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
|
DEPENDS AlwaysRun "${DEVICETREE_LOCATION}/devicetree.yaml" # AlwaysRun ensures it always gets built
|
|
COMMENT "Generating devicetree source files..."
|
|
)
|
|
add_custom_target(Generated DEPENDS "${GENERATED_DIR}/devicetree.c")
|
|
set_source_files_properties("${GENERATED_DIR}/devicetree.c" PROPERTIES GENERATED TRUE)
|
|
set_source_files_properties("${GENERATED_DIR}/devicetree.h" PROPERTIES GENERATED TRUE)
|
|
# Update target for generated code
|
|
target_sources(${COMPONENT_LIB} PRIVATE "${GENERATED_DIR}/devicetree.c")
|
|
target_include_directories(${COMPONENT_LIB} PRIVATE "${GENERATED_DIR}")
|