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.

Jira link: https://jira.prplfoundation.org/browse/PPM-300

Signed-off-by: Anton Bilohai <[email protected]>
  • Loading branch information
abelog committed Aug 5, 2020
1 parent 8735057 commit 3f6759e
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_HLAPI "Build the northbound (high-level) API" 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_HLAPI)
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
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
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/lib>
)

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 3f6759e

Please sign in to comment.