-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Basic CI, issue templates and cmake with simple example
- Loading branch information
1 parent
91ffbe6
commit c82f2fb
Showing
10 changed files
with
374 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,82 @@ | ||
--- | ||
# for complete code formatting of codebase please type: | ||
# "find . -type f -regex '.*\.\(inl\|cpp\|h\|hpp\|cc\|c\|cxx\)' -exec clang-format -style=file -i {} \;" | ||
Language: Cpp | ||
# BasedOnStyle: LLVM | ||
AccessModifierOffset: -2 | ||
AlignAfterOpenBracket: Align | ||
AlignConsecutiveAssignments: false | ||
AlignConsecutiveDeclarations: false | ||
AlignEscapedNewlinesLeft: false | ||
AlignOperands: true | ||
AlignTrailingComments: true | ||
AllowAllParametersOfDeclarationOnNextLine: true | ||
AllowShortBlocksOnASingleLine: false | ||
AllowShortCaseLabelsOnASingleLine: false | ||
AllowShortFunctionsOnASingleLine: None | ||
AllowShortIfStatementsOnASingleLine: false | ||
AllowShortLoopsOnASingleLine: false | ||
AlwaysBreakAfterDefinitionReturnType: None | ||
AlwaysBreakAfterReturnType: None | ||
AlwaysBreakBeforeMultilineStrings: false | ||
AlwaysBreakTemplateDeclarations: true | ||
BinPackArguments: false | ||
BinPackParameters: false # If false, a function declaration's or function definition's parameters will either all be on the same line or will have one line each. | ||
BreakBeforeBraces: Custom | ||
BraceWrapping: | ||
AfterCaseLabel: true | ||
AfterClass: true | ||
AfterControlStatement: true | ||
AfterEnum: true | ||
AfterFunction: true | ||
AfterNamespace: true | ||
AfterObjCDeclaration: true | ||
AfterStruct: true | ||
AfterUnion: true | ||
BeforeCatch: true | ||
BeforeElse: true | ||
IndentBraces: false | ||
BreakBeforeBinaryOperators: NonAssignment | ||
BreakBeforeTernaryOperators: true | ||
BreakConstructorInitializersBeforeComma: true | ||
ColumnLimit: 120 | ||
CompactNamespaces: true | ||
ConstructorInitializerAllOnOneLineOrOnePerLine: false | ||
ConstructorInitializerIndentWidth: 4 | ||
ContinuationIndentWidth: 4 | ||
Cpp11BracedListStyle: true | ||
DerivePointerAlignment: false | ||
DisableFormat: false | ||
ExperimentalAutoDetectBinPacking: false | ||
FixNamespaceComments: true | ||
IndentCaseLabels: false | ||
IndentWidth: 4 | ||
IndentWrappedFunctionNames: false | ||
KeepEmptyLinesAtTheStartOfBlocks: false | ||
MacroBlockBegin: '' | ||
MacroBlockEnd: '' | ||
MaxEmptyLinesToKeep: 2 | ||
NamespaceIndentation: None | ||
PenaltyBreakBeforeFirstCallParameter: 19 | ||
PenaltyBreakComment: 300 | ||
PenaltyBreakFirstLessLess: 120 | ||
PenaltyBreakString: 1000 | ||
PenaltyExcessCharacter: 1000000 | ||
PenaltyReturnTypeOnItsOwnLine: 60 | ||
PointerAlignment: Left | ||
ReflowComments: true | ||
SortIncludes: true | ||
SpaceAfterCStyleCast: false | ||
SpaceBeforeAssignmentOperators: true | ||
SpaceBeforeParens: ControlStatements | ||
SpaceInEmptyParentheses: false | ||
SpacesBeforeTrailingComments: 1 | ||
SpacesInAngles: false | ||
SpacesInContainerLiterals: false | ||
SpacesInCStyleCastParentheses: false | ||
SpacesInParentheses: false | ||
SpacesInSquareBrackets: false | ||
Standard: c++14 | ||
TabWidth: 4 | ||
UseTab: Never | ||
... |
This file contains 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,25 @@ | ||
--- | ||
name: Bug report | ||
about: Create a report to help us improve | ||
title: '' | ||
labels: '' | ||
assignees: '' | ||
|
||
--- | ||
|
||
## Required information | ||
|
||
**Operating system:** | ||
E.g. Ubuntu 18.04 LTS | ||
|
||
**Compiler version:** | ||
E.g. GCC 7.4.0 | ||
|
||
**Observed result or behaviour:** | ||
A clear and precise description of the observed result. | ||
|
||
**Expected result or behaviour:** | ||
What do you expect to happen? | ||
|
||
**Conditions where it occurred / Performed steps:** | ||
Describe how one can reproduce the bug. |
This file contains 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,16 @@ | ||
--- | ||
name: Feature request | ||
about: Suggest an idea for this project | ||
title: '' | ||
labels: '' | ||
assignees: '' | ||
|
||
--- | ||
|
||
## Brief feature description | ||
|
||
Please describe in a few sentences what should be implemented | ||
|
||
## Detailed information | ||
|
||
E.g. a list of pros and cons of different considerations and how iceoryx and its user could benefit from it |
This file contains 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,29 @@ | ||
## Pre-Review Checklist for the PR Author | ||
|
||
1. [ ] Code is formatted with clang-format | ||
1. [ ] Update the PR title | ||
- Follow the same conventions as for commit messages | ||
- Link to the relevant issue | ||
1. [ ] Relevant issues are linked | ||
1. [ ] Add sensible notes for the reviewer | ||
1. [ ] All checks have passed | ||
1. [ ] Assign PR to reviewer | ||
|
||
## Notes for Reviewer | ||
<!-- Items in addition to the checklist below that the reviewer should look for --> | ||
|
||
## Checklist for the PR Reviewer | ||
|
||
- [ ] Commits are properly organized and messages are according to the guideline | ||
- [ ] Code according to our coding style and naming conventions | ||
- [ ] Unit tests have been written for new behavior | ||
- [ ] Copyright owner are updated in the changed files | ||
- [ ] PR title describes the changes | ||
|
||
## Post-review Checklist for the PR Author | ||
|
||
1. [ ] All open points are addressed and tracked via issues | ||
|
||
## References | ||
|
||
- Closes **TBD** |
This file contains 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,18 @@ | ||
# This workflow builds the repo | ||
|
||
name: Build | ||
|
||
# Triggers the workflow on push or pull request events but only for the main branch | ||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main, release* ] | ||
|
||
jobs: | ||
build-ubuntu: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- run: cmake -B build && cmake --build build | ||
|
This file contains 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,6 @@ | ||
build | ||
install | ||
clangd | ||
.vscode | ||
*.project | ||
__pycache__ |
This file contains 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,90 @@ | ||
# Copyright (c) 2022 by Apex.AI Inc. All rights reserved. | ||
# | ||
# 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.16) | ||
|
||
# check if iceoryx is in CMAKE_PREFIX_PATH | ||
find_package(iceoryx_hoofs QUIET) | ||
find_package(iceoryx_posh QUIET) | ||
|
||
# fetch iceoryx if not found | ||
if(NOT iceoryx_hoofs_FOUND OR NOT iceoryx_posh_FOUND) | ||
if(iceoryx_hoofs_FOUND) | ||
message(FATAL_ERROR "iceoryx_hoofs was not found with 'find_package' but other parts were found!") | ||
endif() | ||
if(iceoryx_posh_FOUND) | ||
message(FATAL_ERROR "iceoryx_posh was not found with 'find_package' but other parts were found!") | ||
endif() | ||
|
||
include(FetchContent) | ||
FetchContent_Declare( | ||
iceoryx | ||
GIT_REPOSITORY https://github.com/eclipse-iceoryx/iceoryx.git | ||
GIT_TAG v2.0.2 | ||
) | ||
FetchContent_GetProperties(iceoryx) | ||
if (NOT iceoryx_POPULATED) | ||
message(STATUS "updating: iceoryx" ) | ||
FetchContent_Populate(iceoryx) | ||
endif() | ||
|
||
set(ICEORYX_WITH_FETCH_CONTENT true CACHE INTERNAL "") | ||
set(iceoryx_SOURCE_DIR ${iceoryx_SOURCE_DIR} CACHE INTERNAL "") | ||
set(iceoryx_BINARY_DIR ${iceoryx_BINARY_DIR} CACHE INTERNAL "") | ||
endif() | ||
|
||
if(ICEORYX_WITH_FETCH_CONTENT) | ||
add_subdirectory(${iceoryx_SOURCE_DIR}/iceoryx_hoofs ${iceoryx_BINARY_DIR}/iceoryx_hoofs) | ||
add_subdirectory(${iceoryx_SOURCE_DIR}/iceoryx_posh ${iceoryx_BINARY_DIR}/iceoryx_posh) | ||
|
||
find_package(iceoryx_posh REQUIRED) | ||
find_package(iceoryx_hoofs REQUIRED) | ||
endif() | ||
|
||
include(IceoryxPlatform) | ||
|
||
project(iceoryx_project_template) | ||
|
||
add_executable(publisher src/publisher.cpp) | ||
target_link_libraries(publisher | ||
iceoryx_hoofs::iceoryx_hoofs | ||
iceoryx_posh::iceoryx_posh | ||
) | ||
|
||
add_executable(subscriber src/subscriber.cpp) | ||
target_link_libraries(subscriber | ||
iceoryx_hoofs::iceoryx_hoofs | ||
iceoryx_posh::iceoryx_posh | ||
) | ||
|
||
set_target_properties( | ||
publisher | ||
subscriber | ||
PROPERTIES | ||
CXX_STANDARD_REQUIRED ON | ||
CXX_STANDARD ${ICEORYX_CXX_STANDARD} | ||
POSITION_INDEPENDENT_CODE ON | ||
) | ||
|
||
if(ICEORYX_WITH_FETCH_CONTENT) | ||
message(" | ||
############################################################# | ||
The project was build by obtaining iceoryx with FetchContent. | ||
If you want to use an existing installation use | ||
'-DCMAKE_PREFIX_PATH=/path/to/installed/iceoryx'! | ||
############################################################# | ||
") | ||
endif() |
This file contains 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,15 @@ | ||
# Project template to easily get started with iceoryx | ||
|
||
This is a small template to easily get started with iceoryx. Just fork the repo | ||
and start to develop your iceoryx based applications. | ||
|
||
Just run `cmake -B build && cmake --build build`. If iceoryx is not found on the system, | ||
it is automatically fetched from github and build. | ||
|
||
In case you want to use an already pre-build iceoryx, just specify the `CMAKE_PREFIX_PATH` | ||
like `cmake -DCMAKE_PREFIX_PATH=/path/to/installed/iceoryx -B build && cmake --build build`. | ||
|
||
The `src` folder contains two simple applications, one with a subscriber and one with a | ||
publisher. | ||
|
||
Happy Hacking |
This file contains 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,47 @@ | ||
// Copyright (c) 2022 by Apex.AI Inc. All rights reserved. | ||
// | ||
// 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 | ||
|
||
#include "iceoryx_posh/popo/publisher.hpp" | ||
#include "iceoryx_hoofs/posix_wrapper/signal_watcher.hpp" | ||
#include "iceoryx_posh/runtime/posh_runtime.hpp" | ||
|
||
#include <cstdint> | ||
#include <iostream> | ||
|
||
int main() | ||
{ | ||
constexpr const char APP_NAME[]{"publihser"}; | ||
iox::runtime::PoshRuntime::initRuntime(APP_NAME); | ||
|
||
iox::popo::Publisher<uint64_t> publisher({"MyApp", "Counter", "u64"}); | ||
|
||
uint64_t counter{1U}; | ||
while (!iox::posix::hasTerminationRequested()) | ||
{ | ||
publisher.loan() | ||
.and_then([&](auto& sample) { | ||
*sample = counter; | ||
sample.publish(); | ||
std::cout << "Hello World: " << counter << std::endl; | ||
++counter; | ||
}) | ||
.or_else([](auto& error) { std::cerr << "Unable to loan sample, error: " << error << std::endl; }); | ||
|
||
std::this_thread::sleep_for(std::chrono::seconds(1)); | ||
} | ||
|
||
return EXIT_SUCCESS; | ||
} |
This file contains 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,46 @@ | ||
// Copyright (c) 2022 by Apex.AI Inc. All rights reserved. | ||
// | ||
// 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 | ||
|
||
#include "iceoryx_posh/popo/subscriber.hpp" | ||
#include "iceoryx_hoofs/posix_wrapper/signal_watcher.hpp" | ||
#include "iceoryx_posh/runtime/posh_runtime.hpp" | ||
|
||
#include <cstdint> | ||
#include <iostream> | ||
|
||
int main() | ||
{ | ||
constexpr const char APP_NAME[]{"subscriber"}; | ||
iox::runtime::PoshRuntime::initRuntime(APP_NAME); | ||
|
||
iox::popo::Subscriber<uint64_t> subscriber({"MyApp", "Counter", "u64"}); | ||
|
||
while (!iox::posix::hasTerminationRequested()) | ||
{ | ||
subscriber.take() | ||
.and_then([](auto& sample) { std::cout << "Hello World: " << *sample << std::endl; }) | ||
.or_else([](auto& result) { | ||
if (result != iox::popo::ChunkReceiveResult::NO_CHUNK_AVAILABLE) | ||
{ | ||
std::cout << "Error receiving chunk." << std::endl; | ||
} | ||
}); | ||
|
||
std::this_thread::sleep_for(std::chrono::milliseconds(100)); | ||
} | ||
|
||
return EXIT_SUCCESS; | ||
} |