代码拉取完成,页面将自动刷新
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)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。