Files
track-core/CMakeLists.txt
T
crosstyan cd5c2f64e0 refactor(track-core): remove app-facing track adapters
Keep track-core focused on portable track state, scheme runtime, PID runtime, memory strip, and render planning.

Remove the ESP-IDF/nanopb Track adapter headers and sources from the submodule so app/protobuf ownership can live in a separate firmware component.

The standalone CMake and Python binding surface remains unchanged, including the emulator-facing APIs.
2026-06-18 17:58:04 +08:00

58 lines
1.9 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)
idf_component_register(
SRCS ${TRACK_CORE_SOURCES}
INCLUDE_DIRS include
)
target_compile_features(${COMPONENT_LIB} PUBLIC cxx_std_23)
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()