-
Notifications
You must be signed in to change notification settings - Fork 217
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* project structure refactor - all header files go to include/concurrencpp directory, TSAN tests to test directory * sources were formatted using clang-format * move to modern cmake * partial move to ctest * CI/CD pipeline with github actions on Windows, Linux and macOS (uses xcode 12.2, clang fails with ICE) * readme improvements Co-authored-by: friendlyanon <[email protected]> Co-authored-by: friendlyanon <[email protected]>
- Loading branch information
1 parent
fbc8c47
commit 547c557
Showing
215 changed files
with
13,266 additions
and
13,219 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
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,100 @@ | ||
name: Continuous Integration | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
pull_request: | ||
branches: | ||
- master | ||
|
||
workflow_dispatch: ~ | ||
|
||
env: | ||
CMAKE_VERSION: 3.18.4 | ||
NINJA_VERSION: 1.10.1 | ||
CTEST_OUTPUT_ON_FAILURE: 1 | ||
NINJA_STATUS: '[%f/%t %o/sec] ' | ||
|
||
jobs: | ||
tests: | ||
strategy: | ||
matrix: | ||
conf: | ||
- name: Ubuntu (Clang 10 - TSAN) | ||
os: ubuntu-20.04 | ||
cc: clang-10 | ||
cxx: clang++-10 | ||
tsan: YES | ||
|
||
- name: Ubuntu (Clang 10 - no TSAN) | ||
os: ubuntu-20.04 | ||
cc: clang-10 | ||
cxx: clang++-10 | ||
tsan: NO | ||
|
||
- name: macOS (Clang 10 - no TSAN) | ||
os: macos-latest | ||
cc: clang | ||
cxx: clang++ | ||
tsan: NO | ||
|
||
- name: Windows (Visual Studio Enterprise 2019) | ||
os: windows-latest | ||
cc: cl | ||
cxx: cl | ||
tsan: NO | ||
|
||
name: ${{ matrix.conf.name }} | ||
|
||
runs-on: ${{ matrix.conf.os }} | ||
|
||
env: | ||
CC: ${{ matrix.conf.cc }} | ||
CXX: ${{ matrix.conf.cxx }} | ||
|
||
steps: | ||
- uses: actions/checkout@v1 | ||
|
||
- uses: friendlyanon/fetch-core-count@v1 | ||
id: cores | ||
|
||
- run: cmake -E make_directory build/tools | ||
|
||
- name: Install CMake and Ninja | ||
id: tools | ||
working-directory: build/tools | ||
run: cmake -D RUNNER_OS=${{ runner.os }} | ||
-P ../../cmake/ciToolsUpdate.cmake | ||
|
||
- name: Combine CI variables | ||
id: args | ||
shell: cmake -P {0} | ||
run: > | ||
message([==[::set-output name=args::${{ matrix.conf.os }} | ||
"${{ steps.tools.outputs.cmake }}" | ||
"${{ steps.tools.outputs.ninja }}" | ||
${{ steps.cores.outputs.plus_one }}]==]) | ||
- name: Build examples | ||
run: cmake -P cmake/ciBuild.cmake -- example build/example | ||
${{ steps.args.outputs.args }} | ||
|
||
- name: Build tests | ||
id: build_tests | ||
continue-on-error: ${{ startsWith(matrix.conf.os, 'macos') }} | ||
run: cmake -P cmake/ciBuild.cmake -- test build/test | ||
${{ steps.args.outputs.args }} | ||
-D ENABLE_THREAD_SANITIZER:BOOL=${{ matrix.conf.tsan }} | ||
|
||
- name: Run tests | ||
continue-on-error: ${{ startsWith(matrix.conf.os, 'macos') }} | ||
if: steps.build_tests.outcome == 'success' | ||
working-directory: build/test | ||
shell: cmake -P {0} | ||
run: > | ||
include(../../cmake/exec.cmake) | ||
exec("${{ steps.tools.outputs.ctest }}" -C Release -V | ||
-j ${{ steps.cores.outputs.plus_one }}) |
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
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 |
---|---|---|
@@ -1,25 +1,113 @@ | ||
cmake_minimum_required(VERSION 3.16) | ||
project(concurrencpp) | ||
|
||
set(CMAKE_CXX_STANDARD 20) | ||
project(concurrencpp | ||
VERSION 0.0.8 | ||
LANGUAGES CXX) | ||
|
||
if (MSVC) | ||
add_compile_options(/W3) | ||
else() | ||
add_compile_options(-Wall -Wextra) | ||
include(cmake/coroutineOptions.cmake) | ||
|
||
option(CONCURRENCPP_ENABLE_TSAN "Enables thread-sanitizer checks" OFF) | ||
if (CONCURRENCPP_ENABLE_TSAN) | ||
add_compile_options(-fsanitize=thread) | ||
add_link_options(-fsanitize=thread) | ||
endif() | ||
# ---- Warning guard ---- | ||
|
||
# Protect dependents from this project's warnings if the guard isn't disabled | ||
set(concurrencpp_warning_guard "SYSTEM") | ||
if(concurrencpp_INCLUDE_WITHOUT_SYSTEM) | ||
set(concurrencpp_warning_guard "") | ||
endif() | ||
|
||
add_subdirectory(concurrencpp) | ||
add_subdirectory(tests) | ||
add_subdirectory(sandbox) | ||
add_subdirectory(examples) | ||
# ---- Declare library ---- | ||
|
||
if (CONCURRENCPP_ENABLE_TSAN) | ||
add_subdirectory(thread_sanitizers) | ||
endif() | ||
set(concurrencpp_sources | ||
source/executors/executor.cpp | ||
source/executors/manual_executor.cpp | ||
source/executors/thread_executor.cpp | ||
source/executors/thread_pool_executor.cpp | ||
source/executors/worker_thread_executor.cpp | ||
source/results/promises.cpp | ||
source/results/result_core.cpp | ||
source/runtime/runtime.cpp | ||
source/threads/thread.cpp | ||
source/timers/timer.cpp | ||
source/timers/timer_queue.cpp) | ||
|
||
set(concurrencpp_headers | ||
include/concurrencpp/concurrencpp.h | ||
include/concurrencpp/errors.h | ||
include/concurrencpp/forward_declerations.h | ||
include/concurrencpp/platform_defs.h | ||
include/concurrencpp/executors/constants.h | ||
include/concurrencpp/executors/derivable_executor.h | ||
include/concurrencpp/executors/executor.h | ||
include/concurrencpp/executors/executor_all.h | ||
include/concurrencpp/executors/inline_executor.h | ||
include/concurrencpp/executors/manual_executor.h | ||
include/concurrencpp/executors/thread_executor.h | ||
include/concurrencpp/executors/thread_pool_executor.h | ||
include/concurrencpp/executors/worker_thread_executor.h | ||
include/concurrencpp/results/constants.h | ||
include/concurrencpp/results/executor_exception.h | ||
include/concurrencpp/results/make_result.h | ||
include/concurrencpp/results/promises.h | ||
include/concurrencpp/results/result.h | ||
include/concurrencpp/results/result_awaitable.h | ||
include/concurrencpp/results/result_core.h | ||
include/concurrencpp/results/result_fwd_declerations.h | ||
include/concurrencpp/results/when_result.h | ||
include/concurrencpp/runtime/constants.h | ||
include/concurrencpp/runtime/runtime.h | ||
include/concurrencpp/threads/thread.h | ||
include/concurrencpp/timers/constants.h | ||
include/concurrencpp/timers/timer.h | ||
include/concurrencpp/timers/timer_queue.h | ||
include/concurrencpp/utils/bind.h) | ||
|
||
add_library(concurrencpp STATIC ${concurrencpp_headers} ${concurrencpp_sources}) | ||
add_library(concurrencpp::concurrencpp ALIAS concurrencpp) | ||
|
||
target_include_directories(concurrencpp | ||
${concurrencpp_warning_guard} | ||
PUBLIC | ||
"$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>") | ||
|
||
target_compile_features(concurrencpp PUBLIC cxx_std_20) | ||
|
||
target_coroutine_options(concurrencpp) | ||
|
||
find_library(LIBRT NAMES rt DOC "Path to the Real Time shared library") | ||
target_link_libraries(concurrencpp PUBLIC "$<$<BOOL:${LIBRT}>:${LIBRT}>") | ||
|
||
# ---- Install ---- | ||
|
||
include(CMakePackageConfigHelpers) | ||
include(GNUInstallDirs) | ||
|
||
set(concurrencpp_directory "concurrencpp-${PROJECT_VERSION}") | ||
set(concurrencpp_include_directory "${CMAKE_INSTALL_INCLUDEDIR}/${concurrencpp_directory}") | ||
|
||
install(TARGETS concurrencpp | ||
EXPORT concurrencppTargets | ||
ARCHIVE # | ||
DESTINATION "${CMAKE_INSTALL_LIBDIR}" | ||
COMPONENT concurrencpp_Development | ||
INCLUDES # | ||
DESTINATION "${concurrencpp_include_directory}") | ||
|
||
set(concurrencpp_install_cmakedir | ||
"${CMAKE_INSTALL_LIBDIR}/cmake/${concurrencpp_directory}") | ||
|
||
write_basic_package_version_file( | ||
concurrencppConfigVersion.cmake | ||
VERSION ${PROJECT_VERSION} | ||
COMPATIBILITY SameMinorVersion | ||
ARCH_INDEPENDENT) | ||
|
||
install(EXPORT concurrencppTargets | ||
NAMESPACE concurrencpp:: | ||
DESTINATION "${concurrencpp_install_cmakedir}") | ||
|
||
install(FILES | ||
"${PROJECT_SOURCE_DIR}/cmake/concurrencppConfig.cmake" | ||
"${PROJECT_BINARY_DIR}/concurrencppConfigVersion.cmake" | ||
DESTINATION "${concurrencpp_install_cmakedir}") | ||
|
||
install(DIRECTORY "${PROJECT_SOURCE_DIR}/include/" | ||
DESTINATION "${concurrencpp_include_directory}") |
Oops, something went wrong.