-
Notifications
You must be signed in to change notification settings - Fork 1
feat: Add basic implementation of C++ Client #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
b449c20
feat: CPP SDK (#:386)
tomasz-blasz d932cd9
feat: Adapt C++ SDK to changes in transport layer (#:393)
tomasz-blasz f1ba222
feat: Support for event handling in demo app (#:405)
tomasz-blasz 68be032
Merge branch 'main' into feature/cpp-client
tomasz-blasz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| build/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| # Copyright 2023 Comcast Cable Communications Management, LLC | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| cmake_minimum_required(VERSION 3.3) | ||
|
|
||
| list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") | ||
| include(HelperFunctions) | ||
|
|
||
| project(FireboltSDK) | ||
| project_version("1.0.0") | ||
|
|
||
| set(FIREBOLT_TRANSPORT_WAITTIME 1000 CACHE STRING "Maximum time to wait for Transport layer to get response") | ||
| set(FIREBOLT_LOGLEVEL "Info" CACHE STRING "Log level to be enabled") | ||
| option(FIREBOLT_ENABLE_STATIC_LIB "Create Firebolt library as Static library" OFF) | ||
| option(ENABLE_TESTS "Build openrpc native test" OFF) | ||
| option(ENABLE_DEMO_APP "Build demo app" OFF) | ||
|
|
||
| if (FIREBOLT_ENABLE_STATIC_LIB) | ||
| set(FIREBOLT_LIBRARY_TYPE STATIC) | ||
| add_compile_definitions(FIREBOLTSDK_STATIC) | ||
| else () | ||
| set(FIREBOLT_LIBRARY_TYPE SHARED) | ||
| endif () | ||
|
|
||
| if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) | ||
| set(CMAKE_INSTALL_PREFIX "${SYSROOT_PATH}/usr" CACHE INTERNAL "" FORCE) | ||
| set(CMAKE_PREFIX_PATH ${SYSROOT_PATH}/usr/lib/cmake CACHE INTERNAL "" FORCE) | ||
| endif() | ||
|
|
||
| list(APPEND CMAKE_MODULE_PATH | ||
| "${SYSROOT_PATH}/usr/lib/cmake" | ||
| "${SYSROOT_PATH}/tools/cmake") | ||
|
|
||
| set(FIREBOLT_NAMESPACE ${PROJECT_NAME} CACHE STRING "Namespace of the project") | ||
|
|
||
| add_subdirectory(src) | ||
|
|
||
| if (ENABLE_DEMO_APP) | ||
| add_subdirectory(demo) | ||
| endif() | ||
|
|
||
| if (ENABLE_TESTS) | ||
| add_subdirectory(test) | ||
| endif() | ||
|
|
||
| message("${CMAKE_BINARY_DIR}/${FIREBOLT_NAMESPACE}Config.cmake") | ||
|
|
||
| # make sure others can make use cmake settings of Firebolt OpenRPC | ||
| configure_file( "${CMAKE_SOURCE_DIR}/cmake/project.cmake.in" | ||
| "${CMAKE_BINARY_DIR}/${FIREBOLT_NAMESPACE}Config.cmake" | ||
| @ONLY) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| set -e | ||
|
|
||
| case $1 in | ||
| '') ;; | ||
| --) shift;; | ||
| *) SYSROOT_PATH="$1"; shift;; | ||
| esac | ||
| [[ ! -z $SYSROOT_PATH ]] || { echo "SYSROOT_PATH not set" >/dev/stderr; exit 1; } | ||
| [[ -e $SYSROOT_PATH ]] || { echo "SYSROOT_PATH not exist ($SYSROOT_PATH)" >/dev/stderr; exit 1; } | ||
|
|
||
| bdir="build" | ||
| idir="install" | ||
| rm -rf $bdir $idir | ||
| cmake -B $bdir -DSYSROOT_PATH=$SYSROOT_PATH "$@" | ||
| cmake --build $bdir | ||
| cmake --install $bdir | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| # | ||
| # If not stated otherwise in this file or this component's LICENSE file the | ||
| # following copyright and licenses apply: | ||
| # | ||
| # Copyright 2025 Sky UK | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| # | ||
|
|
||
| macro(project_version) | ||
| string(REGEX REPLACE "^v?([0-9]+)\\.([0-9]+)\\.([0-9]+).*" "\\1" _VERSION_MAJOR "${ARGV0}") | ||
| string(REGEX REPLACE "^v?([0-9]+)\\.([0-9]+)\\.([0-9]+).*" "\\2" _VERSION_MINOR "${ARGV0}") | ||
| string(REGEX REPLACE "^v?([0-9]+)\\.([0-9]+)\\.([0-9]+).*" "\\3" _VERSION_PATCH "${ARGV0}") | ||
|
|
||
| set(PROJECT_VERSION_MAJOR ${_VERSION_MAJOR}) | ||
| set(PROJECT_VERSION_MINOR ${_VERSION_MINOR}) | ||
| set(PROJECT_VERSION_PATCH ${_VERSION_PATCH}) | ||
|
|
||
| set(PROJECT_VERSION ${_VERSION_MAJOR}.${_VERSION_MINOR}.${_VERSION_PATCH}) | ||
| set(VERSION ${PROJECT_VERSION}) | ||
| endmacro() | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| # Copyright 2023 Comcast Cable Communications Management, LLC | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| set(FIREBOLT_NAMESPACE "@FIREBOLT_NAMESPACE@" CACHE INTERNAL "" FORCE) | ||
| set("${FIREBOLT_NAMESPACE}_FOUND" TRUE CACHE INTERNAL "" FORCE) | ||
|
|
||
| list(APPEND CMAKE_MODULE_PATH | ||
| "${CMAKE_SOURCE_DIR}/cmake" | ||
| "${SYSROOT_PATH}/usr/lib/cmake" | ||
| "${SYSROOT_PATH}/usr/lib/cmake/Firebolt" | ||
| "${SYSROOT_PATH}/tools/cmake") | ||
|
|
||
| if (NOT DEFINED CMAKE_PREFIX_PATH) | ||
| set(CMAKE_PREFIX_PATH ${SYSROOT_PATH}/usr/lib/cmake CACHE INTERNAL "" FORCE) | ||
| endif() | ||
|
|
||
| if (FIREBOLT_ENABLE_STATIC_LIB) | ||
| set(FIREBOLT_LIBRARY_TYPE STATIC) | ||
| else () | ||
| set(FIREBOLT_LIBRARY_TYPE SHARED) | ||
| endif () | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| # Copyright 2023 Comcast Cable Communications Management, LLC | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| cmake_minimum_required(VERSION 3.10.0) | ||
|
|
||
| project(FireboltCoreSDKDemo) | ||
|
|
||
| if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) | ||
| set(CMAKE_INSTALL_PREFIX "${SYSROOT_PATH}/usr" CACHE INTERNAL "" FORCE) | ||
| set(CMAKE_PREFIX_PATH ${SYSROOT_PATH}/usr/lib/cmake CACHE INTERNAL "" FORCE) | ||
| endif() | ||
|
|
||
| list(APPEND CMAKE_MODULE_PATH | ||
| "${SYSROOT_PATH}/usr/lib/cmake" | ||
| "${SYSROOT_PATH}/tools/cmake") | ||
|
|
||
| message("FIREBOLT_PATH inside cmake " ${FIREBOLT_PATH}) | ||
| if (FIREBOLT_PATH) | ||
| set(CMAKE_FIREBOLT_PATH | ||
| "${FIREBOLT_PATH}/usr/lib/cmake/FireboltSDK") | ||
| list(APPEND CMAKE_PREFIX_PATH ${CMAKE_FIREBOLT_PATH}) | ||
| list(APPEND CMAKE_MODULE_PATH ${CMAKE_FIREBOLT_PATH}) | ||
| else () | ||
| set(FIREBOLT_PATH "${SYSROOT_PATH}" CACHE INTERNAL "" FORCE) | ||
| endif () | ||
|
|
||
| if (STUB_FIREBOLT) | ||
| endif() | ||
|
|
||
| # Do not look for FireboltSDK if been called from the main cmake | ||
| if (NOT ENABLE_DEMO_APP) | ||
| find_package(FireboltSDK CONFIG REQUIRED) | ||
| endif () | ||
|
|
||
| message("Setup ${PROJECT_NAME}") | ||
|
|
||
| add_executable(${PROJECT_NAME} | ||
| FireboltDemoService.cpp | ||
| main.cpp) | ||
|
|
||
| target_link_libraries(${PROJECT_NAME} | ||
| PRIVATE | ||
| FireboltSDK::FireboltSDK | ||
| ) | ||
|
|
||
| target_include_directories(${PROJECT_NAME} | ||
| PRIVATE | ||
| $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include/> | ||
| ) | ||
|
|
||
| set_target_properties(${PROJECT_NAME} PROPERTIES | ||
| CXX_STANDARD 17 | ||
| CXX_STANDARD_REQUIRED YES | ||
| ) | ||
|
|
||
| install( | ||
| TARGETS ${PROJECT_NAME} | ||
| DESTINATION bin | ||
| ) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The script should use
set -eufor strict error handling instead of justset -e. This is consistent with the repository's convention for bash scripts as seen in other scripts.