TDengine/source/libs/function/test/CMakeLists.txt
WANG Xu c52c68aa4f
sync: apply remaining build system changes from monorepo (main)
The following commits could not be applied individually due to context
differences between the monorepo and the public repo's build files.
They have been applied as a cumulative diff to ensure the final state
matches the monorepo exactly:

- chore: sync CI files with 3.0 branch to eliminate merge conflicts (rd-public/tsdb!271)
- revert(refactor): dynamically link taosd taosudf taosmqtt against libtaosnative.so to reduce binary size (revert #183) (rd-public/tsdb!282)
- fix(docs): autofix formatting issues across all doc files (rd-public/tsdb!296)
- feat: support -DBUILD_SANITIZER=true on windows for debug build (rd-public/tsdb!291)
- feat(build): build cache, mirror, and sccache optimizations (rd-public/tsdb!326)
- docs: update image for three replica (rd-public/tsdb!324)
- enh: shared storage on windows (rd-public/tsdb!333)
- fix(cmake): convert ext_libs3 from git clone to URL tarball download (rd-public/tsdb!360)
- feat: dual-source deps and comprehensive docs/packaging (cherry-pick to main) (rd-public/tsdb!352)
- fix(cmake): guard DOWNLOAD_EXTRACT_TIMESTAMP for CMake < 3.24 and fix duplicate Cargo.lock entry (rd-public/tsdb!369)
- fix: test case execution failure in pytest.sh (rd-public/tsdb!338)
- enh: built-in compilation support for Python UDF plugins use abi3 (rd-public/tsdb!325)
2026-05-23 14:11:50 +08:00

76 lines
2.3 KiB
CMake

include_directories("${TD_SOURCE_DIR}/include/libs/function")
include_directories("${TD_SOURCE_DIR}/include/util")
include_directories("${TD_SOURCE_DIR}/include/common")
include_directories("${TD_SOURCE_DIR}/include/client")
include_directories("${TD_SOURCE_DIR}/include/os")
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../inc")
if(${BUILD_TEST})
add_executable(runUdf runUdf.c)
target_link_libraries(
runUdf
PRIVATE os util common nodes function
)
endif(${BUILD_TEST})
add_library(udf1 STATIC MODULE udf1.c)
target_link_libraries(udf1 PUBLIC os)
# perm_entropy: aggregate UDF example demonstrating the
# "accumulate-all-data-then-compute" pattern (permutation entropy).
add_library(perm_entropy STATIC MODULE perm_entropy.c)
target_link_libraries(perm_entropy PUBLIC os)
if(NOT TD_WINDOWS)
target_link_libraries(perm_entropy PRIVATE m)
endif()
add_library(udf2 STATIC MODULE udf2.c)
target_link_libraries(udf2 PUBLIC os)
add_library(udf1_dup STATIC MODULE udf1_dup.c)
target_link_libraries(udf1_dup PUBLIC os)
add_library(udf2_dup STATIC MODULE udf2_dup.c)
target_link_libraries(udf2_dup PUBLIC os)
# example UDFs from docs/examples/udf/ (used by test_udf_c.py)
set(_UDF_EXAMPLES_DIR "${TD_SOURCE_DIR}/docs/examples/udf")
add_library(bitand STATIC MODULE "${_UDF_EXAMPLES_DIR}/bit_and.c")
target_link_libraries(bitand PUBLIC os util)
add_library(l2norm STATIC MODULE "${_UDF_EXAMPLES_DIR}/l2norm.c")
target_link_libraries(l2norm PUBLIC os util)
if(NOT TD_WINDOWS)
target_link_libraries(l2norm PRIVATE m)
endif()
add_library(gpd STATIC MODULE "${_UDF_EXAMPLES_DIR}/gpd.c")
target_link_libraries(gpd PUBLIC os util)
set(TARGET_NAMES
change_udf_normal
change_udf_no_init
change_udf_no_process
change_udf_no_destroy
change_udf_init_failed
change_udf_process_failed
change_udf_destory_failed
)
set(COMPILE_DEFINITIONS
CHANGE_UDF_NORMAL
CHANGE_UDF_NO_INIT
CHANGE_UDF_NO_PROCESS
CHANGE_UDF_NO_DESTROY
CHANGE_UDF_INIT_FAILED
CHANGE_UDF_PROCESS_FAILED
CHANGE_UDF_DESTORY_FAILED
)
foreach(index RANGE 0 6)
list(GET TARGET_NAMES ${index} target_name)
list(GET COMPILE_DEFINITIONS ${index} compile_def)
add_library(${target_name} STATIC MODULE change_udf.c)
target_compile_definitions(${target_name} PRIVATE ${compile_def})
target_link_libraries(${target_name} PUBLIC os)
endforeach()