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

Commit 81d14b9

Browse files
committed
cmake: create separate HLAPI library
Create new Hight Level API library, which should handle interactions with different system buses. Signed-off-by: Anton Bilohai <a.bilohai@inango-systems.com>
1 parent 4b31821 commit 81d14b9

5 files changed

Lines changed: 69 additions & 1 deletion

File tree

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ option (BUILD_AGENT "Build EasyMesh agent" ON)
1414
option (BUILD_CONTROLLER "Build EasyMesh controller" ON)
1515

1616
option(BUILD_SHARED_LIBS "Build shared libraries (.so) instead of static ones (.a)" ON)
17+
option (ENABLE_AMBIORIX "Include Bus agnostic API in the build" OFF)
1718

1819
## Generic checks and defaults
1920

framework/platform/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
add_subdirectory(bpl)
1+
add_subdirectory(bpl)
2+
if (ENABLE_AMBIORIX)
3+
add_subdirectory(HLAPI)
4+
endif()
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
project(hlapi VERSION ${prplmesh_VERSION})
2+
3+
message("${BoldWhite}Preparing ${BoldGreen}${PROJECT_NAME}${BoldWhite} for the ${BoldGreen}${TARGET_PLATFORM}${BoldWhite} platform${ColourReset}")
4+
5+
# Set the base path for the current module
6+
set(MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
7+
8+
# Common Sources
9+
file(GLOB_RECURSE hlapi_sources ${MODULE_PATH}/*.c*)
10+
11+
# Include AMBIORIX in the build
12+
message(STATUS "ENABLE_AMBIORIX: ${ENABLE_AMBIORIX}")
13+
find_package(amxb REQUIRED)
14+
find_package(amxc REQUIRED)
15+
find_package(amxd REQUIRED)
16+
find_package(amxj REQUIRED)
17+
find_package(amxo REQUIRED)
18+
find_package(amxp REQUIRED)
19+
list(APPEND HLAPI_LIBS amxb amxc amxd amxj amxo amxp)
20+
21+
22+
# Build the library
23+
add_library(${PROJECT_NAME} ${hlapi_sources})
24+
set_target_properties(${PROJECT_NAME} PROPERTIES VERSION ${prplmesh_VERSION} SOVERSION ${prplmesh_VERSION_MAJOR})
25+
set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "-Wl,-z,defs")
26+
target_link_libraries(${PROJECT_NAME} PRIVATE ${HLAPI_LIBS})
27+
28+
# Install
29+
target_include_directories(${PROJECT_NAME}
30+
PUBLIC
31+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
32+
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
33+
)
34+
35+
install(TARGETS ${PROJECT_NAME}
36+
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
37+
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
38+
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
39+
)
40+
41+
if(BUILD_TESTS)
42+
add_subdirectory(test)
43+
endif()

framework/platform/HLAPI/hlapi.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/* SPDX-License-Identifier: BSD-2-Clause-Patent
2+
*
3+
* SPDX-FileCopyrightText: 2020 the prplMesh contributors (see AUTHORS.md)
4+
*
5+
* This code is subject to the terms of the BSD+Patent license.
6+
* See LICENSE file for more details.
7+
*/
8+
9+
extern "C" {
10+
#include <amxc/amxc.h>
11+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/* SPDX-License-Identifier: BSD-2-Clause-Patent
2+
*
3+
* SPDX-FileCopyrightText: 2016-2020 the prplMesh contributors (see AUTHORS.md)
4+
*
5+
* This code is subject to the terms of the BSD+Patent license.
6+
* See LICENSE file for more details.
7+
*/
8+
9+
#ifndef _HL_API_H
10+
#define _HL_API_H

0 commit comments

Comments
 (0)