Skip to content
This repository has been archived by the owner on Sep 7, 2020. It is now read-only.

Commit

Permalink
cmake: create separate HLAPI library
Browse files Browse the repository at this point in the history
Create new Hight Level API library, which should handle interactions
with different system buses.

Signed-off-by: Anton Bilohai <[email protected]>
  • Loading branch information
abelog committed Jul 24, 2020
1 parent 4b31821 commit 81d14b9
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 1 deletion.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 4 additions & 1 deletion framework/platform/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
add_subdirectory(bpl)
add_subdirectory(bpl)
if (ENABLE_AMBIORIX)
add_subdirectory(HLAPI)
endif()
43 changes: 43 additions & 0 deletions framework/platform/HLAPI/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
)

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()
11 changes: 11 additions & 0 deletions framework/platform/HLAPI/hlapi.cpp
Original file line number Diff line number Diff line change
@@ -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 <amxc/amxc.h>
}
10 changes: 10 additions & 0 deletions framework/platform/HLAPI/include/hlapi.h
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 81d14b9

Please sign in to comment.