Skip to content

Commit 533bbeb

Browse files
blastrockAlexandre Bossard
authored and
Alexandre Bossard
committed
Initial commit
0 parents  commit 533bbeb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+9395
-0
lines changed

.clang-format

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
---
2+
Language: Cpp
3+
AccessModifierOffset: -2
4+
AlignAfterOpenBracket: Align
5+
AlignConsecutiveAssignments: false
6+
AlignConsecutiveDeclarations: false
7+
AlignEscapedNewlines: Left
8+
AlignOperands: true
9+
AlignTrailingComments: true
10+
AllowAllParametersOfDeclarationOnNextLine: true
11+
AllowShortBlocksOnASingleLine: false
12+
AllowShortCaseLabelsOnASingleLine: false
13+
AllowShortFunctionsOnASingleLine: None
14+
AllowShortIfStatementsOnASingleLine: false
15+
AllowShortLoopsOnASingleLine: false
16+
AlwaysBreakAfterDefinitionReturnType: None
17+
AlwaysBreakAfterReturnType: None
18+
AlwaysBreakBeforeMultilineStrings: true
19+
AlwaysBreakTemplateDeclarations: true
20+
BinPackArguments: false
21+
BinPackParameters: false
22+
BraceWrapping:
23+
AfterClass: true
24+
AfterControlStatement: true
25+
AfterEnum: true
26+
AfterFunction: true
27+
AfterNamespace: true
28+
AfterObjCDeclaration: true
29+
AfterStruct: true
30+
AfterUnion: true
31+
AfterExternBlock: true
32+
BeforeCatch: true
33+
BeforeElse: true
34+
IndentBraces: false
35+
SplitEmptyFunction: true
36+
SplitEmptyRecord: true
37+
SplitEmptyNamespace: true
38+
BreakBeforeBinaryOperators: None
39+
BreakBeforeBraces: Allman
40+
BreakBeforeInheritanceComma: true
41+
BreakBeforeTernaryOperators: true
42+
BreakConstructorInitializersBeforeComma: true
43+
BreakConstructorInitializers: BeforeComma
44+
BreakAfterJavaFieldAnnotations: false
45+
BreakStringLiterals: true
46+
ColumnLimit: 80
47+
CommentPragmas: '^ IWYU pragma:'
48+
CompactNamespaces: true
49+
ConstructorInitializerAllOnOneLineOrOnePerLine: true
50+
ConstructorInitializerIndentWidth: 2
51+
ContinuationIndentWidth: 4
52+
Cpp11BracedListStyle: true
53+
DerivePointerAlignment: false
54+
DisableFormat: false
55+
ExperimentalAutoDetectBinPacking: false
56+
FixNamespaceComments: false
57+
ForEachMacros:
58+
- foreach
59+
- Q_FOREACH
60+
- BOOST_FOREACH
61+
IncludeBlocks: Preserve
62+
IncludeCategories:
63+
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
64+
Priority: 2
65+
- Regex: '^(<|"(gtest|isl|json)/)'
66+
Priority: 3
67+
- Regex: '.*'
68+
Priority: 1
69+
IncludeIsMainRegex: '$'
70+
IndentCaseLabels: false
71+
IndentPPDirectives: None
72+
IndentWidth: 2
73+
IndentWrappedFunctionNames: false
74+
JavaScriptQuotes: Leave
75+
JavaScriptWrapImports: true
76+
KeepEmptyLinesAtTheStartOfBlocks: true
77+
MacroBlockBegin: ''
78+
MacroBlockEnd: ''
79+
MaxEmptyLinesToKeep: 1
80+
NamespaceIndentation: None
81+
ObjCBlockIndentWidth: 2
82+
ObjCSpaceAfterProperty: false
83+
ObjCSpaceBeforeProtocolList: false
84+
PenaltyBreakAssignment: 2
85+
PenaltyBreakBeforeFirstCallParameter: 1
86+
PenaltyBreakComment: 60
87+
PenaltyBreakFirstLessLess: 120
88+
PenaltyBreakString: 1000
89+
PenaltyExcessCharacter: 1000000
90+
PenaltyReturnTypeOnItsOwnLine: 200
91+
PointerAlignment: Left
92+
RawStringFormats:
93+
- Delimiter: pb
94+
Language: TextProto
95+
BasedOnStyle: google
96+
ReflowComments: true
97+
SortIncludes: true
98+
SortUsingDeclarations: true
99+
SpaceAfterCStyleCast: false
100+
SpaceAfterTemplateKeyword: true
101+
SpaceBeforeAssignmentOperators: true
102+
SpaceBeforeParens: ControlStatements
103+
SpaceInEmptyParentheses: false
104+
SpacesBeforeTrailingComments: 1
105+
SpacesInAngles: false
106+
SpacesInContainerLiterals: true
107+
SpacesInCStyleCastParentheses: false
108+
SpacesInParentheses: false
109+
SpacesInSquareBrackets: false
110+
Standard: Auto
111+
TabWidth: 8
112+
UseTab: Never
113+
...
114+

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.venv/
2+
build*/
3+
*.egg-info/
4+
Testing/

