This commit is contained in:
Terik23 2018-03-27 14:03:12 +05:00
parent 32e7545afa
commit cb1644b16c
6 changed files with 75 additions and 2 deletions

22
.travis.yml Normal file
View file

@ -0,0 +1,22 @@
dist: trusty
sudo: required
language: cpp
os:
- linux
- osx
compiler:
- g++
- clang++
env:
- TARGET_CPU=amd64 BUILD_CONFIGURATION=Release
script:
- mkdir build
- cd build
- cmake .. -DCMAKE_BUILD_TYPE=$BUILD_CONFIGURATION -DTARGET_CPU=$TARGET_CPU
- cmake --build .
- ctest -V --output-on-failure -С $BUILD_CONFIGURATION

View file

@ -4,5 +4,7 @@ project(nameof)
set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
enable_testing()
add_subdirectory(example) add_subdirectory(example)
add_subdirectory(test) add_subdirectory(test)

View file

@ -2,6 +2,10 @@
C++ alternative to [nameof](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/nameof) operator. C++ alternative to [nameof](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/nameof) operator.
Linux/OSX | Windows
-----------|---------
[![Build Status](https://travis-ci.org/Terik23/nameof.svg?branch=master)](https://travis-ci.org/Terik23/nameof)|[![Build status](https://ci.appveyor.com/api/projects/status/4tyl8lee10ckw10k/branch/master?svg=true)](https://ci.appveyor.com/project/Terik23/nameof/branch/master)
Used to obtain the simple name of a variable, type, function. Used to obtain the simple name of a variable, type, function.
Before, you had to use string literals to refer to definitions, which is brittle when renaming code elements because tools do not know to check these string literals. Before, you had to use string literals to refer to definitions, which is brittle when renaming code elements because tools do not know to check these string literals.

42
appveyor.yml Normal file
View file

@ -0,0 +1,42 @@
version: "{branch}#{build}"
branches:
only:
- master
image: Visual Studio 2017
platform: x64
configuration: Release
shallow_clone: true
matrix:
fast_finish: false
environment:
matrix:
- PLATFORM: x64
BUILDER: CMake
GENERATOR: "Visual Studio 15 2017 Win64"
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
- PLATFORM: x64
BUILDER: CMake
GENERATOR: "Visual Studio 14 2015 Win64"
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
init:
- ps: 'Write-Host "Building GEOS branch: $env:APPVEYOR_REPO_BRANCH" -ForegroundColor Magenta'
before_build:
- ps: 'Write-Host "Running $env:BUILDER with $env:GENERATOR" -ForegroundColor Magenta'
- if "%BUILDER%"=="CMake" cmake.exe -G "%GENERATOR%" -DCMAKE_BUILD_TYPE=%CONFIGURATION% %APPVEYOR_BUILD_FOLDER%
build_script:
- ps: 'Write-Host "Running $env:BUILDER:" -ForegroundColor Magenta'
- if "%BUILDER%"=="CMake" cmake --build . --config %CONFIGURATION%
test_script:
- ps: 'Write-Host "Running tests:" -ForegroundColor Magenta'
- if "%BUILDER%"=="CMake" ctest -V --output-on-failure -C %CONFIGURATION%

View file

@ -21,8 +21,9 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE. // SOFTWARE.
#include <iostream>
#include <nameof.hpp> #include <nameof.hpp>
#include <iostream>
#include <stdexcept>
struct SomeStruct { struct SomeStruct {
int SomeField; int SomeField;

View file

@ -6,4 +6,6 @@ set(SRC
3rdparty/Catch2/catch.hpp 3rdparty/Catch2/catch.hpp
${CMAKE_SOURCE_DIR}/src/nameof.hpp) ${CMAKE_SOURCE_DIR}/src/nameof.hpp)
add_executable(${PROJECT_NAME}_test ${SRC}) add_executable(${PROJECT_NAME}_test ${SRC})
add_test(NAME ${PROJECT_NAME}_test COMMAND ${PROJECT_NAME}_test)