From ccf3efcd6b54285b4280ddaa63835530e9ce57da Mon Sep 17 00:00:00 2001 From: Jon Griffiths Date: Tue, 26 Nov 2024 20:50:07 +1300 Subject: [PATCH] build (windows): define ssize_t more consistently, skip test_clear Based on a patch by Khachik Shahzadyan --- _cmake/config.h.in | 9 ++++++++- src/amalgamation/windows_config/config.h | 8 ++++++-- src/ctest/_CMakeLists.txt | 10 ++++++---- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/_cmake/config.h.in b/_cmake/config.h.in index d295a82dd..692b63e81 100644 --- a/_cmake/config.h.in +++ b/_cmake/config.h.in @@ -77,6 +77,13 @@ # endif #endif +#if defined (_WIN32) && !defined(_SSIZE_T_DECLARED) && !defined(_ssize_t) && !defined(ssize_t) +#if defined(_WIN64) +typedef __int64 ssize_t; +#else +typedef long ssize_t; +#endif +#endif #include "ccan_config.h" -#endif /*LIBWALLYCORE_CONFIG_H*/ +#endif /* LIBWALLYCORE_CONFIG_H */ diff --git a/src/amalgamation/windows_config/config.h b/src/amalgamation/windows_config/config.h index 454a73eca..fbb95f1fd 100644 --- a/src/amalgamation/windows_config/config.h +++ b/src/amalgamation/windows_config/config.h @@ -10,8 +10,12 @@ #define HAVE_UNALIGNED_ACCESS 1 -#if (!defined(_SSIZE_T_DECLARED)) && (!defined(_ssize_t)) && (!defined(ssize_t)) -#define ssize_t long long +#if defined (_WIN32) && !defined(_SSIZE_T_DECLARED) && !defined(_ssize_t) && !defined(ssize_t) +#if defined(_WIN64) +typedef __int64 ssize_t; +#else +typedef long ssize_t; +#endif #endif #include "ccan_config.h" diff --git a/src/ctest/_CMakeLists.txt b/src/ctest/_CMakeLists.txt index 785081d84..a8214bdea 100644 --- a/src/ctest/_CMakeLists.txt +++ b/src/ctest/_CMakeLists.txt @@ -5,10 +5,12 @@ target_include_directories(test_bech32 PRIVATE ${CMAKE_BINARY_DIR}) target_link_libraries(test_bech32 PRIVATE wallycore) add_test(test_bech32 test_bech32) -add_executable(test_clear test_clear.c) -target_include_directories(test_clear PRIVATE ${CMAKE_BINARY_DIR}) -target_link_libraries(test_clear PRIVATE wallycore pthread) -add_test(test_clear test_clear) +if(NOT WIN32) + add_executable(test_clear test_clear.c) + target_include_directories(test_clear PRIVATE ${CMAKE_BINARY_DIR}) + target_link_libraries(test_clear PRIVATE wallycore pthread) + add_test(test_clear test_clear) +endif() add_executable(test_coinselection test_coinselection.c) target_include_directories(test_coinselection PRIVATE ${CMAKE_BINARY_DIR})