.gitlab-ci.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
before_script:
2+
- dmenv install
3+
4+
stages:
5+
- build
6+
7+
build/linux:
8+
stage: build
9+
tags:
10+
- linux
11+
script:
12+
- dmenv run -- python run-ci.py --profile gcc8
13+
14+
build/macos:
15+
stage: build
16+
tags:
17+
- macos
18+
script:
19+
- dmenv run -- python run-ci.py --profile macos

.nvimrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
let g:clang_format_path='clang-format-6.0'
2+
function! Formatonsave()
3+
"let l:formatdiff = 0
4+
let l:lines = 'all'
5+
pyf ~/.vim/clang-format.py
6+
endfunction
7+
autocmd BufWritePre *.h,*.cc,*.cpp,*.hpp,*.c call Formatonsave()

CMakeLists.txt

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
cmake_minimum_required(VERSION 3.4)
2+
3+
project(tconcurrent)
4+
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
5+
conan_basic_setup(TARGETS)
6+
7+
set(CMAKE_CXX_STANDARD 14)
8+
set(CMAKE_CXX_EXTENSIONS OFF)
9+
10+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
11+
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
12+
13+
14+
set(tconcurrent_SRC
15+
src/barrier.cpp
16+
src/periodic_task.cpp
17+
src/stepper.cpp
18+
)
19+
20+
set(tconcurrent_LIBS
21+
)
22+
23+
if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
24+
list(APPEND tconcurrent_LIBS
25+
CONAN_PKG::Boost
26+
CONAN_PKG::enum-flags
27+
)
28+
list(APPEND tconcurrent_SRC
29+
src/async_wait_emscripten.cpp
30+
src/executor_emscripten.cpp
31+
)
32+
else()
33+
find_package(Boost 1.61 REQUIRED COMPONENTS system thread context)
34+
35+
list(APPEND tconcurrent_SRC
36+
src/async_wait.cpp
37+
src/executor.cpp
38+
src/stackful_coroutine.cpp
39+
src/thread_pool.cpp
40+
)
41+
list(APPEND tconcurrent_LIBS
42+
# Keep components, to avoid linking with everything
43+
Boost::system
44+
Boost::thread
45+
Boost::context
46+
CONAN_PKG::enum-flags
47+
)
48+
endif()
49+
50+
add_library(tconcurrent ${tconcurrent_SRC})
51+
52+
target_include_directories(tconcurrent PUBLIC
53+
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
54+
$<INSTALL_INTERFACE:include>
55+
)
56+
57+
target_link_libraries(tconcurrent PUBLIC ${tconcurrent_LIBS})
58+
59+
target_compile_definitions(tconcurrent PRIVATE
60+
TCONCURRENT_USE_THREAD_LOCAL=$<COMPILE_FEATURES:cxx_thread_local>
61+
)
62+
63+
install(TARGETS tconcurrent
64+
EXPORT tconcurrent
65+
RUNTIME DESTINATION bin
66+
LIBRARY DESTINATION lib
67+
ARCHIVE DESTINATION lib
68+
)
69+
70+
install(DIRECTORY include
71+
DESTINATION .
72+
)
73+
74+
install(EXPORT tconcurrent
75+
DESTINATION lib/cmake/tconcurrent
76+
FILE "tconcurrent-config.cmake"
77+
NAMESPACE tconcurrent::
78+
)
79+
80+
include(CTest)
81+
82+
if(BUILD_TESTING)
83+
enable_testing()
84+
add_subdirectory(test)
85+
endif()

LICENSE

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Copyright 2018 Kontrol SAS
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.

README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
2+
3+
# Tanker coroutine library
4+
5+
## Table of Contents
6+
7+
* [Overview](#overview)
8+
* [Setup](#setup)
9+
* [Doc](#Doc)
10+
* [Contributing](#contributing)
11+
* [License and Terms](#license-and-terms)
12+
13+
## Overview
14+
15+
tconcurrent is a coroutine library that allows writing asynchronous code that is both C++14 and coroutines-TS-compatible.
16+
17+
### Setup
18+
19+
We are actively working to allow external developers to build and test this SDK from its source.
20+
21+
### Doc
22+
23+
To generate and open documentation:
24+
25+
```
26+
$ cd doc && doxygen && xdg-open build/html/index.html
27+
```
28+
29+
## Contributing
30+
31+
We welcome feedback. Feel free to open any issue on the Github bug tracker.
32+
33+
## License and Terms
34+
35+
The tconcurrent library is licensed under the
36+
[Apache License, version 2.0](http://www.apache.org/licenses/LICENSE-2.0).

conanfile.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[build_requires]
2+
doctest/2.0.1@tanker/testing
3+
4+
[requires]
5+
Boost/1.66.0@tanker/testing
6+
enum-flags/0.1a@tanker/testing
7+
8+
[generators]
9+
cmake

0 commit comments

Comments
 (0)