Files
celrs/celrs/CMakeLists.txt
T
portersky 2761bcb16c refactor: mock serial platform backend in test_serial
test_serial mocked log_write.h, which serial.c never calls.
Split celrs_serial into celrs_serial (platform-agnostic logic)
and celrs_serial_platform (real Win/POSIX backend), matching
the celrs_logger/celrs_log_write split.

test_serial now mocks celrs/platform/serial_internal.h and
links only celrs_serial, so the list-ports tests verify the
max_ports clamping and pass-through logic without hitting the
real registry or /dev.
2026-06-14 20:18:17 +02:00

31 lines
1.4 KiB
CMake

add_library(celrs_crsf STATIC crsf.c)
target_include_directories(celrs_crsf PUBLIC "${CMAKE_SOURCE_DIR}")
target_compile_features(celrs_crsf PRIVATE c_std_23)
# Platform-agnostic serial logic — calls cel_serial_platform_*();
# symbol resolved by celrs_serial_platform (or a mock in tests)
add_library(celrs_serial STATIC serial.c)
target_include_directories(celrs_serial PUBLIC "${CMAKE_SOURCE_DIR}")
target_compile_features(celrs_serial PRIVATE c_std_23)
# Real platform backend — linked into production binaries only
add_library(celrs_serial_platform STATIC)
target_include_directories(celrs_serial_platform PUBLIC "${CMAKE_SOURCE_DIR}")
target_compile_features(celrs_serial_platform PRIVATE c_std_23)
if (IS_WINDOWS)
target_sources(celrs_serial_platform PRIVATE platform/serial_win.c)
target_link_libraries(celrs_serial_platform PRIVATE advapi32)
elseif(IS_LINUX OR IS_MACOS)
target_sources(celrs_serial_platform PRIVATE platform/serial_posix.c)
endif()
# Level-filtering logger — calls log_write(); symbol resolved by the final binary
add_library(celrs_logger STATIC logger.c)
target_include_directories(celrs_logger PUBLIC "${CMAKE_SOURCE_DIR}")
target_compile_features(celrs_logger PRIVATE c_std_23)
# Real log_write implementation — linked into production binaries only
add_library(celrs_log_write STATIC log_write.c)
target_include_directories(celrs_log_write PUBLIC "${CMAKE_SOURCE_DIR}")
target_compile_features(celrs_log_write PRIVATE c_std_23)