forked from dashpay/dash
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Squashed 'src/immer/' content from commit 9cb6a5a845
git-subtree-dir: src/immer git-subtree-split: 9cb6a5a845df766a4cb3526d8a4584bf99bac8d5
- Loading branch information
0 parents
commit 46b560d
Showing
358 changed files
with
87,193 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,39 @@ | ||
--- | ||
AlignAfterOpenBracket: Align | ||
AlignConsecutiveAssignments: 'true' | ||
AlignEscapedNewlines: Right | ||
AlignTrailingComments: 'true' | ||
AllowShortFunctionsOnASingleLine: 'true' | ||
AllowShortBlocksOnASingleLine: 'true' | ||
AlwaysBreakTemplateDeclarations: 'true' | ||
AccessModifierOffset: -4 | ||
BinPackArguments: 'false' | ||
BinPackParameters: 'false' | ||
BreakBeforeBraces: Mozilla | ||
BreakBeforeInheritanceComma: 'true' | ||
BreakBeforeTernaryOperators: 'true' | ||
BreakConstructorInitializers: BeforeComma | ||
BreakStringLiterals: 'true' | ||
ColumnLimit: '80' | ||
CompactNamespaces: 'false' | ||
ConstructorInitializerAllOnOneLineOrOnePerLine: 'false' | ||
FixNamespaceComments: 'true' | ||
ForEachMacros: ['IMMER_CATCH', 'IMMER_TRY'] | ||
IndentCaseLabels: 'false' | ||
IndentWidth: '4' | ||
IndentWrappedFunctionNames: 'false' | ||
KeepEmptyLinesAtTheStartOfBlocks: 'false' | ||
Language: Cpp | ||
MaxEmptyLinesToKeep: '1' | ||
NamespaceIndentation: None | ||
PointerAlignment: Left | ||
ReflowComments: 'true' | ||
SortIncludes: 'true' | ||
SortUsingDeclarations: 'true' | ||
SpaceAfterCStyleCast: 'true' | ||
SpaceAfterTemplateKeyword: 'true' | ||
SpaceBeforeAssignmentOperators: 'true' | ||
SpaceBeforeParens: ControlStatements | ||
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,7 @@ | ||
((nil . | ||
((indent-tabs-mode . nil) | ||
(show-trailing-whitespace . t))) | ||
(c-mode . | ||
((mode . c++))) | ||
(c++-mode . | ||
((eval add-hook 'before-save-hook #'clang-format-buffer nil t)))) |
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,3 @@ | ||
github: arximboldi | ||
patreon: sinusoidal | ||
custom: ["paypal.me/sinusoidal", sinusoid.al] |
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,123 @@ | ||
name: test | ||
on: [push, pull_request] | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 # needed for fetchGit in default.nix | ||
- uses: cachix/install-nix-action@v12 | ||
with: | ||
nix_path: nixpkgs=channel:nixos-unstable | ||
install_url: "https://releases.nixos.org/nix/nix-2.3.16/install" | ||
- uses: cachix/cachix-action@v8 | ||
with: | ||
name: arximboldi | ||
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}' | ||
- run: nix-build | ||
|
||
docs: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
submodules: true | ||
- uses: cachix/install-nix-action@v12 | ||
with: | ||
nix_path: nixpkgs=channel:nixos-unstable | ||
install_url: "https://releases.nixos.org/nix/nix-2.3.16/install" | ||
- uses: cachix/cachix-action@v8 | ||
with: | ||
name: arximboldi | ||
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}' | ||
- run: nix-shell --run "mkdir build" | ||
- run: nix-shell --run "cd build && cmake .." | ||
- run: nix-shell --run "cd build && make docs" | ||
- uses: shimataro/ssh-key-action@v2 | ||
if: github.ref == 'refs/heads/master' | ||
with: | ||
key: ${{ secrets.SINUSOIDES_SSH_KEY }} | ||
known_hosts: ${{ secrets.SINUSOIDES_KNOWN_HOSTS }} | ||
- run: nix-shell --run "cd build && make upload-docs" | ||
if: github.ref == 'refs/heads/master' | ||
|
||
check: | ||
strategy: | ||
matrix: | ||
type: [Debug, Release] | ||
toolchain: [gnu-6, gnu-7, llvm-5, llvm-6] | ||
std: [14] | ||
opts: [[]] | ||
include: | ||
# coverage | ||
- type: Debug | ||
toolchain: gnu-9 | ||
std: 14 | ||
opts: ['coverage'] | ||
# std 17 | ||
- type: Debug | ||
toolchain: gnu-8 | ||
std: 17 | ||
- type: Debug | ||
toolchain: llvm-9 | ||
std: 17 | ||
opts: ['fuzzers'] | ||
# std 20 | ||
- type: Debug | ||
toolchain: gnu-11 | ||
std: 20 | ||
- type: Debug | ||
toolchain: llvm-13 | ||
std: 20 | ||
# sanitizers | ||
- type: Debug | ||
toolchain: llvm-8 | ||
std: 14 | ||
opts: ['sanitizer'] | ||
# benchmarks | ||
- type: Release | ||
toolchain: gnu-9 | ||
std: 14 | ||
opts: ['benchmark'] | ||
- type: Release | ||
toolchain: llvm-10 | ||
std: 14 | ||
opts: ['benchmark'] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: cachix/install-nix-action@v12 | ||
with: | ||
nix_path: nixpkgs=channel:nixos-unstable | ||
install_url: "https://releases.nixos.org/nix/nix-2.3.16/install" | ||
- uses: cachix/cachix-action@v8 | ||
with: | ||
name: arximboldi | ||
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}' | ||
- run: nix-shell --argstr toolchain ${{ matrix.toolchain }} --run "mkdir build" | ||
- name: configure CMake | ||
run: | | ||
nix-shell --argstr toolchain ${{ matrix.toolchain }} --run " | ||
cd build && cmake .. \ | ||
-DCMAKE_BUILD_TYPE=${{ matrix.type }} \ | ||
-DCHECK_SLOW_TESTS=false \ | ||
-DCXX_STANDARD=${{ matrix.std }} \ | ||
-DCHECK_BENCHMARKS=${{ contains(matrix.opts, 'benchmark') }} \ | ||
-DENABLE_COVERAGE=${{ contains(matrix.opts, 'coverage') }} \ | ||
-DENABLE_ASAN=${{ contains(matrix.opts, 'sanitize') }} \ | ||
-DENABLE_LSAN=${{ contains(matrix.opts, 'sanitize') }} \ | ||
-DENABLE_UBSAN=${{ contains(matrix.opts, 'sanitize') }} \ | ||
-DCHECK_FUZZERS=${{ contains(matrix.opts, 'fuzzers') }} \ | ||
-DDISABLE_FREE_LIST=${{ contains(matrix.opts, 'sanitize') }} | ||
" | ||
- run: nix-shell --argstr toolchain ${{ matrix.toolchain }} --run "cd build && make check -j`nproc`" | ||
- run: nix-shell --argstr toolchain ${{ matrix.toolchain }} --run "bash <(curl -s https://codecov.io/bash)" | ||
if: ${{ contains(matrix.opts, 'coverage') }} | ||
- uses: shimataro/ssh-key-action@v2 | ||
if: ${{ contains(matrix.opts, 'benchmark') }} | ||
with: | ||
key: ${{ secrets.SINUSOIDES_SSH_KEY }} | ||
known_hosts: ${{ secrets.SINUSOIDES_KNOWN_HOSTS }} | ||
- run: nix-shell --run "cd build && make upload-benchmark-reports" | ||
if: ${{ contains(matrix.opts, 'benchmark') }} |
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,24 @@ | ||
bazel-* | ||
build/ | ||
build-*/ | ||
reports/ | ||
doc/_build | ||
doc/_doxygen | ||
bazel-* | ||
|
||
tools/travis/ssh-key | ||
tools/clojure/target/ | ||
tools/scala/target/ | ||
tools/scala/project/target/ | ||
|
||
extra/js/out | ||
extra/js/boost | ||
|
||
__pycache__ | ||
|
||
.gdb_history | ||
|
||
.cache | ||
tools/clojure/.lein* | ||
|
||
*.pyc |
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 @@ | ||
[submodule "extra/python/lib/pybind11"] | ||
path = extra/python/lib/pybind11 | ||
url = https://github.com/pybind/pybind11.git | ||
[submodule "tools/sinusoidal-sphinx-theme"] | ||
path = tools/sinusoidal-sphinx-theme | ||
url = https://github.com/arximboldi/sinusoidal-sphinx-theme.git |
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,11 @@ | ||
package(default_visibility = ["//visibility:public"]) | ||
|
||
cc_library( | ||
name = "immer", | ||
include_prefix = "immer", | ||
strip_include_prefix = | ||
"immer", | ||
hdrs = glob([ | ||
"immer/**/*.hpp", | ||
]), | ||
) |
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,155 @@ | ||
|
||
cmake_minimum_required(VERSION 3.5.1) | ||
cmake_policy(SET CMP0048 NEW) # enable project VERSION | ||
cmake_policy(SET CMP0056 NEW) # honor link flags in try_compile() | ||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") | ||
|
||
project(immer VERSION 0.7.0) | ||
|
||
if (NOT MSVC) | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic -Wno-unused-parameter -Wno-extended-offsetof -Wno-c++17-extensions -Wno-c++1z-extensions -Wno-unknown-warning-option -Wno-type-limits") | ||
endif() | ||
set(CMAKE_EXPORT_COMPILE_COMMANDS on) | ||
set(CMAKE_CXX_EXTENSIONS off) | ||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qunused-arguments") | ||
endif() | ||
|
||
include(GNUInstallDirs) | ||
include(ImmerUtils) | ||
|
||
# Options | ||
# ======= | ||
|
||
option(ENABLE_ASAN "compile with address sanitizer enabled") | ||
option(ENABLE_MSAN "compile with memory sanitizer enabled") | ||
option(ENABLE_LSAN "compile with leak sanitizer enabled") | ||
option(ENABLE_UBSAN "compile with undefined behavior sanitizer enabled") | ||
option(ENABLE_COVERAGE "compile with test coverage support") | ||
option(DISABLE_WERROR "enable --werror") | ||
option(DISABLE_FREE_LIST "disables the free list heap") | ||
option(DISABLE_THREAD_SAFETY "disables thread safety by default") | ||
option(CHECK_FUZZERS "Add fuzzers as part of make check") | ||
|
||
option(ENABLE_PYTHON "enable building python module" off) | ||
option(ENABLE_GUILE "enable building guile module" off) | ||
option(ENABLE_BOOST_COROUTINE "run benchmarks with boost coroutine" off) | ||
|
||
option(immer_BUILD_TESTS "Build tests" ON) | ||
option(immer_BUILD_EXAMPLES "Build examples" ON) | ||
option(immer_BUILD_DOCS "Build docs" ON) | ||
option(immer_BUILD_EXTRAS "Build extras" ON) | ||
|
||
set(CXX_STANDARD 14 CACHE STRING "c++ standard number") | ||
|
||
set(CMAKE_CXX_STANDARD ${CXX_STANDARD}) | ||
set(CMAKE_CXX_STANDARD_REQUIRED on) | ||
|
||
if (ENABLE_ASAN) | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address") | ||
endif() | ||
if (ENABLE_LSAN) | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=leak") | ||
endif() | ||
if (ENABLE_UBSAN) | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined") | ||
endif() | ||
if (ENABLE_MSAN) | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=memory") | ||
endif() | ||
|
||
if (NOT MSVC AND NOT DISABLE_WERROR) | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror") | ||
endif() | ||
|
||
# Dependencies | ||
# ============ | ||
|
||
if (ENABLE_BOOST_COROUTINE) | ||
set(immer_boost_components coroutine) | ||
endif() | ||
|
||
find_package(Threads) | ||
find_package(BoehmGC) | ||
find_package(Boost 1.56 COMPONENTS ${immer_boost_components}) | ||
|
||
find_program(CCACHE ccache) | ||
if (CCACHE) | ||
message(STATUS "Using ccache: ${CCACHE}") | ||
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${CCACHE}) | ||
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ${CCACHE}) | ||
else() | ||
message(STATUS "Could not find ccache") | ||
endif() | ||
|
||
if (NOT BOEHM_GC_FOUND) | ||
set(BOEHM_GC_LIBRARIES "") | ||
endif() | ||
|
||
# Targets | ||
# ======= | ||
|
||
# the library | ||
add_library(immer INTERFACE) | ||
target_include_directories(immer INTERFACE | ||
$<BUILD_INTERFACE:${immer_BINARY_DIR}/> | ||
$<BUILD_INTERFACE:${immer_SOURCE_DIR}/> | ||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>) | ||
install(TARGETS immer EXPORT ImmerConfig) | ||
install(EXPORT ImmerConfig DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/Immer") | ||
install(DIRECTORY immer DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") | ||
|
||
# development target to be used in tests, examples, benchmarks... | ||
immer_canonicalize_cmake_booleans( | ||
DISABLE_FREE_LIST | ||
DISABLE_THREAD_SAFETY | ||
CHECK_SLOW_TESTS) | ||
add_library(immer-dev INTERFACE) | ||
target_include_directories(immer-dev SYSTEM INTERFACE | ||
${Boost_INCLUDE_DIR} | ||
${BOEHM_GC_INCLUDE_DIR} | ||
${CMAKE_CURRENT_SOURCE_DIR}/tools/include) | ||
target_link_libraries(immer-dev INTERFACE | ||
immer | ||
${BOEHM_GC_LIBRARIES} | ||
${CMAKE_THREAD_LIBS_INIT}) | ||
target_compile_definitions(immer-dev INTERFACE | ||
-DIMMER_CXX_STANDARD=${CXX_STANDARD} | ||
-DIMMER_HAS_LIBGC=1 | ||
-DIMMER_NO_FREE_LIST=${DISABLE_FREE_LIST} | ||
-DIMMER_NO_THREAD_SAFETY=${DISABLE_THREAD_SAFETY} | ||
-DIMMER_SLOW_TESTS=${CHECK_SLOW_TESTS} | ||
-DFMT_HEADER_ONLY=1) | ||
if (ENABLE_COVERAGE) | ||
target_compile_options(immer-dev INTERFACE "--coverage") | ||
target_link_libraries(immer-dev INTERFACE "--coverage") | ||
endif() | ||
|
||
# Testing | ||
# ======= | ||
|
||
if (immer_BUILD_TESTS) | ||
enable_testing() | ||
|
||
add_custom_target(check | ||
COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure | ||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} | ||
COMMENT "Build and run all the tests and examples.") | ||
|
||
add_subdirectory(test) | ||
add_subdirectory(benchmark) | ||
endif() | ||
|
||
if (immer_BUILD_EXAMPLES) | ||
add_subdirectory(example) | ||
endif() | ||
|
||
if (immer_BUILD_DOCS) | ||
add_subdirectory(doc) | ||
endif() | ||
|
||
if (immer_BUILD_EXTRAS) | ||
add_subdirectory(extra/fuzzer) | ||
add_subdirectory(extra/python) | ||
add_subdirectory(extra/guile) | ||
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,23 @@ | ||
Boost Software License - Version 1.0 - August 17th, 2003 | ||
|
||
Permission is hereby granted, free of charge, to any person or organization | ||
obtaining a copy of the software and accompanying documentation covered by | ||
this license (the "Software") to use, reproduce, display, distribute, | ||
execute, and transmit the Software, and to prepare derivative works of the | ||
Software, and to permit third-parties to whom the Software is furnished to | ||
do so, all subject to the following: | ||
|
||
The copyright notices in the Software and this entire statement, including | ||
the above license grant, this restriction and the following disclaimer, | ||
must be included in all copies of the Software, in whole or in part, and | ||
all derivative works of the Software, unless such copies or derivative | ||
works are solely in the form of machine-executable object code generated by | ||
a source language processor. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT | ||
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE | ||
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, | ||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
DEALINGS IN THE SOFTWARE. |
Oops, something went wrong.