diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 890cfd8..43b8934 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,12 +40,19 @@ jobs: CXXFLAGS: -std=${{ matrix.std }} run: ./configure && make && make check msvc: - name: MSVC on windows-latest + name: Windows ${{ matrix.config }} build (C++${{ matrix.standard }}) runs-on: windows-latest + strategy: + fail-fast: false + matrix: + config: [Debug, Release] + standard: [11, 17] steps: - uses: actions/checkout@v2 - - name: Build and run tests - run: | - cmake -S . -B . - cmake --build . - ctest -C Debug + - name: Configure CMake + run: cmake -B build -D CMAKE_CXX_STANDARD=${{ matrix.standard }} + - name: Build + run: cmake --build build --config ${{ matrix.config }} + - name: Run tests + working-directory: build + run: ctest -C ${{ matrix.config }} diff --git a/src/fsm.h b/src/fsm.h index 8fa0e32..8b987e9 100644 --- a/src/fsm.h +++ b/src/fsm.h @@ -34,13 +34,13 @@ namespace fsmlite { namespace detail { -#if __cplusplus >= 201703L +#if __cplusplus >= 201703L || _MSVC_LANG >= 201703L template using invoke_result_t = std::invoke_result_t; template using is_invocable = std::is_invocable; -#elif __cplusplus >= 201103L +#elif __cplusplus >= 201103L || _MSVC_LANG >= 201103L template using invoke_result_t = typename std::result_of::type; @@ -357,7 +357,7 @@ namespace fsmlite { } }; -#if __cplusplus >= 201703L +#if __cplusplus >= 201703L || _MSVC_LANG >= 201703L /** * Generic transition class template (requires C++17). * diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 7b7828e..60e3b68 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,12 +1,6 @@ macro(fsmlite_add_test TESTNAME) add_executable(${TESTNAME} ${CMAKE_CURRENT_SOURCE_DIR}/${TESTNAME}.cpp) target_link_libraries(${TESTNAME} PRIVATE fsmlite) - if (MSVC AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.14) - target_compile_options(${TESTNAME} - PRIVATE - /Zc:__cplusplus - ) - endif() add_test(NAME ${PROJECT_NAME}_${TESTNAME} COMMAND ${TESTNAME}) endmacro(fsmlite_add_test) diff --git a/tests/test_player.cpp b/tests/test_player.cpp index f26c6c2..69a56f0 100644 --- a/tests/test_player.cpp +++ b/tests/test_player.cpp @@ -4,7 +4,7 @@ #include #include -#if __cplusplus >= 201703L +#if __cplusplus >= 201703L || _MSVC_LANG >= 201703L class player: public fsmlite::fsm { friend class fsmlite::fsm; // base class needs access to transition_table diff --git a/tests/test_row.cpp b/tests/test_row.cpp index abe2a5f..afe8227 100644 --- a/tests/test_row.cpp +++ b/tests/test_row.cpp @@ -2,7 +2,7 @@ #include "fsm.h" -#if __cplusplus >= 201703L +#if __cplusplus >= 201703L || _MSVC_LANG >= 201703L int value = 0; @@ -55,7 +55,7 @@ class state_machine: public fsmlite::fsm { int main() { -#if __cplusplus >= 201703L +#if __cplusplus >= 201703L || _MSVC_LANG >= 201703L state_machine m; assert(m.current_state() == state_machine::Init); assert(value == 0);