mirror of
https://github.com/BlackMATov/flat.hpp.git
synced 2025-12-13 09:45:38 +07:00
initial commit
This commit is contained in:
11
.appveyor.yml
Normal file
11
.appveyor.yml
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
version: "{build}"
|
||||||
|
shallow_clone: true
|
||||||
|
image:
|
||||||
|
- Visual Studio 2015
|
||||||
|
- Visual Studio 2017
|
||||||
|
platform:
|
||||||
|
- Win32
|
||||||
|
- x64
|
||||||
|
build_script:
|
||||||
|
- scripts\build_all.bat
|
||||||
|
test: off
|
||||||
4
.codecov.yml
Normal file
4
.codecov.yml
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
ignore:
|
||||||
|
- "catch.hpp"
|
||||||
|
- "catch_main.hpp"
|
||||||
|
- "*_tests.cpp"
|
||||||
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
build/*
|
||||||
|
.vscode/*
|
||||||
|
CMakeLists.txt.user
|
||||||
70
.travis.yml
Normal file
70
.travis.yml
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
language: cpp
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- os: linux
|
||||||
|
dist: trusty
|
||||||
|
addons: { apt: { sources: ubuntu-toolchain-r-test, packages: ["xorg-dev", "g++-4.9"] } }
|
||||||
|
env: MATRIX_EVAL="CC=gcc-4.9 && CXX=g++-4.9"
|
||||||
|
- os: linux
|
||||||
|
dist: trusty
|
||||||
|
addons: { apt: { sources: ubuntu-toolchain-r-test, packages: ["xorg-dev", "g++-5"] } }
|
||||||
|
env: MATRIX_EVAL="CC=gcc-5 && CXX=g++-5"
|
||||||
|
- os: linux
|
||||||
|
dist: trusty
|
||||||
|
addons: { apt: { sources: ubuntu-toolchain-r-test, packages: ["xorg-dev", "g++-6"] } }
|
||||||
|
env: MATRIX_EVAL="CC=gcc-6 && CXX=g++-6"
|
||||||
|
- os: linux
|
||||||
|
dist: trusty
|
||||||
|
addons: { apt: { sources: ubuntu-toolchain-r-test, packages: ["xorg-dev", "g++-7"] } }
|
||||||
|
env: MATRIX_EVAL="CC=gcc-7 && CXX=g++-7"
|
||||||
|
- os: linux
|
||||||
|
dist: trusty
|
||||||
|
addons: { apt: { sources: ubuntu-toolchain-r-test, packages: ["xorg-dev", "g++-8"] } }
|
||||||
|
env: MATRIX_EVAL="CC=gcc-8 && CXX=g++-8"
|
||||||
|
- os: linux
|
||||||
|
dist: trusty
|
||||||
|
addons: { apt: { sources: ["ubuntu-toolchain-r-test", "llvm-toolchain-precise-3.8"], packages: ["xorg-dev", "clang-3.8", "g++-5"] } }
|
||||||
|
env: MATRIX_EVAL="CC=clang-3.8 && CXX=clang++-3.8"
|
||||||
|
- os: linux
|
||||||
|
dist: trusty
|
||||||
|
addons: { apt: { sources: ["ubuntu-toolchain-r-test", "llvm-toolchain-precise-3.9"], packages: ["xorg-dev", "clang-3.9", "g++-5"] } }
|
||||||
|
env: MATRIX_EVAL="CC=clang-3.9 && CXX=clang++-3.9"
|
||||||
|
- os: linux
|
||||||
|
dist: trusty
|
||||||
|
addons: { apt: { sources: ["ubuntu-toolchain-r-test", "llvm-toolchain-trusty-4.0"], packages: ["xorg-dev", "clang-4.0", "g++-5"] } }
|
||||||
|
env: MATRIX_EVAL="CC=clang-4.0 && CXX=clang++-4.0"
|
||||||
|
- os: linux
|
||||||
|
dist: trusty
|
||||||
|
addons: { apt: { sources: ["ubuntu-toolchain-r-test", "llvm-toolchain-trusty-5.0"], packages: ["xorg-dev", "clang-5.0", "g++-7"] } }
|
||||||
|
env: MATRIX_EVAL="CC=clang-5.0 && CXX=clang++-5.0"
|
||||||
|
- os: linux
|
||||||
|
dist: trusty
|
||||||
|
addons: { apt: { sources: ["ubuntu-toolchain-r-test", "llvm-toolchain-trusty-6.0"], packages: ["xorg-dev", "clang-6.0", "g++-7"] } }
|
||||||
|
env: MATRIX_EVAL="CC=clang-6.0 && CXX=clang++-6.0"
|
||||||
|
- os: osx
|
||||||
|
osx_image: xcode8.3
|
||||||
|
compiler: clang
|
||||||
|
- os: osx
|
||||||
|
osx_image: xcode9
|
||||||
|
compiler: clang
|
||||||
|
- os: osx
|
||||||
|
osx_image: xcode9.1
|
||||||
|
compiler: clang
|
||||||
|
- os: osx
|
||||||
|
osx_image: xcode9.2
|
||||||
|
compiler: clang
|
||||||
|
- os: osx
|
||||||
|
osx_image: xcode9.3
|
||||||
|
compiler: clang
|
||||||
|
- os: osx
|
||||||
|
osx_image: xcode9.4
|
||||||
|
compiler: clang
|
||||||
|
- os: osx
|
||||||
|
osx_image: xcode10
|
||||||
|
compiler: clang
|
||||||
|
addons: { homebrew: { packages: ["lcov"] } }
|
||||||
|
after_success: ./scripts/upload_coverage.sh
|
||||||
|
before_install:
|
||||||
|
- eval "${MATRIX_EVAL}"
|
||||||
|
script:
|
||||||
|
- ./scripts/build_all.sh
|
||||||
43
CMakeLists.txt
Normal file
43
CMakeLists.txt
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
|
||||||
|
project(flat)
|
||||||
|
|
||||||
|
#
|
||||||
|
# coverage mode
|
||||||
|
#
|
||||||
|
|
||||||
|
option(FLAT_BUILD_WITH_COVERAGE "Build with coverage" OFF)
|
||||||
|
if(FLAT_BUILD_WITH_COVERAGE AND (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang"))
|
||||||
|
add_definitions(-DFLAT_BUILD_WITH_COVERAGE)
|
||||||
|
set(FLAT_COVERAGE_FLAGS "--coverage")
|
||||||
|
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${FLAT_COVERAGE_FLAGS}")
|
||||||
|
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${FLAT_COVERAGE_FLAGS}")
|
||||||
|
set(CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} ${FLAT_COVERAGE_FLAGS}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
#
|
||||||
|
# sanitizer mode
|
||||||
|
#
|
||||||
|
|
||||||
|
option(FLAT_BUILD_WITH_SANITIZER "Build with sanitizer" OFF)
|
||||||
|
if(FLAT_BUILD_WITH_SANITIZER AND (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang"))
|
||||||
|
add_definitions(-DFLAT_BUILD_WITH_SANITIZER)
|
||||||
|
set(FLAT_SANITIZER_FLAGS "-fno-omit-frame-pointer -fsanitize=address")
|
||||||
|
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${FLAT_SANITIZER_FLAGS}")
|
||||||
|
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${FLAT_SANITIZER_FLAGS}")
|
||||||
|
set(CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} ${FLAT_SANITIZER_FLAGS}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
#
|
||||||
|
# tests executable
|
||||||
|
#
|
||||||
|
|
||||||
|
file(GLOB test_sources "*.cpp" "*.hpp")
|
||||||
|
add_executable(${PROJECT_NAME} ${test_sources})
|
||||||
|
|
||||||
|
set_target_properties(${PROJECT_NAME} PROPERTIES
|
||||||
|
CXX_STANDARD 14
|
||||||
|
CXX_STANDARD_REQUIRED YES
|
||||||
|
CXX_EXTENSIONS NO)
|
||||||
|
|
||||||
|
enable_testing()
|
||||||
|
add_test(${PROJECT_NAME} ${PROJECT_NAME})
|
||||||
21
LICENSE.md
Normal file
21
LICENSE.md
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (C) 2019, by Matvey Cherevko (blackmatov@gmail.com)
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
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 AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
38
README.md
Normal file
38
README.md
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
# flat.hpp
|
||||||
|
|
||||||
|
[![travis][badge.travis]][travis]
|
||||||
|
[![appveyor][badge.appveyor]][appveyor]
|
||||||
|
[![codecov][badge.codecov]][codecov]
|
||||||
|
[![language][badge.language]][language]
|
||||||
|
[![license][badge.license]][license]
|
||||||
|
[![paypal][badge.paypal]][paypal]
|
||||||
|
|
||||||
|
[badge.travis]: https://img.shields.io/travis/BlackMATov/flat.hpp/master.svg?logo=travis
|
||||||
|
[badge.appveyor]: https://img.shields.io/appveyor/ci/BlackMATov/flat-hpp/master.svg?logo=appveyor
|
||||||
|
[badge.codecov]: https://img.shields.io/codecov/c/github/BlackMATov/flat.hpp/master.svg?logo=codecov
|
||||||
|
[badge.language]: https://img.shields.io/badge/language-C%2B%2B14-red.svg
|
||||||
|
[badge.license]: https://img.shields.io/badge/license-MIT-blue.svg
|
||||||
|
[badge.paypal]: https://img.shields.io/badge/donate-PayPal-orange.svg?logo=paypal&colorA=00457C
|
||||||
|
|
||||||
|
[travis]: https://travis-ci.org/BlackMATov/flat.hpp
|
||||||
|
[appveyor]: https://ci.appveyor.com/project/BlackMATov/flat-hpp
|
||||||
|
[codecov]: https://codecov.io/gh/BlackMATov/flat.hpp
|
||||||
|
[language]: https://en.wikipedia.org/wiki/C%2B%2B14
|
||||||
|
[license]: https://en.wikipedia.org/wiki/MIT_License
|
||||||
|
[paypal]: https://www.paypal.me/matov
|
||||||
|
|
||||||
|
[flat]: https://github.com/BlackMATov/flat.hpp
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
[flat.hpp][flat] is a single header library. All you need to do is copy the header file into your project and include this file:
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
#include "flat.hpp"
|
||||||
|
```
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
> coming soon!
|
||||||
|
|
||||||
|
## [License (MIT)](./LICENSE.md)
|
||||||
9
catch_main.cpp
Normal file
9
catch_main.cpp
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
/*******************************************************************************
|
||||||
|
* This file is part of the "https://github.com/blackmatov/flat.hpp"
|
||||||
|
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||||
|
* Copyright (C) 2019, by Matvey Cherevko (blackmatov@gmail.com)
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
#define CATCH_CONFIG_MAIN
|
||||||
|
#define CATCH_CONFIG_FAST_COMPILE
|
||||||
|
#include "catch.hpp"
|
||||||
44
flat_map.hpp
Normal file
44
flat_map.hpp
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
/*******************************************************************************
|
||||||
|
* This file is part of the "https://github.com/blackmatov/flat.hpp"
|
||||||
|
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||||
|
* Copyright (C) 2019, by Matvey Cherevko (blackmatov@gmail.com)
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include <memory>
|
||||||
|
#include <utility>
|
||||||
|
#include <functional>
|
||||||
|
#include <type_traits>
|
||||||
|
|
||||||
|
namespace flat_hpp
|
||||||
|
{
|
||||||
|
template < typename Key
|
||||||
|
, typename Value
|
||||||
|
, typename Compare = std::less<Key>
|
||||||
|
, typename Allocator = std::allocator<std::pair<const Key, Value>> >
|
||||||
|
class flat_map final {
|
||||||
|
using data_type = std::vector<std::pair<const Key, Value>, Allocator>;
|
||||||
|
public:
|
||||||
|
using key_type = Key;
|
||||||
|
using mapped_type = Value;
|
||||||
|
using value_type = typename data_type::value_type;
|
||||||
|
|
||||||
|
using size_type = typename data_type::size_type;
|
||||||
|
using difference_type = typename data_type::difference_type;
|
||||||
|
|
||||||
|
using key_compare = Compare;
|
||||||
|
using allocator_type = Allocator;
|
||||||
|
|
||||||
|
using reference = typename data_type::reference;
|
||||||
|
using const_reference = typename data_type::const_reference;
|
||||||
|
using pointer = typename data_type::pointer;
|
||||||
|
using const_pointer = typename data_type::const_pointer;
|
||||||
|
|
||||||
|
using iterator = typename data_type::iterator;
|
||||||
|
using const_iterator = typename data_type::const_iterator;
|
||||||
|
using reverse_iterator = typename data_type::reverse_iterator;
|
||||||
|
using const_reverse_iterator = typename data_type::const_reverse_iterator;
|
||||||
|
};
|
||||||
|
}
|
||||||
52
flat_map_tests.cpp
Normal file
52
flat_map_tests.cpp
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
/*******************************************************************************
|
||||||
|
* This file is part of the "https://github.com/blackmatov/flat.hpp"
|
||||||
|
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||||
|
* Copyright (C) 2019, by Matvey Cherevko (blackmatov@gmail.com)
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
#define CATCH_CONFIG_FAST_COMPILE
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
#include "flat_map.hpp"
|
||||||
|
namespace flat = flat_hpp;
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("flat_map") {
|
||||||
|
{
|
||||||
|
using map_t = flat::flat_map<int, unsigned>;
|
||||||
|
|
||||||
|
static_assert(
|
||||||
|
std::is_same<map_t::key_type, int>::value,
|
||||||
|
"unit test static error");
|
||||||
|
static_assert(
|
||||||
|
std::is_same<map_t::mapped_type, unsigned>::value,
|
||||||
|
"unit test static error");
|
||||||
|
static_assert(
|
||||||
|
std::is_same<map_t::value_type, std::pair<const int, unsigned>>::value,
|
||||||
|
"unit test static error");
|
||||||
|
|
||||||
|
static_assert(
|
||||||
|
std::is_same<map_t::size_type, std::size_t>::value,
|
||||||
|
"unit test static error");
|
||||||
|
static_assert(
|
||||||
|
std::is_same<map_t::difference_type, std::ptrdiff_t>::value,
|
||||||
|
"unit test static error");
|
||||||
|
|
||||||
|
static_assert(
|
||||||
|
std::is_same<map_t::reference, std::pair<const int, unsigned>&>::value,
|
||||||
|
"unit test static error");
|
||||||
|
static_assert(
|
||||||
|
std::is_same<map_t::const_reference, const std::pair<const int, unsigned>&>::value,
|
||||||
|
"unit test static error");
|
||||||
|
|
||||||
|
static_assert(
|
||||||
|
std::is_same<map_t::pointer, std::pair<const int, unsigned>*>::value,
|
||||||
|
"unit test static error");
|
||||||
|
static_assert(
|
||||||
|
std::is_same<map_t::const_pointer, const std::pair<const int, unsigned>*>::value,
|
||||||
|
"unit test static error");
|
||||||
|
}
|
||||||
|
}
|
||||||
43
flat_set.hpp
Normal file
43
flat_set.hpp
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
/*******************************************************************************
|
||||||
|
* This file is part of the "https://github.com/blackmatov/flat.hpp"
|
||||||
|
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||||
|
* Copyright (C) 2019, by Matvey Cherevko (blackmatov@gmail.com)
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include <memory>
|
||||||
|
#include <utility>
|
||||||
|
#include <functional>
|
||||||
|
#include <type_traits>
|
||||||
|
|
||||||
|
namespace flat_hpp
|
||||||
|
{
|
||||||
|
template < typename Key
|
||||||
|
, typename Compare = std::less<Key>
|
||||||
|
, typename Allocator = std::allocator<Key> >
|
||||||
|
class flat_set final {
|
||||||
|
using data_type = std::vector<Key, Allocator>;
|
||||||
|
public:
|
||||||
|
using key_type = Key;
|
||||||
|
using value_type = Key;
|
||||||
|
|
||||||
|
using size_type = typename data_type::size_type;
|
||||||
|
using difference_type = typename data_type::difference_type;
|
||||||
|
|
||||||
|
using key_compare = Compare;
|
||||||
|
using value_compare = Compare;
|
||||||
|
using allocator_type = Allocator;
|
||||||
|
|
||||||
|
using reference = typename data_type::reference;
|
||||||
|
using const_reference = typename data_type::const_reference;
|
||||||
|
using pointer = typename data_type::pointer;
|
||||||
|
using const_pointer = typename data_type::const_pointer;
|
||||||
|
|
||||||
|
using iterator = typename data_type::iterator;
|
||||||
|
using const_iterator = typename data_type::const_iterator;
|
||||||
|
using reverse_iterator = typename data_type::reverse_iterator;
|
||||||
|
using const_reverse_iterator = typename data_type::const_reverse_iterator;
|
||||||
|
};
|
||||||
|
}
|
||||||
49
flat_set_tests.cpp
Normal file
49
flat_set_tests.cpp
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
/*******************************************************************************
|
||||||
|
* This file is part of the "https://github.com/blackmatov/flat.hpp"
|
||||||
|
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||||
|
* Copyright (C) 2019, by Matvey Cherevko (blackmatov@gmail.com)
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
#define CATCH_CONFIG_FAST_COMPILE
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
#include "flat_set.hpp"
|
||||||
|
namespace flat = flat_hpp;
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("flat_set") {
|
||||||
|
{
|
||||||
|
using set_t = flat::flat_set<int>;
|
||||||
|
|
||||||
|
static_assert(
|
||||||
|
std::is_same<set_t::key_type, int>::value,
|
||||||
|
"unit test static error");
|
||||||
|
static_assert(
|
||||||
|
std::is_same<set_t::value_type, int>::value,
|
||||||
|
"unit test static error");
|
||||||
|
|
||||||
|
static_assert(
|
||||||
|
std::is_same<set_t::size_type, std::size_t>::value,
|
||||||
|
"unit test static error");
|
||||||
|
static_assert(
|
||||||
|
std::is_same<set_t::difference_type, std::ptrdiff_t>::value,
|
||||||
|
"unit test static error");
|
||||||
|
|
||||||
|
static_assert(
|
||||||
|
std::is_same<set_t::reference, int&>::value,
|
||||||
|
"unit test static error");
|
||||||
|
static_assert(
|
||||||
|
std::is_same<set_t::const_reference, const int&>::value,
|
||||||
|
"unit test static error");
|
||||||
|
|
||||||
|
static_assert(
|
||||||
|
std::is_same<set_t::pointer, int*>::value,
|
||||||
|
"unit test static error");
|
||||||
|
static_assert(
|
||||||
|
std::is_same<set_t::const_pointer, const int*>::value,
|
||||||
|
"unit test static error");
|
||||||
|
}
|
||||||
|
}
|
||||||
10
scripts/build_all.bat
Normal file
10
scripts/build_all.bat
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
@echo off
|
||||||
|
set SCRIPT_DIR=%~dp0%
|
||||||
|
call %SCRIPT_DIR%\build_debug.bat || goto :error
|
||||||
|
call %SCRIPT_DIR%\build_release.bat || goto :error
|
||||||
|
|
||||||
|
goto :EOF
|
||||||
|
|
||||||
|
:error
|
||||||
|
echo Failed with error #%errorlevel%.
|
||||||
|
exit /b %errorlevel%
|
||||||
5
scripts/build_all.sh
Executable file
5
scripts/build_all.sh
Executable file
@@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
SCRIPT_DIR=`dirname "$BASH_SOURCE"`
|
||||||
|
$SCRIPT_DIR/build_debug.sh
|
||||||
|
$SCRIPT_DIR/build_release.sh
|
||||||
14
scripts/build_debug.bat
Normal file
14
scripts/build_debug.bat
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
@echo off
|
||||||
|
set BUILD_DIR=%~dp0%\..\build
|
||||||
|
mkdir %BUILD_DIR%\debug || goto :error
|
||||||
|
cd %BUILD_DIR%\debug || goto :error
|
||||||
|
cmake ../.. || goto :error
|
||||||
|
cmake --build . --config Debug || goto :error
|
||||||
|
ctest --verbose || goto :error
|
||||||
|
cd ..\.. || goto :error
|
||||||
|
|
||||||
|
goto :EOF
|
||||||
|
|
||||||
|
:error
|
||||||
|
echo Failed with error #%errorlevel%.
|
||||||
|
exit /b %errorlevel%
|
||||||
9
scripts/build_debug.sh
Executable file
9
scripts/build_debug.sh
Executable file
@@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
BUILD_DIR=`dirname "$BASH_SOURCE"`/../build
|
||||||
|
mkdir -p $BUILD_DIR/debug
|
||||||
|
cd $BUILD_DIR/debug
|
||||||
|
cmake -DCMAKE_BUILD_TYPE=Debug ../..
|
||||||
|
cmake --build . -- -j8
|
||||||
|
ctest --verbose
|
||||||
|
cd ../..
|
||||||
14
scripts/build_release.bat
Normal file
14
scripts/build_release.bat
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
@echo off
|
||||||
|
set BUILD_DIR=%~dp0%\..\build
|
||||||
|
mkdir %BUILD_DIR%\release || goto :error
|
||||||
|
cd %BUILD_DIR%\release || goto :error
|
||||||
|
cmake ../.. || goto :error
|
||||||
|
cmake --build . --config Release || goto :error
|
||||||
|
ctest --verbose || goto :error
|
||||||
|
cd ..\.. || goto :error
|
||||||
|
|
||||||
|
goto :EOF
|
||||||
|
|
||||||
|
:error
|
||||||
|
echo Failed with error #%errorlevel%.
|
||||||
|
exit /b %errorlevel%
|
||||||
9
scripts/build_release.sh
Executable file
9
scripts/build_release.sh
Executable file
@@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
BUILD_DIR=`dirname "$BASH_SOURCE"`/../build
|
||||||
|
mkdir -p $BUILD_DIR/release
|
||||||
|
cd $BUILD_DIR/release
|
||||||
|
cmake -DCMAKE_BUILD_TYPE=Release ../..
|
||||||
|
cmake --build . -- -j8
|
||||||
|
ctest --verbose
|
||||||
|
cd ../..
|
||||||
17
scripts/upload_coverage.sh
Executable file
17
scripts/upload_coverage.sh
Executable file
@@ -0,0 +1,17 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
BUILD_DIR=`dirname "$BASH_SOURCE"`/../build
|
||||||
|
mkdir -p $BUILD_DIR/coverage
|
||||||
|
cd $BUILD_DIR/coverage
|
||||||
|
cmake -DCMAKE_BUILD_TYPE=Debug -DFLAT_BUILD_WITH_COVERAGE=ON ../..
|
||||||
|
cmake --build . -- -j8
|
||||||
|
|
||||||
|
lcov -d . -z
|
||||||
|
ctest --verbose
|
||||||
|
|
||||||
|
lcov -d . -c -o "coverage.info"
|
||||||
|
lcov -r "coverage.info" "*/usr/*" "*/catch.hpp" "*/catch_main.cpp" "*_tests.cpp" -o "coverage.info"
|
||||||
|
lcov -l "coverage.info"
|
||||||
|
|
||||||
|
bash <(curl -s https://codecov.io/bash) || echo "Codecov did not collect coverage reports"
|
||||||
Reference in New Issue
Block a user