initial commit
This commit is contained in:
29
CMakeLists.txt
Normal file
29
CMakeLists.txt
Normal file
@@ -0,0 +1,29 @@
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
project(serial_module)
|
||||
|
||||
# 查找 Python 开发包
|
||||
set(Python3_ROOT_DIR ~/miniconda3/envs/videomea_deploy)
|
||||
find_package(Python3 REQUIRED COMPONENTS Development)
|
||||
|
||||
# 添加 Python 头文件路径
|
||||
include_directories(${Python3_INCLUDE_DIRS})
|
||||
|
||||
# 添加系统头文件路径(如果 hx_serial.h 在默认位置,可以省略)
|
||||
# include_directories(/usr/include /usr/local/include)
|
||||
|
||||
# 添加源文件
|
||||
set(SOURCES serial_module.c hx_ringbuffer.c)
|
||||
|
||||
# 创建 Python 模块
|
||||
Python3_add_library(serial_module MODULE ${SOURCES})
|
||||
|
||||
find_package(ZLIB REQUIRED)
|
||||
|
||||
target_link_libraries(serial_module PRIVATE hx-serial fec ${ZLIB_LIBRARIES})
|
||||
|
||||
# 设置输出目录和文件名
|
||||
set_target_properties(serial_module PROPERTIES
|
||||
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
PREFIX ""
|
||||
SUFFIX ".so"
|
||||
)
|
||||
Reference in New Issue
Block a user