Skip to content
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

Adding support for full build #20

Merged
merged 35 commits into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
40ef4bd
Update README.md
MelamudMichael Feb 29, 2024
22a9728
Delete samples directory
MelamudMichael Feb 29, 2024
dd0e27d
Merge branch 'eclipse-uprotocol:main' into main
MelamudMichael Mar 2, 2024
c4fbf18
Merge branch 'eclipse-uprotocol:main' into main
MelamudMichael Mar 6, 2024
783f9f0
enabling full build
MelamudMichael Mar 10, 2024
39fecbe
Update CMakeLists.txt
MelamudMichael Mar 10, 2024
8ab3cf3
fixing compilation
MelamudMichael Mar 10, 2024
c5aa5c8
fixing compilation
MelamudMichael Mar 10, 2024
9c08214
updating version
MelamudMichael Mar 10, 2024
94779f7
Update conanfile.py
MelamudMichael Mar 10, 2024
238b3e3
Update ci.yml
MelamudMichael Mar 10, 2024
8d7a232
Delete conaninfo directory
MelamudMichael Mar 10, 2024
6e24e1f
Update ci.yml
MelamudMichael Mar 10, 2024
fd385a6
Update conanfile.py
MelamudMichael Mar 10, 2024
72ce57b
Update ci.yml
MelamudMichael Mar 10, 2024
bc234f0
Update conanfile.py
MelamudMichael Mar 10, 2024
67e535e
Update ci.yml
MelamudMichael Mar 10, 2024
a76d23c
Update CMakeLists.txt
MelamudMichael Mar 10, 2024
2eb7752
Update CMakeLists.txt
MelamudMichael Mar 10, 2024
2950ae7
Update CMakeLists.txt
MelamudMichael Mar 10, 2024
07a2ef2
Update CMakeLists.txt
MelamudMichael Mar 10, 2024
0a717e5
Update CMakeLists.txt
MelamudMichael Mar 10, 2024
fae945c
Update CMakeLists.txt
MelamudMichael Mar 10, 2024
bcd6493
Update CMakeLists.txt
MelamudMichael Mar 10, 2024
d8ef779
Update CMakeLists.txt
MelamudMichael Mar 10, 2024
07ead14
Update CMakeLists.txt
MelamudMichael Mar 11, 2024
37ec538
Update conanfile.py
MelamudMichael Mar 11, 2024
1de9db4
Update conanfile.py
MelamudMichael Mar 11, 2024
e80537e
adding unittests stub
MelamudMichael Mar 11, 2024
dc4de9d
Update conanfile.py
MelamudMichael Mar 11, 2024
de41aac
adding spdlog
MelamudMichael Mar 11, 2024
6b37426
Update ci.yml
MelamudMichael Mar 12, 2024
12e0180
Update conanfile.py
MelamudMichael Mar 12, 2024
c35bb2c
Update README.md
MelamudMichael Mar 12, 2024
aca214d
changing to 2024
MelamudMichael Mar 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ jobs:
run: |
git clone https://github.com/eclipse-uprotocol/up-cpp.git
cd up-cpp
git clone -b uprotocol-core-api-1.5.6 https://github.com/eclipse-uprotocol/up-core-api.git
git submodule update --init --recursive
conan create . --build=missing

Expand All @@ -50,9 +49,10 @@ jobs:
- name: Build && install up-client-zenoh-cpp
shell: bash
run: |
conan install conaninfo/ --output-folder=.
cd build/Release
cmake ../../ -DCMAKE_TOOLCHAIN_FILE=generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=~/local
mkdir build
cd build
conan install ../ -o build_unbundled=True -o zenoh_package=False
cmake ../ -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=~/local
cmake --build . --target install --config Release -- -j


Expand All @@ -69,4 +69,4 @@ jobs:
if: always()
steps:
- name: Check whether all jobs pass
run: echo '${{ toJson(needs) }}' | jq -e 'all(.result == "success")'
run: echo '${{ toJson(needs) }}' | jq -e 'all(.result == "success")'
7 changes: 4 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2023 General Motors GTO LLC
# Copyright (c) 2024 General Motors GTO LLC
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
Expand Down Expand Up @@ -36,6 +36,7 @@ endif()

add_subdirectory(lib)

