diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e609418..b701b26 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -108,6 +108,28 @@ jobs: - name: Test Release run: ./build/release/test/all_tests + test_windows: + name: "Test (windows-latest, msvc)" + runs-on: windows-latest + steps: + - name: Checkout Code + uses: actions/checkout@v4 + with: + submodules: recursive + fetch-tags: true + - name: Build Debug + run: | + mkdir build64 + cmake -G "Visual Studio 17 2022" -A x64 -S . -B "build64" + cmake --build build64 --config Debug + - name: Test Debug + run: 'build64\test\Debug\all_tests.exe' + - name: Build Release + run: | + cmake --build build64 --config Release + - name: Test Release + run: 'build64\test\Release\all_tests.exe' + documentation: name: Generate Documentation needs: diff --git a/CMakeLists.txt b/CMakeLists.txt index 5fadb6a..3d1713f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,6 @@ project(IonC VERSION 1.1.3 LANGUAGES CXX C) - # we default to 'Release' build type if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE) @@ -112,6 +111,9 @@ add_subdirectory(tools) if (IONC_BUILD_TESTS) if (NOT TARGET gtest_main) message("Using included google-test") + # Prevent googletest from linking against different versions of the C Runtime Library on + # Windows. + set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) add_subdirectory(deps/google-test EXCLUDE_FROM_ALL) endif() add_subdirectory(test) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 68a9aaf..15033e6 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -8,11 +8,6 @@ endif() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DGTEST_DONT_DEFINE_SUCCEED=1 -DGTEST_DONT_DEFINE_FAIL=1") # Verbose parameterized names are disabled in debug configuration and on Windows. These don't # always integrate well with IDEs (e.g. CLion), but are nice to have from the command line. -if (MSVC) - # Prevent googletest from linking against different versions of the C Runtime Library on - # Windows. - set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) -endif() add_executable(all_tests gather_vectors.cpp @@ -33,9 +28,6 @@ add_executable(all_tests test_ion_reader_seek.cpp ) -set_property(TARGET all_tests PROPERTY CXX_STANDARD 98) - - target_include_directories(all_tests PRIVATE . diff --git a/test/test_ion_stream.cpp b/test/test_ion_stream.cpp index 017c86c..d79a559 100644 --- a/test/test_ion_stream.cpp +++ b/test/test_ion_stream.cpp @@ -291,11 +291,11 @@ TEST(IonStream, SeekOnUserStreamReadsAllData) { POSITION offset = 0; ION_READ_STATE ion_read_file = { - .in = ION_DATA, - .in_size = sizeof(ION_DATA), - .read_offset = 0, - .block_size = block_size, - .num_calls = 0, + /* .in = */ ION_DATA, + /* .in_size = */ sizeof(ION_DATA), + /* .read_offset = */ 0, + /* .block_size = */ block_size, + /* .num_calls = */ 0, }; ion_reader_open_stream(&reader, &ion_read_file, seek_on_userstream_handler, NULL);