From 81d14b91abe0673ac7fbef70d99b0c3305990f4e Mon Sep 17 00:00:00 2001 From: Anton Bilohai Date: Fri, 24 Jul 2020 23:35:49 +0300 Subject: [PATCH] cmake: create separate HLAPI library Create new Hight Level API library, which should handle interactions with different system buses. Signed-off-by: Anton Bilohai --- CMakeLists.txt | 1 + framework/platform/CMakeLists.txt | 5 ++- framework/platform/HLAPI/CMakeLists.txt | 43 ++++++++++++++++++++++++ framework/platform/HLAPI/hlapi.cpp | 11 ++++++ framework/platform/HLAPI/include/hlapi.h | 10 ++++++ 5 files changed, 69 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..003f61e316 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_AMBIORIX "Include Bus agnostic API in the build" OFF) ## Generic checks and defaults diff --git a/framework/platform/CMakeLists.txt b/framework/platform/CMakeLists.txt index 82b3856e5d..965a3e5a89 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_AMBIORIX) + add_subdirectory(HLAPI) +endif() diff --git a/framework/platform/HLAPI/CMakeLists.txt b/framework/platform/HLAPI/CMakeLists.txt new file mode 100644 index 0000000000..942f7e82ab --- /dev/null +++ b/framework/platform/HLAPI/CMakeLists.txt @@ -0,0 +1,43 @@ +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 +file(GLOB_RECURSE hlapi_sources ${MODULE_PATH}/*.c*) + +# Include AMBIORIX in the build +message(STATUS "ENABLE_AMBIORIX: ${ENABLE_AMBIORIX}") +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} + ) + +if(BUILD_TESTS) + add_subdirectory(test) +endif() 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