From 2fe2d21131ee90b7d55851d9533ea1c16202be48 Mon Sep 17 00:00:00 2001 From: Jindong Zhang Date: Wed, 4 May 2022 16:11:58 +0800 Subject: [PATCH] add support for windows platform(msys2) --- CMakeLists.txt | 8 +++++++- src/lwipopts.h | 4 ++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 823b121..2789d94 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,6 @@ cmake_minimum_required(VERSION 2.8) project(termtunnel C) set(CMAKE_C_STANDARD 11) - if (CMAKE_HOST_WIN32) set(WINDOWS 1) elseif (CMAKE_HOST_APPLE) @@ -10,8 +9,10 @@ elseif (CMAKE_HOST_UNIX) set(LINUX 1) endif () +IF (NOT CYGWIN) add_subdirectory(thirdparty/libuv) include_directories(thirdparty/libuv/include) +endif() add_compile_options(-fpermissive -O3) @@ -70,7 +71,12 @@ thirdparty/setproctitle.c thirdparty/tinyfiledialogs/tinyfiledialogs.c ) +IF (CYGWIN) # cygwin use system default libuv without epoll. +target_link_libraries(termtunnel uv) +ELSE() target_link_libraries(termtunnel uv_a) +ENDIF() + if (LINUX) target_link_libraries(termtunnel PUBLIC "-static") endif() diff --git a/src/lwipopts.h b/src/lwipopts.h index c2d8f40..a6aef93 100644 --- a/src/lwipopts.h +++ b/src/lwipopts.h @@ -99,7 +99,11 @@ a lot of data that needs to be copied, this should be set high. */ /* MEMP_NUM_NETBUF: the number of struct netbufs. */ #define MEMP_NUM_NETBUF 200000 /* MEMP_NUM_NETCONN: the number of struct netconns. */ +#ifdef __CYGWIN__ +#define MEMP_NUM_NETCONN 20 +#else #define MEMP_NUM_NETCONN 200 // number of socket +#endif /* MEMP_NUM_TCPIP_MSG_*: the number of struct tcpip_msg, which is used for sequential API communication and incoming packets. Used in src/api/tcpip.c. */