TDengine/source/libs/function/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

83 lines
2 KiB
CMake

aux_source_directory(src FUNCTION_SRC)
aux_source_directory(src/detail FUNCTION_SRC_DETAIL)
list(REMOVE_ITEM FUNCTION_SRC src/udfd.c)
if(COMPILER_SUPPORT_AVX2)
MESSAGE(STATUS "AVX2 instructions is ACTIVATED")
set_source_files_properties(src/detail/tminmaxavx.c PROPERTIES COMPILE_FLAGS -mavx2)
endif()
add_library(function STATIC ${FUNCTION_SRC} ${FUNCTION_SRC_DETAIL})
target_include_directories(
function
PUBLIC
"${TD_SOURCE_DIR}/include/libs/function"
"${TD_SOURCE_DIR}/include/util"
"${TD_SOURCE_DIR}/include/common"
"${TD_SOURCE_DIR}/include/client"
"${TD_SOURCE_DIR}/include/libs/crypt"
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc"
)
target_link_libraries(
function
PRIVATE os
PRIVATE util
PRIVATE common
PRIVATE nodes
PRIVATE qcom
PRIVATE scalar
PRIVATE geometry
PRIVATE decimal
PRIVATE crypt
PUBLIC transport
)
# SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/build/bin)
if(BUILD_WITH_UDF)
add_executable(taosudf src/udfd.c)
if(TD_DARWIN)
target_compile_options(taosudf PRIVATE -Wno-error=deprecated-non-prototype)
endif()
target_include_directories(
taosudf
PUBLIC
"${TD_SOURCE_DIR}/include/libs/function"
"${TD_SOURCE_DIR}/include/util"
"${TD_SOURCE_DIR}/include/common"
"${TD_SOURCE_DIR}/include/libs/transport"
"${TD_SOURCE_DIR}/include/client"
"${TD_SOURCE_DIR}/include/dnode/mgmt"
"${TD_SOURCE_DIR}/source/dnode/mgmt/node_util/inc"
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc"
)
target_link_libraries(
taosudf
PRIVATE os util common nodes function dnode
)
if(NOT TD_WINDOWS)
set_target_properties(taosudf PROPERTIES
INSTALL_RPATH "$ORIGIN:$ORIGIN/../lib:$ORIGIN/../driver"
BUILD_WITH_INSTALL_RPATH TRUE
SKIP_BUILD_RPATH FALSE
)
endif()
if(UNIX AND NOT APPLE)
# ref: https://cmake.org/cmake/help/latest/release/3.4.html#deprecated-and-removed-features
set_target_properties(taosudf PROPERTIES
ENABLE_EXPORTS ON
)
endif()
if(BUILD_TEST)
add_subdirectory(test)
endif()
endif()