if(BUILD_SAMPLES)
add_subdirectory(samples)
if(BUILD_TESTING)
enable_testing()
add_subdirectory(test)
endif()
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,9 @@ This module contains the implementation for pub-sub and RPC API`s defined in the
$ git clone https://github.com/eclipse-uprotocol/up-client-zenoh-cpp.git
```
## How to Use the Library
To add up-cpp to your conan build dependencies, simply add the following to your conanfile.txt:
To add up-client-zenoh-cpp to your conan build dependencies, simply add the following to your conanfile.txt:
```
[requires]
up-cpp/0.1
up-cpp-client-zenoh/0.1
protobuf/3.21.12

Expand All @@ -43,10 +42,11 @@ cmake_layout
### Building locally
```
$ cd up-cpp-client-zenoh
$ conan install conaninfo/ --output-folder=.
$ cd build/Release
$ cmake ../../ -DCMAKE_TOOLCHAIN_FILE=generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release
$ make -j
$ mkdir build
$ cd build
$ conan install ../
$ cmake ../ -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release
$ cmake --build . --config Release -- -j
```

#### Creating conan package locally
Expand Down
29 changes: 15 additions & 14 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,40 +16,40 @@ class UpClientZenoh(ConanFile):
options = {"shared": [True, False], "fPIC": [True, False]}
conan_version = None
generators = "CMakeDeps"
version = "0.1"
exports_sources = "CMakeLists.txt", "lib/*"
version = "0.1.2-dev"
exports_sources = "CMakeLists.txt", "lib/*", "test/*"

options = {
"shared": [True, False],
"fPIC": [True, False],
"build_testing": [True, False],
"build_unbundled": [True, False],
"zenoh_package": [True, False],
"build_cross_compiling": [True, False],
}

default_options = {
"shared": False,
"fPIC": False,
"build_testing": False,
"build_unbundled": False,
"build_unbundled": True,
"zenoh_package": False,
"build_cross_compiling": False,
}

# def configure(self):
# self.options["up-cpp"].shared = True

def requirements(self):
if self.options.build_unbundled:
self.requires("up-cpp/0.1.5.0-dev")
self.requires("zenohc/cci.20240213")
self.requires("protobuf/3.21.12" + ("@cross/cross" if self.options.build_cross_compiling else ""))
else:
self.requires("up-cpp/0.1")
self.requires("spdlog/1.13.0")
self.requires("protobuf/3.21.12")
self.requires("protobuf/3.21.12" + ("@cross/cross" if self.options.build_cross_compiling else ""))
self.requires("spdlog/1.13.0")
if self.options.build_testing:
self.requires("gtest/1.14.0")
if self.options.build_unbundled: #each componenet is built independently
self.requires("up-cpp/0.1.1-dev")
if self.options.zenoh_package:
self.requires("zenohc/cci.20240213")

def generate(self):
tc = CMakeToolchain(self)
tc.variables["BUILD_TESTING"] = self.options.build_testing
tc.generate()

def build(self):
Expand All @@ -63,3 +63,4 @@ def package(self):

def package_info(self):
self.cpp_info.libs = ["up-client-zenoh-cpp"]

11 changes: 0 additions & 11 deletions conaninfo/conanfile.txt

This file was deleted.

43 changes: 21 additions & 22 deletions lib/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2023 General Motors GTO LLC
# Copyright (c) 2024 General Motors GTO LLC
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
Expand All @@ -19,14 +19,15 @@
cmake_minimum_required(VERSION 3.20)
project(up-client-zenoh-cpp VERSION 0.1.0 LANGUAGES CXX)

find_package(Protobuf REQUIRED)
find_package(spdlog REQUIRED)

if(BUILD_UNBUNDLED)
find_package(up-cpp REQUIRED)
find_package(zenohc REQUIRED)
else()
find_library(ZENOH_LIB zenohc)
find_package(up-cpp REQUIRED)
find_package(Protobuf REQUIRED)
find_package(spdlog REQUIRED)
find_package(up-cpp QUIET)
endif()

# Support pulling headers outside of /usr/local
Expand All @@ -39,32 +40,30 @@ set(SRC_FILES
src/zenohRpcClient.cpp
src/zenohSessionManager.cpp
src/messageBuilder.cpp
src/messageParser.cpp
)
src/messageParser.cpp)

add_library(${PROJECT_NAME} ${SRC_FILES})
add_library(up-client-zenoh-cpp::${PROJECT_NAME} ALIAS ${PROJECT_NAME})

target_include_directories(${PROJECT_NAME}
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
$ENV{CMAKE_ZENOH_INCLUDE_PATH}
${HOME}/include
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src)

if(BUILD_UNBUNDLED)
target_include_directories(${PROJECT_NAME}
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src
)
target_link_libraries(${PROJECT_NAME}
PRIVATE
PUBLIC
up-cpp::up-cpp
zenohc::lib
)
zenohc::lib)
else()
target_include_directories(${PROJECT_NAME}
PRIVATE
${up-cpp_INCLUDE_DIR}
include
)
target_link_libraries(${PROJECT_NAME} PRIVATE up-cpp::up-cpp ${ZENOH_LIB})
target_link_libraries(${PROJECT_NAME}
PUBLIC
up-cpp::up-cpp
${ZENOH_LIB})
endif()

INSTALL(TARGETS ${PROJECT_NAME})
Expand Down
4 changes: 2 additions & 2 deletions lib/include/up-client-zenoh-cpp/message/messageBuilder.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 General Motors GTO LLC
* Copyright (c) 2024 General Motors GTO LLC
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
Expand All @@ -18,7 +18,7 @@
* specific language governing permissions and limitations
* under the License.
* SPDX-FileType: SOURCE
* SPDX-FileCopyrightText: 2023 General Motors GTO LLC
* SPDX-FileCopyrightText: 2024 General Motors GTO LLC
* SPDX-License-Identifier: Apache-2.0
*/

Expand Down
4 changes: 2 additions & 2 deletions lib/include/up-client-zenoh-cpp/message/messageCommon.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 General Motors GTO LLC
* Copyright (c) 2024 General Motors GTO LLC
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
Expand All @@ -18,7 +18,7 @@
* specific language governing permissions and limitations
* under the License.
* SPDX-FileType: SOURCE
* SPDX-FileCopyrightText: 2023 General Motors GTO LLC
* SPDX-FileCopyrightText: 2024 General Motors GTO LLC
* SPDX-License-Identifier: Apache-2.0
*/

Expand Down
4 changes: 2 additions & 2 deletions lib/include/up-client-zenoh-cpp/message/messageParser.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 General Motors GTO LLC
* Copyright (c) 2024 General Motors GTO LLC
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
Expand All @@ -18,7 +18,7 @@
* specific language governing permissions and limitations
* under the License.
* SPDX-FileType: SOURCE
* SPDX-FileCopyrightText: 2023 General Motors GTO LLC
* SPDX-FileCopyrightText: 2024 General Motors GTO LLC
* SPDX-License-Identifier: Apache-2.0
*/

Expand Down
4 changes: 2 additions & 2 deletions lib/include/up-client-zenoh-cpp/rpc/zenohRpcClient.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 General Motors GTO LLC
* Copyright (c) 2024 General Motors GTO LLC
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
Expand All @@ -18,7 +18,7 @@
* specific language governing permissions and limitations
* under the License.
* SPDX-FileType: SOURCE
* SPDX-FileCopyrightText: 2023 General Motors GTO LLC
* SPDX-FileCopyrightText: 2024 General Motors GTO LLC
* SPDX-License-Identifier: Apache-2.0
*/

Expand Down
4 changes: 2 additions & 2 deletions lib/include/up-client-zenoh-cpp/session/zenohSessionManager.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 General Motors GTO LLC
* Copyright (c) 2024 General Motors GTO LLC
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
Expand All @@ -18,7 +18,7 @@
* specific language governing permissions and limitations
* under the License.
* SPDX-FileType: SOURCE
* SPDX-FileCopyrightText: 2023 General Motors GTO LLC
* SPDX-FileCopyrightText: 2024 General Motors GTO LLC
* SPDX-License-Identifier: Apache-2.0
*/

Expand Down
4 changes: 2 additions & 2 deletions lib/include/up-client-zenoh-cpp/transport/zenohUTransport.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 General Motors GTO LLC
* Copyright (c) 2024 General Motors GTO LLC
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
Expand All @@ -18,7 +18,7 @@
* specific language governing permissions and limitations
* under the License.
* SPDX-FileType: SOURCE
* SPDX-FileCopyrightText: 2023 General Motors GTO LLC
* SPDX-FileCopyrightText: 2024 General Motors GTO LLC
* SPDX-License-Identifier: Apache-2.0
*/

Expand Down
4 changes: 2 additions & 2 deletions lib/src/messageBuilder.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 General Motors GTO LLC
* Copyright (c) 2024 General Motors GTO LLC
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
Expand All @@ -18,7 +18,7 @@
* specific language governing permissions and limitations
* under the License.
* SPDX-FileType: SOURCE
* SPDX-FileCopyrightText: 2023 General Motors GTO LLC
* SPDX-FileCopyrightText: 2024 General Motors GTO LLC
* SPDX-License-Identifier: Apache-2.0
*/

Expand Down
4 changes: 2 additions & 2 deletions lib/src/messageParser.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 General Motors GTO LLC
* Copyright (c) 2024 General Motors GTO LLC
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
Expand All @@ -18,7 +18,7 @@
* specific language governing permissions and limitations
* under the License.
* SPDX-FileType: SOURCE
* SPDX-FileCopyrightText: 2023 General Motors GTO LLC
* SPDX-FileCopyrightText: 2024 General Motors GTO LLC
* SPDX-License-Identifier: Apache-2.0
*/

Expand Down
Loading