From 05a42f7bcc89bf419530c8412889bd210b4cf8d3 Mon Sep 17 00:00:00 2001 From: Anton Bilohai Date: Tue, 21 Jul 2020 18:11:55 +0300 Subject: [PATCH 1/7] cmake: add Findamxc.cmake file Add Findamxc.cmake file to locate AMXC library of BAAPI and relevant header files. Jira link: https://jira.prplfoundation.org/browse/PPM-300 Signed-off-by: Anton Bilohai --- cmake/Findamxc.cmake | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 cmake/Findamxc.cmake diff --git a/cmake/Findamxc.cmake b/cmake/Findamxc.cmake new file mode 100644 index 0000000000..926ed20e06 --- /dev/null +++ b/cmake/Findamxc.cmake @@ -0,0 +1,33 @@ +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +# SPDX-FileCopyrightText: 2020 the prplMesh contributors (see AUTHORS.md) +# +# This code is subject to the terms of the BSD+Patent license. +# See LICENSE file for more details. + +find_library(AMXC_LIBRARY "libamxc.so") +find_path(AMXC_INCLUDE_DIRS + NAMES amxc/amxc.h +) + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(amxc DEFAULT_MSG + AMXC_LIBRARY + AMXC_INCLUDE_DIRS +) + +if (amxc_FOUND) + add_library(amxc UNKNOWN IMPORTED) + + # Includes + set_target_properties(amxc PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${AMXC_INCLUDE_DIRS}/" + ) + + # Library + set_target_properties(amxc PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION "${AMXC_LIBRARY}" + ) + +endif() From 93c29ea7588d71e738b30a7137b3874be0292cf1 Mon Sep 17 00:00:00 2001 From: Anton Bilohai Date: Tue, 21 Jul 2020 18:17:51 +0300 Subject: [PATCH 2/7] cmake: add Findamxb.cmake file Add Findamxb.cmake file to locate AMXB library of BAAPI and relevant header files. Jira link: https://jira.prplfoundation.org/browse/PPM-300 Signed-off-by: Anton Bilohai --- cmake/Findamxb.cmake | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 cmake/Findamxb.cmake diff --git a/cmake/Findamxb.cmake b/cmake/Findamxb.cmake new file mode 100644 index 0000000000..4d54d268ab --- /dev/null +++ b/cmake/Findamxb.cmake @@ -0,0 +1,33 @@ +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +# SPDX-FileCopyrightText: 2020 the prplMesh contributors (see AUTHORS.md) +# +# This code is subject to the terms of the BSD+Patent license. +# See LICENSE file for more details. + +find_library(AMXB_LIBRARY "libamxb.so") +find_path(AMXB_INCLUDE_DIRS + NAMES amxb/amxb.h +) + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(amxb DEFAULT_MSG + AMXB_LIBRARY + AMXB_INCLUDE_DIRS +) + +if (amxb_FOUND) + add_library(amxb UNKNOWN IMPORTED) + + # Includes + set_target_properties(amxb PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${AMXB_INCLUDE_DIRS}/" + ) + + # Library + set_target_properties(amxb PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION "${AMXB_LIBRARY}" + ) + +endif() From d08a665dbe63f40c37f3f761cf4e8c80e1103900 Mon Sep 17 00:00:00 2001 From: Anton Bilohai Date: Tue, 21 Jul 2020 18:21:15 +0300 Subject: [PATCH 3/7] cmake: add Findamxd.cmake file Add Findamxd.cmake file to locate AMXD library of BAAPI and relevant header files. Jira link: https://jira.prplfoundation.org/browse/PPM-300 Signed-off-by: Anton Bilohai --- cmake/Findamxd.cmake | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 cmake/Findamxd.cmake diff --git a/cmake/Findamxd.cmake b/cmake/Findamxd.cmake new file mode 100644 index 0000000000..c1b5b75e7c --- /dev/null +++ b/cmake/Findamxd.cmake @@ -0,0 +1,34 @@ +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +# SPDX-FileCopyrightText: 2020 the prplMesh contributors (see AUTHORS.md) +# +# This code is subject to the terms of the BSD+Patent license. +# See LICENSE file for more details. + +find_library(AMXD_LIBRARY "libamxd.so") +find_path(AMXD_INCLUDE_DIRS + NAMES amxd_object_function.h amxd_object.h amxd_object_expression.h amxd_parameter_action.h amxd_object_parameter.h amxd_object_hierarchy.h amxd_action.h amxd_transaction.h amxd_function.h amxd_parameter.h amxd_object_event.h amxd_common.h amxd_object_action.h + PATH_SUFFIXES amxd +) + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(amxd DEFAULT_MSG + AMXD_LIBRARY + AMXD_INCLUDE_DIRS +) + +if (amxd_FOUND) + add_library(amxd UNKNOWN IMPORTED) + + # Includes + set_target_properties(amxd PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${AMXD_INCLUDE_DIRS}/" + ) + + # Library + set_target_properties(amxd PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION "${AMXD_LIBRARY}" + ) + +endif() From c78296b71423a015efaf6ef0ceb16c3690fdd83f Mon Sep 17 00:00:00 2001 From: Anton Bilohai Date: Tue, 21 Jul 2020 18:23:47 +0300 Subject: [PATCH 4/7] cmake: add Findamxj.cmake file Add Findamxj.cmake file to locate AMXJ library of BAAPI and relevant header files. Jira link: https://jira.prplfoundation.org/browse/PPM-300 Signed-off-by: Anton Bilohai --- cmake/Findamxj.cmake | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 cmake/Findamxj.cmake diff --git a/cmake/Findamxj.cmake b/cmake/Findamxj.cmake new file mode 100644 index 0000000000..9d41c93f11 --- /dev/null +++ b/cmake/Findamxj.cmake @@ -0,0 +1,33 @@ +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +# SPDX-FileCopyrightText: 2020 the prplMesh contributors (see AUTHORS.md) +# +# This code is subject to the terms of the BSD+Patent license. +# See LICENSE file for more details. + +find_library(AMXJ_LIBRARY "libamxj.so") +find_path(AMXJ_INCLUDE_DIRS + NAMES amxj/amxj_variant.h +) + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(amxj DEFAULT_MSG + AMXJ_LIBRARY + AMXJ_INCLUDE_DIRS +) + +if (amxj_FOUND) + add_library(amxj UNKNOWN IMPORTED) + + # Includes + set_target_properties(amxj PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${AMXJ_INCLUDE_DIRS}/" + ) + + # Library + set_target_properties(amxj PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION "${AMXJ_LIBRARY}" + ) + +endif() From da06824b8bd4ee6107a5c3a2cda4a29b16280551 Mon Sep 17 00:00:00 2001 From: Anton Bilohai Date: Tue, 21 Jul 2020 18:24:46 +0300 Subject: [PATCH 5/7] cmake: add Findamxo.cmake file Add Findamxo.cmake file to locate AMXO library of BAAPI and relevant header files. Jira link: https://jira.prplfoundation.org/browse/PPM-300 Signed-off-by: Anton Bilohai --- cmake/Findamxo.cmake | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 cmake/Findamxo.cmake diff --git a/cmake/Findamxo.cmake b/cmake/Findamxo.cmake new file mode 100644 index 0000000000..ad8ac509eb --- /dev/null +++ b/cmake/Findamxo.cmake @@ -0,0 +1,33 @@ +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +# SPDX-FileCopyrightText: 2020 the prplMesh contributors (see AUTHORS.md) +# +# This code is subject to the terms of the BSD+Patent license. +# See LICENSE file for more details. + +find_library(AMXO_LIBRARY "libamxo.so") +find_path(AMXO_INCLUDE_DIRS + NAMES amxo/amxo.h +) + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(amxo DEFAULT_MSG + AMXO_LIBRARY + AMXO_INCLUDE_DIRS +) + +if (amxo_FOUND) + add_library(amxo UNKNOWN IMPORTED) + + # Includes + set_target_properties(amxo PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${AMXO_INCLUDE_DIRS}/" + ) + + # Library + set_target_properties(amxo PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION "${AMXO_LIBRARY}" + ) + +endif() From 1c7be8c24e61a3349b2161d9926192a0e097171f Mon Sep 17 00:00:00 2001 From: Anton Bilohai Date: Tue, 21 Jul 2020 18:26:16 +0300 Subject: [PATCH 6/7] cmake: add Findamxp.cmake file Add Findamxp.cmake file to locate AMXP library of BAAPI and relevant header files. Jira link: https://jira.prplfoundation.org/browse/PPM-300 Signed-off-by: Anton Bilohai --- cmake/Findamxp.cmake | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 cmake/Findamxp.cmake diff --git a/cmake/Findamxp.cmake b/cmake/Findamxp.cmake new file mode 100644 index 0000000000..f03c11ea47 --- /dev/null +++ b/cmake/Findamxp.cmake @@ -0,0 +1,33 @@ +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +# SPDX-FileCopyrightText: 2020 the prplMesh contributors (see AUTHORS.md) +# +# This code is subject to the terms of the BSD+Patent license. +# See LICENSE file for more details. + +find_library(AMXP_LIBRARY "libamxp.so") +find_path(AMXP_INCLUDE_DIRS + NAMES amxp/amxp.h +) + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(amxp DEFAULT_MSG + AMXP_LIBRARY + AMXP_INCLUDE_DIRS +) + +if (amxp_FOUND) + add_library(amxp UNKNOWN IMPORTED) + + # Includes + set_target_properties(amxp PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${AMXP_INCLUDE_DIRS}/" + ) + + # Library + set_target_properties(amxp PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION "${AMXP_LIBRARY}" + ) + +endif() From 84eceead2d58c9432d61ce791cb5f60fe7c401ab Mon Sep 17 00:00:00 2001 From: Anton Bilohai Date: Fri, 24 Jul 2020 23:35:49 +0300 Subject: [PATCH 7/7] cmake: create separate HLAPI library Create new Hight Level API library, which should handle interactions with different system buses. Jira link: https://jira.prplfoundation.org/browse/PPM-300 Signed-off-by: Anton Bilohai --- CMakeLists.txt | 1 + framework/platform/CMakeLists.txt | 5 ++- framework/platform/hlapi/CMakeLists.txt | 39 ++++++++++++++++++++++++ framework/platform/hlapi/hlapi.cpp | 11 +++++++ framework/platform/hlapi/include/hlapi.h | 10 ++++++ 5 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 framework/platform/hlapi/CMakeLists.txt create mode 100644 framework/platform/hlapi/hlapi.cpp create mode 100644 framework/platform/hlapi/include/hlapi.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 61e3534b01..db40ee352e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,6 +14,7 @@ option (BUILD_AGENT "Build EasyMesh agent" ON) option (BUILD_CONTROLLER "Build EasyMesh controller" ON) option(BUILD_SHARED_LIBS "Build shared libraries (.so) instead of static ones (.a)" ON) +option (ENABLE_HLAPI "Build the northbound (high-level) API" OFF) ## Generic checks and defaults diff --git a/framework/platform/CMakeLists.txt b/framework/platform/CMakeLists.txt index 82b3856e5d..be9e113fa0 100644 --- a/framework/platform/CMakeLists.txt +++ b/framework/platform/CMakeLists.txt @@ -1 +1,4 @@ -add_subdirectory(bpl) \ No newline at end of file +add_subdirectory(bpl) +if (ENABLE_HLAPI) + add_subdirectory(hlapi) +endif() diff --git a/framework/platform/hlapi/CMakeLists.txt b/framework/platform/hlapi/CMakeLists.txt new file mode 100644 index 0000000000..0630d06ad0 --- /dev/null +++ b/framework/platform/hlapi/CMakeLists.txt @@ -0,0 +1,39 @@ +project(hlapi VERSION ${prplmesh_VERSION}) + +message("${BoldWhite}Preparing ${BoldGreen}${PROJECT_NAME}${BoldWhite} for the ${BoldGreen}${TARGET_PLATFORM}${BoldWhite} platform${ColourReset}") + +# Set the base path for the current module +set(MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) + +# Common Sources +set(hlapi_sources ${MODULE_PATH}/hlapi.cpp) + +# Include AMBIORIX in the build +message(STATUS "ENABLE_HLAPI: ${ENABLE_HLAPI}") +find_package(amxb REQUIRED) +find_package(amxc REQUIRED) +find_package(amxd REQUIRED) +find_package(amxj REQUIRED) +find_package(amxo REQUIRED) +find_package(amxp REQUIRED) +list(APPEND HLAPI_LIBS amxb amxc amxd amxj amxo amxp) + + +# Build the library +add_library(${PROJECT_NAME} ${hlapi_sources}) +set_target_properties(${PROJECT_NAME} PROPERTIES VERSION ${prplmesh_VERSION} SOVERSION ${prplmesh_VERSION_MAJOR}) +set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "-Wl,-z,defs") +target_link_libraries(${PROJECT_NAME} PRIVATE ${HLAPI_LIBS}) + +# Install +target_include_directories(${PROJECT_NAME} + PUBLIC + $ + $ + ) + +install(TARGETS ${PROJECT_NAME} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ) diff --git a/framework/platform/hlapi/hlapi.cpp b/framework/platform/hlapi/hlapi.cpp new file mode 100644 index 0000000000..d85f1c487b --- /dev/null +++ b/framework/platform/hlapi/hlapi.cpp @@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: BSD-2-Clause-Patent + * + * SPDX-FileCopyrightText: 2020 the prplMesh contributors (see AUTHORS.md) + * + * This code is subject to the terms of the BSD+Patent license. + * See LICENSE file for more details. + */ + +extern "C" { +#include +} diff --git a/framework/platform/hlapi/include/hlapi.h b/framework/platform/hlapi/include/hlapi.h new file mode 100644 index 0000000000..bf09844010 --- /dev/null +++ b/framework/platform/hlapi/include/hlapi.h @@ -0,0 +1,10 @@ +/* SPDX-License-Identifier: BSD-2-Clause-Patent + * + * SPDX-FileCopyrightText: 2016-2020 the prplMesh contributors (see AUTHORS.md) + * + * This code is subject to the terms of the BSD+Patent license. + * See LICENSE file for more details. + */ + +#ifndef _HL_API_H +#define _HL_API_H