Simplest Zephyr module + bacnet_stack config and hello sample
This commit is contained in:
@@ -0,0 +1,103 @@
|
||||
cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
|
||||
|
||||
# Detect the platform reliably
|
||||
if(ZEPHYR_BASE)
|
||||
if (NOT CONFIG_BACNETSTACK)
|
||||
return()
|
||||
endif()
|
||||
set(ZEPHYR YES)
|
||||
else()
|
||||
message(FATAL_ERROR "ZEPHYR_BASE needs to be defined for Zephyr builds")
|
||||
endif()
|
||||
|
||||
#
|
||||
# options managed through Kconfig and use names CONFIG_*
|
||||
#
|
||||
|
||||
set(BACNET_PROTOCOL_REVISION 19)
|
||||
|
||||
message(STATUS "BACNETSTACK: using cmake ${CMAKE_VERSION}")
|
||||
message(STATUS "BACNETSTACK: CMAKE_C_COMPILER_ID \"${CMAKE_C_COMPILER_ID}\"")
|
||||
message(STATUS "BACNETSTACK: CMAKE_C_COMPILER_VERSION \"${CMAKE_C_COMPILER_VERSION}\"")
|
||||
message(STATUS "BACNETSTACK: CMAKE_CXX_COMPILER_ID \"${CMAKE_CXX_COMPILER_ID}\"")
|
||||
message(STATUS "BACNETSTACK: CMAKE_CXX_COMPILER_VERSION \"${CMAKE_CXX_COMPILER_VERSION}\"")
|
||||
message(STATUS "BACNETSTACK: CMAKE_INSTALL_PREFIX \"${CMAKE_INSTALL_PREFIX}\"")
|
||||
message(STATUS "BACNETSTACK: BACNET_PROTOCOL_REVISION \"${BACNET_PROTOCOL_REVISION}\"")
|
||||
message(STATUS "BACNETSTACK: BACDL_BIP6 \"${CONFIG_BACDL_BIP6}\"")
|
||||
message(STATUS "BACNETSTACK: BACDL_BIP \"${CONFIG_BACDL_BIP}\"")
|
||||
message(STATUS "BACNETSTACK: BACDL_ARCNET \"${CONFIG_BACDL_ARCNET}\"")
|
||||
message(STATUS "BACNETSTACK: BACDL_MSTP \"${CONFIG_BACDL_MSTP}\"")
|
||||
message(STATUS "BACNETSTACK: BACDL_ETHERNET \"${CONFIG_BACDL_ETHERNET}\"")
|
||||
message(STATUS "BACNETSTACK: BACDL_NONE \"${CONFIG_BACDL_NONE}\"")
|
||||
|
||||
#Do not allow in source builds
|
||||
set(CMAKE_DISABLE_SOURCE_CHANGES ON)
|
||||
set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
|
||||
|
||||
#
|
||||
# sources
|
||||
#
|
||||
set(BACNETSTACK_SRCS
|
||||
)
|
||||
|
||||
#
|
||||
# add ports
|
||||
#
|
||||
|
||||
set(BACNETSTACK_PORT_DIRECTORY_PATH "")
|
||||
|
||||
message(STATUS "BACNETSTACK: building for Zephyr")
|
||||
set(BACNETSTACK_PORT ${CMAKE_CURRENT_LIST_DIR}/../ports/zephyr)
|
||||
|
||||
list(
|
||||
APPEND BACNETSTACK_SRCS
|
||||
${BACNETSTACK_PORT}/main.c
|
||||
)
|
||||
|
||||
|
||||
|
||||
#
|
||||
# library
|
||||
#
|
||||
|
||||
zephyr_library()
|
||||
|
||||
zephyr_library_compile_definitions(
|
||||
$<$<BOOL:${CONFIG_BACDL_BIP}>:BACDL_BIP>
|
||||
$<$<BOOL:${CONFIG_BACDL_BIP6}>:BACDL_BIP6>
|
||||
$<$<BOOL:${CONFIG_BACDL_ARCNET}>:BACDL_ARCNET>
|
||||
$<$<BOOL:${CONFIG_BACDL_MSTP}>:BACDL_MSTP>
|
||||
$<$<BOOL:${CONFIG_BACDL_ETHERNET}>:BACDL_ETHERNET>
|
||||
$<$<BOOL:${CONFIG_BACDL_NONE}>:BACDL_NONE>
|
||||
$<$<BOOL:${CONFIG_BACNET_PROPERTY_LISTS}>:BACNET_PROPERTY_LISTS=1>
|
||||
$<$<BOOL:${CONFIG_BACNET_ROUTING}>:BACNET_ROUTING>
|
||||
$<$<BOOL:${CONFIG_BACAPP_PRINT_ENABLED}>:BACAPP_PRINT_ENABLED=1>
|
||||
$<$<BOOL:${CONFIG_BACAPP_SNPRINTF_ENABLED}>:BACAPP_SNPRINTF_ENABLED=1>
|
||||
)
|
||||
|
||||
zephyr_library_sources(
|
||||
${BACNETSTACK_SRCS}
|
||||
)
|
||||
|
||||
zephyr_include_directories(
|
||||
${BACNETSTACK_PORT}
|
||||
${BACNETSTACK_SRC}
|
||||
)
|
||||
|
||||
target_compile_definitions(
|
||||
app PRIVATE
|
||||
BACNET_PROTOCOL_REVISION=${BACNET_PROTOCOL_REVISION}
|
||||
$<$<BOOL:${CONFIG_BACDL_BIP}>:BACDL_BIP>
|
||||
$<$<BOOL:${CONFIG_BACDL_BIP6}>:BACDL_BIP6>
|
||||
$<$<BOOL:${CONFIG_BACDL_ARCNET}>:BACDL_ARCNET>
|
||||
$<$<BOOL:${CONFIG_BACDL_MSTP}>:BACDL_MSTP>
|
||||
$<$<BOOL:${CONFIG_BACDL_ETHERNET}>:BACDL_ETHERNET>
|
||||
$<$<BOOL:${CONFIG_BACDL_NONE}>:BACDL_NONE>
|
||||
$<$<BOOL:${CONFIG_BACNET_PROPERTY_LISTS}>:BACNET_PROPERTY_LISTS=1>
|
||||
$<$<BOOL:${CONFIG_BACNET_ROUTING}>:BACNET_ROUTING>
|
||||
$<$<BOOL:${CONFIG_BACAPP_PRINT_ENABLED}>:BACAPP_PRINT_ENABLED=1>
|
||||
$<$<BOOL:${CONFIG_BACAPP_SNPRINTF_ENABLED}>:BACAPP_SNPRINTF_ENABLED=1>
|
||||
BACNET_STACK_STATIC_DEFINE
|
||||
PRINT_ENABLED=1
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user