Skip to content

Commit

Permalink
increase windows support
Browse files Browse the repository at this point in the history
  • Loading branch information
i80287 committed Oct 29, 2024
1 parent 1e80ada commit 5ac6493
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 40 deletions.
2 changes: 1 addition & 1 deletion number_theory/test_math_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ template <class IntType>
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
Expand Down
80 changes: 42 additions & 38 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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()
Expand Down
4 changes: 3 additions & 1 deletion tests/run_windows_msys2_mingw_64_tests.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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%
Expand Down

0 comments on commit 5ac6493

Please sign in to comment.