new project structure

This commit is contained in:
2019-05-14 13:06:11 +07:00
parent 7d1300a322
commit 933a7943f4
10 changed files with 80 additions and 14407 deletions

View File

@@ -3,6 +3,7 @@ shallow_clone: true
image:
- Visual Studio 2015
- Visual Studio 2017
- Visual Studio 2019 Preview
platform:
- Win32
- x64

View File

@@ -66,5 +66,16 @@ matrix:
after_success: ./scripts/upload_coverage.sh
before_install:
- eval "${MATRIX_EVAL}"
- if [ "$TRAVIS_OS_NAME" == 'osx' ]; then
brew update;
brew upgrade cmake;
brew install git-lfs;
fi
- if [ "$TRAVIS_OS_NAME" == 'linux' ]; then
mkdir $HOME/cmake;
export PATH="$HOME/cmake/bin:$PATH";
travis_retry wget -q https://cmake.org/files/v3.11/cmake-3.11.4-Linux-x86_64.sh;
sh cmake-3.11.4-Linux-x86_64.sh --prefix=$HOME/cmake --exclude-subdir --skip-license;
fi
script:
- ./scripts/build_all.sh

View File

@@ -1,43 +1,20 @@
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
project(invoke)
# 3.8 version is required for `cxx_std_14`
cmake_minimum_required(VERSION 3.8 FATAL_ERROR)
#
# coverage mode
#
option(INVOKE_BUILD_WITH_COVERAGE "Build with coverage" OFF)
if(INVOKE_BUILD_WITH_COVERAGE AND (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang"))
add_definitions(-DINVOKE_BUILD_WITH_COVERAGE)
set(INVOKE_COVERAGE_FLAGS "--coverage")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${INVOKE_COVERAGE_FLAGS}")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${INVOKE_COVERAGE_FLAGS}")
set(CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} ${INVOKE_COVERAGE_FLAGS}")
if(NOT DEFINED PROJECT_NAME)
set(BUILD_AS_STANDALONE ON)
endif()
#
# sanitizer mode
#
project(invoke.hpp)
option(INVOKE_BUILD_WITH_SANITIZER "Build with sanitizer" OFF)
if(INVOKE_BUILD_WITH_SANITIZER AND (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang"))
add_definitions(-DINVOKE_BUILD_WITH_SANITIZER)
set(INVOKE_SANITIZER_FLAGS "-fno-omit-frame-pointer -fsanitize=address")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${INVOKE_SANITIZER_FLAGS}")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${INVOKE_SANITIZER_FLAGS}")
set(CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} ${INVOKE_SANITIZER_FLAGS}")
add_library(${PROJECT_NAME} INTERFACE)
target_include_directories(${PROJECT_NAME} INTERFACE headers)
target_compile_features(${PROJECT_NAME} INTERFACE cxx_std_14)
if(BUILD_AS_STANDALONE)
option(BUILD_WITH_UNTESTS "Build with unit tests" ON)
if(BUILD_WITH_UNTESTS)
enable_testing()
add_subdirectory(untests)
endif()
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})

View File

@@ -27,10 +27,17 @@
## Installation
[invoke.hpp][invoke] is a single header library. All you need to do is copy the header file into your project and include this file:
[invoke.hpp][invoke] is a header-only library. All you need to do is copy the headers files from `headers` directory into your project and include them:
```cpp
#include "invoke.hpp"
#include "invoke.hpp/invoke.hpp"
```
Also, you can add the root repository directory to your [cmake](https://cmake.org) project:
```cmake
add_subdirectory(external/invoke.hpp)
target_link_libraries(your_project_target invoke.hpp)
```
## API

14362
catch.hpp

File diff suppressed because it is too large Load Diff

View File

@@ -4,7 +4,7 @@ set -e
BUILD_DIR=`dirname "$BASH_SOURCE"`/../build
mkdir -p $BUILD_DIR/coverage
cd $BUILD_DIR/coverage
cmake -DCMAKE_BUILD_TYPE=Debug -DINVOKE_BUILD_WITH_COVERAGE=ON ../..
cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_WITH_COVERAGE=ON ../..
cmake --build . -- -j8
lcov -d . -z

39
untests/CMakeLists.txt Normal file
View File

@@ -0,0 +1,39 @@
# 3.11 version is required for `FetchContent`
cmake_minimum_required(VERSION 3.11 FATAL_ERROR)
project(invoke.hpp.untests)
set(CATCH_BUILD_TESTING OFF CACHE BOOL "" FORCE)
include(FetchContent)
FetchContent_Declare(
catch2
GIT_REPOSITORY https://github.com/catchorg/catch2)
FetchContent_GetProperties(catch2)
if(NOT catch2_POPULATED)
FetchContent_Populate(catch2)
add_subdirectory(${catch2_SOURCE_DIR} ${catch2_BINARY_DIR})
endif()
option(BUILD_WITH_COVERAGE "Build with coverage" OFF)
if(BUILD_WITH_COVERAGE AND (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang"))
set(COVERAGE_FLAGS "--coverage")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${COVERAGE_FLAGS}")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${COVERAGE_FLAGS}")
set(CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} ${COVERAGE_FLAGS}")
endif()
file(GLOB UNTESTS_SOURCES "*.cpp" "*.hpp")
add_executable(${PROJECT_NAME} ${UNTESTS_SOURCES})
target_link_libraries(${PROJECT_NAME}
Catch2
invoke.hpp)
target_compile_options(${PROJECT_NAME}
PRIVATE
$<$<CXX_COMPILER_ID:MSVC>:
/W4>
PRIVATE
$<$<OR:$<CXX_COMPILER_ID:GNU>,$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>>:
-Wall -Wextra -Wpedantic>)
add_test(${PROJECT_NAME} ${PROJECT_NAME})

View File

@@ -1,9 +1,9 @@
/*******************************************************************************
* This file is part of the "https://github.com/blackmatov/invoke.hpp"
* For conditions of distribution and use, see copyright notice in LICENSE.md
* Copyright (C) 2018 Matvey Cherevko
* Copyright (C) 2018-2019, by Matvey Cherevko (blackmatov@gmail.com)
******************************************************************************/
#define CATCH_CONFIG_MAIN
#define CATCH_CONFIG_FAST_COMPILE
#include "catch.hpp"
#include <catch2/catch.hpp>

View File

@@ -5,9 +5,9 @@
******************************************************************************/
#define CATCH_CONFIG_FAST_COMPILE
#include "catch.hpp"
#include <catch2/catch.hpp>
#include "invoke.hpp"
#include <invoke.hpp/invoke.hpp>
namespace inv = invoke_hpp;
namespace