diff --git a/number_theory/test_math_functions.cpp b/number_theory/test_math_functions.cpp index 5a6dcde..ef790aa 100644 --- a/number_theory/test_math_functions.cpp +++ b/number_theory/test_math_functions.cpp @@ -510,7 +510,7 @@ template std::atomic_flag result = ATOMIC_FLAG_INIT; for (size_t i = 0; i < kTotalThreads; ++i) { threads.emplace_back([thread_id = i, &result -#if defined(_MSC_VER) +#if defined(_MSC_VER) && !defined(__clang__) , kTestsPerThread #endif diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 6dd7881..f71c524 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -31,6 +31,7 @@ if (USING_MINGW_GCC) endif() set(LINK_THREADS_LIBRARY_MANUALLY False) +set(LINK_COMPILER_RT_BUILTINS_MANUALLY False) if (CMAKE_SYSTEM_NAME MATCHES "Linux") @@ -249,6 +250,7 @@ function(configure_msvc_or_clang_msvc_options) ${LOCAL_FN_TEST_CXX_COMPILE_OPTIONS} "/W4" # Enable -Wall and -Wextra ) + set(LINK_COMPILER_RT_BUILTINS_MANUALLY True PARENT_SCOPE) else() if (MSVC_VERSION GREATER_EQUAL 1914) set(LOCAL_FN_TEST_CXX_COMPILE_OPTIONS @@ -391,49 +393,47 @@ if (NOT USING_MINGW_GCC_32) list(APPEND TestOptionalDependencies "") list(APPEND TestIsCProject False) - if (NOT (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC")) - list(APPEND TestFilenames "test_integers_128_bit.cpp") - list(APPEND TestDirectories "number_theory") - list(APPEND TestLangVersions "17 20 23 26") - list(APPEND TestDependencies "") - list(APPEND TestOptionalDependencies "") - list(APPEND TestIsCProject False) + list(APPEND TestFilenames "test_integers_128_bit.cpp") + list(APPEND TestDirectories "number_theory") + list(APPEND TestLangVersions "17 20 23 26") + list(APPEND TestDependencies "") + list(APPEND TestOptionalDependencies "") + list(APPEND TestIsCProject False) - list(APPEND TestFilenames "test_math_functions.cpp") - list(APPEND TestDirectories "number_theory") - list(APPEND TestLangVersions "17 20 23 26") - list(APPEND TestDependencies "") - if ((CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "GNU") AND NOT APPLE) - list(APPEND TestOptionalDependencies "mpfr") - else() - list(APPEND TestOptionalDependencies "") - endif() - list(APPEND TestIsCProject False) + list(APPEND TestFilenames "test_math_functions.cpp") + list(APPEND TestDirectories "number_theory") + list(APPEND TestLangVersions "17 20 23 26") + list(APPEND TestDependencies "") + if (LINUX) + list(APPEND TestOptionalDependencies "mpfr") + else() + list(APPEND TestOptionalDependencies "") endif() + list(APPEND TestIsCProject False) - if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "GNU") - list(APPEND TestFilenames "test_is_prime_bpsw.cpp") - list(APPEND TestDirectories "number_theory") - list(APPEND TestLangVersions "17 20 23 26") - list(APPEND TestDependencies "") - if (NOT APPLE) - list(APPEND TestOptionalDependencies "gmp") - else() - list(APPEND TestOptionalDependencies "") - endif() - list(APPEND TestIsCProject False) + list(APPEND TestFilenames "test_is_prime_bpsw.cpp") + list(APPEND TestDirectories "number_theory") + list(APPEND TestLangVersions "17 20 23 26") + list(APPEND TestDependencies "") + if (LINUX) + list(APPEND TestOptionalDependencies "gmp") + else() + list(APPEND TestOptionalDependencies "") + endif() + list(APPEND TestIsCProject False) - list(APPEND TestFilenames "test_kronecker_symbol.cpp") - list(APPEND TestDirectories "number_theory") - list(APPEND TestLangVersions "17 20 23 26") - list(APPEND TestDependencies "") - if (NOT APPLE) - list(APPEND TestOptionalDependencies "gmp gmpxx") - else() - list(APPEND TestOptionalDependencies "") - endif() - list(APPEND TestIsCProject False) + list(APPEND TestFilenames "test_kronecker_symbol.cpp") + list(APPEND TestDirectories "number_theory") + list(APPEND TestLangVersions "17 20 23 26") + list(APPEND TestDependencies "") + if (LINUX) + list(APPEND TestOptionalDependencies "gmp gmpxx") + else() + list(APPEND TestOptionalDependencies "") + endif() + list(APPEND TestIsCProject False) + if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "GNU") list(APPEND TestFilenames "test_long_int.cpp") list(APPEND TestDirectories "number_theory") list(APPEND TestLangVersions "17 20 23 26") @@ -603,6 +603,10 @@ function( target_link_libraries(${target} PUBLIC Threads::Threads) endif() + if (LINK_COMPILER_RT_BUILTINS_MANUALLY) + target_link_libraries(${target} PUBLIC clang_rt.builtins-x86_64) + endif() + if (USING_MINGW_GCC AND NOT WIN32) target_link_options(${target} PUBLIC -static -static-libgcc -static-libstdc++) endif() diff --git a/tests/run_windows_msys2_mingw_64_tests.bat b/tests/run_windows_msys2_mingw_64_tests.bat index 6030e72..2c06b3e 100644 --- a/tests/run_windows_msys2_mingw_64_tests.bat +++ b/tests/run_windows_msys2_mingw_64_tests.bat @@ -8,7 +8,9 @@ copy "..\tf_idf_actrie\Anglo_Saxon_Chronicle.txt" ".\%build_dir%\Anglo_Saxon_Chr cd ".\%build_dir%" -cmake -G "MSYS Makefiles" -DCMAKE_BUILD_TYPE=RelWithDebInfo -S .. -B . +@REM "MSYS Makefiles" - may use clang-cl instead of gcc / clang +@REM "MinGW Makefiles" - may use clang-cl instead of gcc / clang +cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=RelWithDebInfo -S .. -B . if %errorlevel% neq 0 exit /b %errorlevel% make all --jobs %NUMBER_OF_PROCESSORS%