asio icon indicating copy to clipboard operation
asio copied to clipboard

CYGWIN can define ASIO_WINDOWS.

Open carlo-bramini opened this issue 3 years ago • 2 comments

If you look into all sources that have at least a test on __CYGWIN__ macro, you will see that there is always ASIO_WINDOWS too.

So, I'm wondering what you will think about doing this change:

  1. Remove all tests on __CYGWIN__ from the sources except from:
asio\include\asio\detail\pop_options.hpp
asio\include\asio\detail\push_options.hpp

just because here it is used for a different purpose.

  1. into asio\include\asio\detail\config.hpp, you can remove again __CYGWIN__ and add something like this:
diff --git a/asio/include/asio/detail/config.hpp b/asio/include/asio/detail/config.hpp
index abe264fb..01703562 100644
--- a/asio/include/asio/detail/config.hpp
+++ b/asio/include/asio/detail/config.hpp
@@ -1364,6 +1364,8 @@
 #   define ASIO_WINDOWS 1
 #  elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
 #   define ASIO_WINDOWS 1
+#  elif defined(__CYGWIN__) && !defined(ASIO_CYGWIN)
+#   define ASIO_WINDOWS 1
 #  elif defined(ASIO_WINDOWS_APP)
 #   define ASIO_WINDOWS 1
 #  endif // defined(ASIO_HAS_BOOST_CONFIG) && defined(BOOST_WINDOWS)

When compiling under CYGWIN, it will work exactly like now and, by defining ASIO_CYGWIN into the CFLAGS or on the command line, the user can decide which socket implementation to use, if W32_SOCKETS or the sockets provided by the POSIX layer. I had to do this with my port of Codelite for CYGWIN since it didn't like to mix several POSIX include files with Windows.h and it made ASIO working immediately with 64bit version of CYGWIN. If you think that it could be an useful change, I can provide a PR.

Sincerely.

carlo-bramini avatar Feb 08 '22 11:02 carlo-bramini

Hope this will finally fix Cygwin 64bit compilation issue - https://github.com/chriskohlhoff/asio/issues/518

chronoxor avatar Jul 12 '22 22:07 chronoxor

@carlo-bramini could you please make a PR for Cygwin 64bit?

chronoxor avatar Jul 12 '22 22:07 chronoxor