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