diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 2d0b88f..7167c09 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -58,9 +58,15 @@ - name: Test working-directory: ${{github.workspace}}/build shell: bash - run: if [ "${{ matrix.os }}" == "windows-latest" ]; then cd ${{ matrix.type }}; fi; ./utest_test + run: if [ "${{ matrix.os }}" == "windows-latest" ]; then cd ${{ matrix.type }}; fi; ./utest_test - name: Test Whole Program Optimization working-directory: ${{github.workspace}}/build shell: bash - run: if [ "${{ matrix.os }}" == "windows-latest" ]; then cd ${{ matrix.type }}; fi; ./utest_test_wpo + run: if [ "${{ matrix.os }}" == "windows-latest" ]; then cd ${{ matrix.type }}; fi; ./utest_test_wpo + + - name: Test with Multithreading + working-directory: ${{github.workspace}}/build + shell: bash + if: startsWith(matrix.os, 'windows') + run: if [ "${{ matrix.os }}" == "windows-latest" ]; then cd ${{ matrix.type }}; fi; ./utest_test_mt diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 2d0b88f..7167c09 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -58,9 +58,15 @@ - name: Test working-directory: ${{github.workspace}}/build shell: bash - run: if [ "${{ matrix.os }}" == "windows-latest" ]; then cd ${{ matrix.type }}; fi; ./utest_test + run: if [ "${{ matrix.os }}" == "windows-latest" ]; then cd ${{ matrix.type }}; fi; ./utest_test - name: Test Whole Program Optimization working-directory: ${{github.workspace}}/build shell: bash - run: if [ "${{ matrix.os }}" == "windows-latest" ]; then cd ${{ matrix.type }}; fi; ./utest_test_wpo + run: if [ "${{ matrix.os }}" == "windows-latest" ]; then cd ${{ matrix.type }}; fi; ./utest_test_wpo + + - name: Test with Multithreading + working-directory: ${{github.workspace}}/build + shell: bash + if: startsWith(matrix.os, 'windows') + run: if [ "${{ matrix.os }}" == "windows-latest" ]; then cd ${{ matrix.type }}; fi; ./utest_test_mt diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index c27da2a..028300f 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -144,3 +144,20 @@ target_compile_options(utest_test_wpo PRIVATE "$<$:/GL>") target_link_options(utest_test_wpo PRIVATE "$<$:/LTCG>") endif() + +if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") + add_executable(utest_test_mt + ../utest.h + main.c + test.c + test11.c + test99.c + test.cpp + test11.cpp + stdint_include.c + type_printers.c + type_printers.cpp + ) + + target_compile_definitions(utest_test_mt PUBLIC "/MT") +endif() diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 2d0b88f..7167c09 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -58,9 +58,15 @@ - name: Test working-directory: ${{github.workspace}}/build shell: bash - run: if [ "${{ matrix.os }}" == "windows-latest" ]; then cd ${{ matrix.type }}; fi; ./utest_test + run: if [ "${{ matrix.os }}" == "windows-latest" ]; then cd ${{ matrix.type }}; fi; ./utest_test - name: Test Whole Program Optimization working-directory: ${{github.workspace}}/build shell: bash - run: if [ "${{ matrix.os }}" == "windows-latest" ]; then cd ${{ matrix.type }}; fi; ./utest_test_wpo + run: if [ "${{ matrix.os }}" == "windows-latest" ]; then cd ${{ matrix.type }}; fi; ./utest_test_wpo + + - name: Test with Multithreading + working-directory: ${{github.workspace}}/build + shell: bash + if: startsWith(matrix.os, 'windows') + run: if [ "${{ matrix.os }}" == "windows-latest" ]; then cd ${{ matrix.type }}; fi; ./utest_test_mt diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index c27da2a..028300f 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -144,3 +144,20 @@ target_compile_options(utest_test_wpo PRIVATE "$<$:/GL>") target_link_options(utest_test_wpo PRIVATE "$<$:/LTCG>") endif() + +if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") + add_executable(utest_test_mt + ../utest.h + main.c + test.c + test11.c + test99.c + test.cpp + test11.cpp + stdint_include.c + type_printers.c + type_printers.cpp + ) + + target_compile_definitions(utest_test_mt PUBLIC "/MT") +endif() diff --git a/utest.h b/utest.h index 26bf890..58c83c7 100644 --- a/utest.h +++ b/utest.h @@ -69,19 +69,20 @@ #endif #if defined(_MSC_VER) -#if defined(_M_IX86) -#define _X86_ -#endif +typedef union { + struct { + unsigned long LowPart; + long HighPart; + } DUMMYSTRUCTNAME; + struct { + unsigned long LowPart; + long HighPart; + } u; + utest_int64_t QuadPart; +} utest_large_integer; -#if defined(_M_AMD64) -#define _AMD64_ -#endif - -#pragma warning(push, 1) -#include -#include -#pragma warning(pop) - +__declspec(dllimport) int __stdcall QueryPerformanceCounter(utest_large_integer *); +__declspec(dllimport) int __stdcall QueryPerformanceFrequency(utest_large_integer *); #elif defined(__linux__) /* @@ -194,8 +195,8 @@ static UTEST_INLINE utest_int64_t utest_ns(void) { #ifdef _MSC_VER - LARGE_INTEGER counter; - LARGE_INTEGER frequency; + utest_large_integer counter; + utest_large_integer frequency; QueryPerformanceCounter(&counter); QueryPerformanceFrequency(&frequency); return UTEST_CAST(utest_int64_t,