2 Star 1 Fork 4

wasome/plugin_modbus

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
CMakeLists.txt 1.64 KB
一键复制 编辑 原始数据 按行查看 历史
kevin 提交于 2023-12-10 14:33 . build for arm platform
cmake_minimum_required(VERSION 3.0.0)
message("modbus...")
project(modbus_plugin)
#set paths
set(REPO_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(EXTERNAL_DIR ${REPO_ROOT_DIR}/deps)
#set WA_SDK_DIR paths
if(NOT DEFINED WA_SDK_DIR)
set (WA_SDK_DIR ${REPO_ROOT_DIR}/out/host/wa-iot)
endif()
include(${WA_SDK_DIR}/wa-sdk.cmake)
include (${WA_SDK_DIR}/rules.cmake)
add_definitions(-DLOG_MY_MASK_ID=7)
if(NOT DEFINED PLATFORM)
set(PLATFORM x86)
endif()
# Tell the loader to look up the dependent dynamic libraries from the same folder.
set(CMAKE_INSTALL_RPATH "$ORIGIN")
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
set(IC_MODBUS_DIR ${CMAKE_CURRENT_LIST_DIR}/src)
set(IC_MODBUS_SOURCE
${IC_MODBUS_DIR}/init_modbus.c
${IC_MODBUS_DIR}/plugin_read_URL.c
${IC_MODBUS_DIR}/bus_executor.c
${IC_MODBUS_DIR}/plugin_write_URL.c
${IC_MODBUS_DIR}/bus_device.c
)
include_directories(
${IC_MODBUS_DIR}
)
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/inc
${CMAKE_CURRENT_SOURCE_DIR}/inc/${PLATFORM}
${EXTERNAL_DIR}/libmodbus/src
${EXTERNAL_DIR}/libmodbus
${EXTERNAL_DIR}
)
set(LIB_MODBUS_SOURCE
${EXTERNAL_DIR}/libmodbus/src/modbus.c
${EXTERNAL_DIR}/libmodbus/src/modbus-data.c
${EXTERNAL_DIR}/libmodbus/src/modbus-rtu.c
${EXTERNAL_DIR}/libmodbus/src/modbus-tcp.c
)
add_library(modbus SHARED ${LIB_MODBUS_SOURCE})
target_link_libraries(modbus)
set(MODBUS_SOURCE
${CMAKE_CURRENT_SOURCE_DIR}/src/modbus_plugin_entries.c
${CMAKE_CURRENT_SOURCE_DIR}/src/modbus_resource.c
${IC_MODBUS_SOURCE}
)
add_library(modbus_plugin MODULE ${MODBUS_SOURCE})
target_link_libraries(modbus_plugin modbus)
linkWA_SDK(modbus_plugin)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C
1
https://gitee.com/wasome/plugin_modbus.git
git@gitee.com:wasome/plugin_modbus.git
wasome
plugin_modbus
plugin_modbus
master

搜索帮助