feat: 新增GITEA工作流,新建工具链文件

This commit is contained in:
2026-07-26 12:47:36 +08:00
parent 51e081118a
commit cfee4cb939
2 changed files with 139 additions and 3 deletions
+11 -3
View File
@@ -3,17 +3,25 @@ project(DataRouter C)
set(CMAKE_C_STANDARD 11)
# ======== 静态库 ========
add_library(DataRouter STATIC datarouter.c)
# 将库源码目录暴露给使用者,使其可通过 #include <datarouter_config.h>
# 从自身 include path 覆盖默认配置。如果使用者未提供,则回退到库自带版本。
target_include_directories(DataRouter PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
# ======== 共享库(可选,通过 BUILD_SHARED 控制) ========
option(BUILD_SHARED "Build shared library" ON)
if(BUILD_SHARED)
add_library(DataRouter_shared SHARED datarouter.c)
target_include_directories(DataRouter_shared PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
set_target_properties(DataRouter_shared PROPERTIES OUTPUT_NAME DataRouter)
endif()
# ======== 示例程序 ========
if(BUILD_EXAMPLES OR NOT DEFINED BUILD_EXAMPLES)
add_executable(example example.c)
target_link_libraries(example DataRouter)
endif()
# ======== 测试 ========
if(BUILD_TESTING OR NOT DEFINED BUILD_TESTING)
enable_testing()
add_executable(test_datarouter tests/test_datarouter.c)