diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e44d8c2..890cfd8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,3 +39,13 @@ jobs: CXX: ${{ matrix.cxx }} CXXFLAGS: -std=${{ matrix.std }} run: ./configure && make && make check + msvc: + name: MSVC on windows-latest + runs-on: windows-latest + steps: + - uses: actions/checkout@v2 + - name: Build and run tests + run: | + cmake -S . -B . + cmake --build . + ctest -C Debug diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..d9cd11b --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,28 @@ +cmake_minimum_required(VERSION 3.12) + +project( + fsmlite + LANGUAGES CXX + HOMEPAGE_URL "https://github.com/tkem/fsmlite" +) + +add_library(${PROJECT_NAME} INTERFACE) + +target_compile_features(${PROJECT_NAME} INTERFACE cxx_std_11) + +target_include_directories(${PROJECT_NAME} INTERFACE + $ + $ +) + +list(APPEND PUBLIC_HEADERS + "${CMAKE_CURRENT_SOURCE_DIR}/src/fsm.h" +) + +if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) + include(CTest) +endif() + +if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING) + add_subdirectory(tests) +endif() diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 0000000..7b7828e --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1,21 @@ +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) + +fsmlite_add_test(test_basic_row) +fsmlite_add_test(test_mem_fn_row) +fsmlite_add_test(test_notrans) +fsmlite_add_test(test_player) +fsmlite_add_test(test_recursive) +fsmlite_add_test(test_row) +fsmlite_add_test(test_scoped) +fsmlite_add_test(test_shared) +fsmlite_add_test(test_traits)