From ae4a87bf93ed60efdc8242e57a3ce72852f372ef Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Tue, 21 May 2024 23:46:06 -0700 Subject: Windows: add a check for broken legacy environments without timespec_get. If you want to build on Windows use a toolchain that supports modern APIs. This means, for Microsoft, UCRT (Universal C Runtime), which is supported by default on modern Visual Studio. MinGW users may have to go out of their way to enable it. (New -D_UCRT flag or something.) The supported toolchain for building on Windows is Visual Studio. Use of other tool chains is not officially supported or guaranteed to work. YMMV. --- src/platform/windows/CMakeLists.txt | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/platform/windows/CMakeLists.txt b/src/platform/windows/CMakeLists.txt index adf67ebd..10c31131 100644 --- a/src/platform/windows/CMakeLists.txt +++ b/src/platform/windows/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright 2021 Staysail Systems, Inc. +# Copyright 2024 Staysail Systems, Inc. # # This software is supplied under the terms of the MIT License, a # copy of which should be located in the distribution where this @@ -13,14 +13,16 @@ # the static library unless they also go into the dynamic. if (NNG_PLATFORM_WINDOWS) nng_check_sym(InitializeConditionVariable windows.h NNG_HAVE_CONDVAR) + nng_check_sym(timespec_get time.h NNG_HAVE_TIMESPEC_GET) nng_check_sym(snprintf stdio.h NNG_HAVE_SNPRINTF) - if (NOT NNG_HAVE_CONDVAR OR NOT NNG_HAVE_SNPRINTF) + if (NOT NNG_HAVE_CONDVAR OR NOT NNG_HAVE_SNPRINTF OR NOT NNG_HAVE_TIMESPEC_GET) message(FATAL_ERROR "Modern Windows API support is missing. " "Versions of Windows prior to Vista are not supported. " - "Further, the 32-bit MinGW environment is not supported. " + "Further, the legacy MinGW environments are not supported. " "Ensure you have at least Windows Vista or newer, and are " - "using either Visual Studio 2013 or newer or MinGW-W64.") + "using either Visual Studio 2013 or compatible compiler, " + "and are also using the universal C runtime (UCRT).") endif () nng_link_libraries(ws2_32 mswsock advapi32) @@ -50,4 +52,4 @@ if (NNG_PLATFORM_WINDOWS) nng_test(win_ipc_sec_test) -endif () \ No newline at end of file +endif () -- cgit v1.2.3-70-g09d2