From cd9b35a7539e2ae0cf42db7e6ae285dccce8c522 Mon Sep 17 00:00:00 2001 From: Neargye Date: Tue, 4 Sep 2018 19:41:01 +0500 Subject: [PATCH] update build --- .appveyor.yml | 2 +- .travis.yml | 58 +++++++++++++++++++++++++------------------------- CMakeLists.txt | 23 +++++++++++++++++--- 3 files changed, 50 insertions(+), 33 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 86b9a64..5cf0a17 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -25,7 +25,7 @@ before_build: - if exist build RMDIR /S /Q build - if not exist build mkdir build - cd build - - cmake -G "%GENERATOR%" -A %PLATFORM% -DCMAKE_BUILD_TYPE=${CONFIGURATION} .. + - cmake -G "%GENERATOR%" -A %PLATFORM% .. build_script: - cmake --build . --config %CONFIGURATION% diff --git a/.travis.yml b/.travis.yml index dd573d8..fa6011b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,7 +19,7 @@ matrix: packages: - g++-4.8 env: - - CXX_COMPILER=g++-4.8 CC_COMPILER=gcc-4.8 CONFIGURATION=Debug + - CXX_COMPILER=g++-4.8 CC_COMPILER=gcc-4.8 - os: linux compiler: g++ @@ -30,7 +30,7 @@ matrix: packages: - g++-4.9 env: - - CXX_COMPILER=g++-4.9 CC_COMPILER=gcc-4.9 CONFIGURATION=Debug + - CXX_COMPILER=g++-4.9 CC_COMPILER=gcc-4.9 - os: linux compiler: g++ @@ -41,7 +41,7 @@ matrix: packages: - g++-5 env: - - CXX_COMPILER=g++-5 CC_COMPILER=gcc-5 CONFIGURATION=Debug + - CXX_COMPILER=g++-5 CC_COMPILER=gcc-5 - os: linux compiler: g++ @@ -52,7 +52,7 @@ matrix: packages: - g++-6 env: - - CXX_COMPILER=g++-6 CC_COMPILER=gcc-6 CONFIGURATION=Debug + - CXX_COMPILER=g++-6 CC_COMPILER=gcc-6 - os: linux compiler: g++ @@ -63,7 +63,7 @@ matrix: packages: - g++-7 env: - - CXX_COMPILER=g++-7 CC_COMPILER=gcc-7 CONFIGURATION=Debug + - CXX_COMPILER=g++-7 CC_COMPILER=gcc-7 - os: linux compiler: g++ @@ -74,7 +74,7 @@ matrix: packages: - g++-8 env: - - CXX_COMPILER=g++-8 CC_COMPILER=gcc-8 CONFIGURATION=Debug + - CXX_COMPILER=g++-8 CC_COMPILER=gcc-8 - os: linux compiler: clang++ @@ -86,7 +86,7 @@ matrix: packages: - clang-3.6 env: - - CXX_COMPILER=clang++-3.6 CC_COMPILER=clang-3.6 CONFIGURATION=Debug + - CXX_COMPILER=clang++-3.6 CC_COMPILER=clang-3.6 - os: linux compiler: clang++ @@ -98,7 +98,7 @@ matrix: packages: - clang-3.7 env: - - CXX_COMPILER=clang++-3.7 CC_COMPILER=clang-3.7 CONFIGURATION=Debug + - CXX_COMPILER=clang++-3.7 CC_COMPILER=clang-3.7 - os: linux compiler: clang++ @@ -110,7 +110,7 @@ matrix: packages: - clang-3.8 env: - - CXX_COMPILER=clang++-3.8 CC_COMPILER=clang-3.8 CONFIGURATION=Debug + - CXX_COMPILER=clang++-3.8 CC_COMPILER=clang-3.8 - os: linux compiler: clang++ @@ -122,7 +122,7 @@ matrix: packages: - clang-3.9 env: - - CXX_COMPILER=clang++-3.9 CC_COMPILER=clang-3.9 CONFIGURATION=Debug + - CXX_COMPILER=clang++-3.9 CC_COMPILER=clang-3.9 - os: linux compiler: clang++ @@ -134,7 +134,7 @@ matrix: packages: - clang-4.0 env: - - CXX_COMPILER=clang++-4.0 CC_COMPILER=clang-4.0 CONFIGURATION=Debug + - CXX_COMPILER=clang++-4.0 CC_COMPILER=clang-4.0 - os: linux compiler: clang++ @@ -146,7 +146,7 @@ matrix: packages: - clang-5.0 env: - - CXX_COMPILER=clang++-5.0 CC_COMPILER=clang-5.0 CONFIGURATION=Debug + - CXX_COMPILER=clang++-5.0 CC_COMPILER=clang-5.0 - os: linux compiler: clang++ @@ -158,85 +158,85 @@ matrix: packages: - clang-6.0 env: - - CXX_COMPILER=clang++-6.0 CC_COMPILER=clang-6.0 CONFIGURATION=Debug + - CXX_COMPILER=clang++-6.0 CC_COMPILER=clang-6.0 - os: osx compiler: clang++ osx_image: xcode7.0 env: - - CXX_COMPILER=clang++ CC_COMPILER=clang CONFIGURATION=Debug + - CXX_COMPILER=clang++ CC_COMPILER=clang - os: osx compiler: clang++ osx_image: xcode7.1 env: - - CXX_COMPILER=clang++ CC_COMPILER=clang CONFIGURATION=Debug + - CXX_COMPILER=clang++ CC_COMPILER=clang - os: osx compiler: clang++ osx_image: xcode7.2 env: - - CXX_COMPILER=clang++ CC_COMPILER=clang CONFIGURATION=Debug + - CXX_COMPILER=clang++ CC_COMPILER=clang - os: osx compiler: clang++ osx_image: xcode7.3 env: - - CXX_COMPILER=clang++ CC_COMPILER=clang CONFIGURATION=Debug + - CXX_COMPILER=clang++ CC_COMPILER=clang - os: osx compiler: clang++ osx_image: xcode8.0 env: - - CXX_COMPILER=clang++ CC_COMPILER=clang CONFIGURATION=Debug + - CXX_COMPILER=clang++ CC_COMPILER=clang - os: osx compiler: clang++ osx_image: xcode8.1 env: - - CXX_COMPILER=clang++ CC_COMPILER=clang CONFIGURATION=Debug + - CXX_COMPILER=clang++ CC_COMPILER=clang - os: osx compiler: clang++ osx_image: xcode8.2 env: - - CXX_COMPILER=clang++ CC_COMPILER=clang CONFIGURATION=Debug + - CXX_COMPILER=clang++ CC_COMPILER=clang - os: osx compiler: clang++ osx_image: xcode8.3 env: - - CXX_COMPILER=clang++ CC_COMPILER=clang CONFIGURATION=Debug + - CXX_COMPILER=clang++ CC_COMPILER=clang - os: osx compiler: clang++ osx_image: xcode9.0 env: - - CXX_COMPILER=clang++ CC_COMPILER=clang CONFIGURATION=Debug + - CXX_COMPILER=clang++ CC_COMPILER=clang - os: osx compiler: clang++ osx_image: xcode9.1 env: - - CXX_COMPILER=clang++ CC_COMPILER=clang CONFIGURATION=Debug + - CXX_COMPILER=clang++ CC_COMPILER=clang - os: osx compiler: clang++ osx_image: xcode9.2 env: - - CXX_COMPILER=clang++ CC_COMPILER=clang CONFIGURATION=Debug + - CXX_COMPILER=clang++ CC_COMPILER=clang - os: osx compiler: clang++ osx_image: xcode9.3 env: - - CXX_COMPILER=clang++ CC_COMPILER=clang CONFIGURATION=Debug + - CXX_COMPILER=clang++ CC_COMPILER=clang - os: osx compiler: clang++ osx_image: xcode9.4 env: - - CXX_COMPILER=clang++ CC_COMPILER=clang CONFIGURATION=Debug + - CXX_COMPILER=clang++ CC_COMPILER=clang install: - export CC=${CC_COMPILER} @@ -274,11 +274,11 @@ before_script: - rm -rf build - mkdir -p build - cd build - - cmake -DCMAKE_BUILD_TYPE=${CONFIGURATION} .. + - cmake -G "Unix Makefiles" .. script: - - cmake --build . --config ${CONFIGURATION} -- -j${JOBS} - - ctest --output-on-failure -С ${CONFIGURATION} -j${JOBS} + - cmake --build . -- -j${JOBS} + - ctest --output-on-failure -j${JOBS} notifications: email: false diff --git a/CMakeLists.txt b/CMakeLists.txt index 1c18d1a..0b80b11 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,8 +1,25 @@ cmake_minimum_required(VERSION 3.2) +include(GNUInstallDirs) + project(nameof LANGUAGES CXX) +set(${PROJECT_NAME} "0.5.0") +set(package_name ${PROJECT_NAME}) +set(include_source_dir "${CMAKE_SOURCE_DIR}/include") -add_subdirectory(example) +option(NAMEOF_OPT_BUILD_EXAMPLES "Build nameof examples" ON) +option(NAMEOF_OPT_BUILD_TESTS "Build and perform nameof tests" ON) -enable_testing() -add_subdirectory(test) +add_library(${package_name} INTERFACE) +target_include_directories(${package_name} INTERFACE "$") + +if(NAMEOF_OPT_BUILD_EXAMPLES) + add_subdirectory(example) +endif() + +if(NAMEOF_OPT_BUILD_TESTS) + enable_testing() + add_subdirectory(test) +endif() + +install(DIRECTORY ${CMAKE_SOURCE_DIR}/include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})