diff --git a/.github/workflows/build-and-run-tests.yml b/.github/workflows/build-and-run-tests.yml new file mode 100644 index 0000000..822c85e --- /dev/null +++ b/.github/workflows/build-and-run-tests.yml @@ -0,0 +1,49 @@ +name: Build and run tests + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + build: + strategy: + fail-fast: true + + matrix: + os: [ubuntu-latest, windows-latest] + build_type: [Debug, RelWithDebInfo, Release] + cpp_compiler: [g++, clang++] + cpp_standard: [14, 17, 20, 23] + exclude: + - os: ubuntu-latest + cpp_compiler: clang++ + cpp_standard: 20 + - os: ubuntu-latest + cpp_compiler: clang++ + cpp_standard: 23 + - os: windows-latest + cpp_compiler: clang++ + - os: windows-latest + cpp_compiler: g++ + + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v3 + + - name: Install Google Test (Linux) + if: matrix.os == 'ubuntu-latest' + run: | + sudo apt-get install libgtest-dev + + - name: Build and Test + run: | + cmake -S ${{ github.workspace }} -B ${{ github.workspace }}/build \ + -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} \ + -DCMAKE_CXX_STANDARD=${{ matrix.cpp_standard }} \ + -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} + cd ${{ github.workspace }}/build + make + ./bin/utest diff --git a/CMakeLists.txt b/CMakeLists.txt index e592f19..ad9cb84 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,7 +17,7 @@ if ("${CMAKE_CXX_STANDARD}" EQUAL 14) elseif (HAVE_FAKEFLAG) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y") elseif (HAVE_MSVCFLAG) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std:c++14") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std:c++14 -permissive- -Zc:__cplusplus") else() message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++14 support. Please use a different C++ compiler.") endif() @@ -30,20 +30,20 @@ elseif ("${CMAKE_CXX_STANDARD}" EQUAL 17) elseif (HAVE_FAKEFLAG) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1z") elseif (HAVE_MSVCFLAG) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std:c++17") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std:c++17 -permissive- -Zc:__cplusplus") else() message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++17 support. Please use a different C++ compiler.") endif() elseif ("${CMAKE_CXX_STANDARD}" EQUAL 20) check_cxx_compiler_flag("-std=c++20" HAVE_REALFLAG) check_cxx_compiler_flag("-std=c++2a" HAVE_FAKEFLAG) - check_cxx_compiler_flag("-std:c++latest" HAVE_MSVCFLAG) + check_cxx_compiler_flag("-std:c++20" HAVE_MSVCFLAG) if (HAVE_REALFLAG) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++20") elseif (HAVE_FAKEFLAG) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++2a") elseif (HAVE_MSVCFLAG) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std:c++latest") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std:c++20") else() message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++20 support. Please use a different C++ compiler.") endif() @@ -89,7 +89,7 @@ target_include_directories(${PROJECT_NAME} INTERFACE $ ) -add_subdirectory(benchmarks) +# add_subdirectory(benchmarks) add_subdirectory(test) install(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}_targets) diff --git a/README.md b/README.md index 0363c7b..a656ade 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # SG14 -[![Build Status](https://travis-ci.org/Quuxplusone/SG14.svg?branch=master)](https://travis-ci.org/Quuxplusone/SG14) +[![Build Status](https://github.com/Quuxplusone/SG14/actions/workflows/build-and-run-tests.yml/badge.svg?branch=master)](https://github.com/Quuxplusone/SG14/actions/workflows/build-and-run-tests.yml) A library of containers and algorithms pioneered by the ISO C++ Committee's "Low-Latency and Embedded" study group (SG14). For more information on