Files
track-core/CMakeLists.txt
T
crosstyan 1005e50be0 feat(track-core): add portable training runtimes
Move scheme and PID training runtime behavior into the pure track_core layer and expose render sinks for injected strip application.

Add ESP compatibility adapters, Python bindings/test scaffolding, and in-memory render support so app_track_bt can consume core render and runtime logic without duplicating it.

Cover circular/linear rendering boundaries, all scheme runtime types, scheme render_to parity, PID sample de-duplication, speed suppression, and live tuning in track-core tests.
2026-05-18 16:15:45 +08:00

68 lines
2.1 KiB
CMake

set(TRACK_CORE_SOURCES
src/memory_strip.cpp
src/model.cpp
src/pid_program.cpp
src/pid_runtime.cpp
src/render.cpp
src/scheme_decoder.cpp
src/scheme_runtime.cpp
)
if(DEFINED IDF_TARGET)
set(TRACK_CORE_IDF_SOURCES
src/esp/app_track_decoder.cpp
src/esp/app_track_drawer.cpp
src/esp/app_track_model.cpp
)
idf_component_register(
SRCS ${TRACK_CORE_SOURCES} ${TRACK_CORE_IDF_SOURCES}
INCLUDE_DIRS include
REQUIRES
app_proto
app_strip_if
app_utils
app_utils_clock
)
else()
cmake_minimum_required(VERSION 3.20)
project(track_core VERSION 0.1.0 LANGUAGES CXX)
add_library(track_core ${TRACK_CORE_SOURCES})
add_library(track_core::track_core ALIAS track_core)
target_include_directories(track_core
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
target_compile_features(track_core PUBLIC cxx_std_23)
option(TRACK_CORE_BUILD_PYTHON "Build Python bindings" OFF)
option(TRACK_CORE_BUILD_TESTS "Build track-core tests" ON)
if(TRACK_CORE_BUILD_PYTHON)
find_package(Python 3.9 COMPONENTS Interpreter Development.Module REQUIRED)
find_package(nanobind CONFIG REQUIRED)
nanobind_add_module(_core
src/python/bindings.cpp
)
target_link_libraries(_core PRIVATE track_core::track_core)
target_compile_features(_core PRIVATE cxx_std_23)
install(TARGETS _core LIBRARY DESTINATION track_core)
endif()
if(TRACK_CORE_BUILD_TESTS)
enable_testing()
add_executable(track_core_tests tests/track_core_tests.cpp)
target_link_libraries(track_core_tests PRIVATE track_core::track_core)
target_compile_features(track_core_tests PRIVATE cxx_std_23)
add_test(NAME track_core_tests COMMAND track_core_tests)
endif()
add_executable(track_core_render_demo examples/render_demo.cpp)
target_link_libraries(track_core_render_demo PRIVATE track_core::track_core)
target_compile_features(track_core_render_demo PRIVATE cxx_std_23)
endif()