mirror of
https://github.com/shadowsocks/shadowsocks-libev.git
synced 2026-10-28 11:43:50 +00:00
Merge pull request #2698 from DDoSolitary/patch-cmake-mingw
Fix support for building with CMake and MinGW.
This commit is contained in:
+8
-1
@@ -91,9 +91,13 @@ set(LIBCORK_SOURCE
|
||||
libcork/src/libcork/posix/exec.c
|
||||
libcork/src/libcork/posix/files.c
|
||||
libcork/src/libcork/posix/process.c
|
||||
libcork/src/libcork/posix/subprocess.c
|
||||
libcork/src/libcork/pthreads/thread.c
|
||||
)
|
||||
if (NOT MINGW)
|
||||
set(LIBCORK_SOURCE ${LIBCORK_SOURCE} libcork/src/libcork/posix/subprocess.c)
|
||||
else ()
|
||||
set(LIBCORK_SOURCE ${LIBCORK_SOURCE} libcork/src/libcork/posix/mingw.c)
|
||||
endif ()
|
||||
|
||||
if (WITH_STATIC)
|
||||
add_library(cork STATIC ${LIBCORK_SOURCE})
|
||||
@@ -103,6 +107,9 @@ endif ()
|
||||
add_library(cork-shared SHARED ${LIBCORK_SOURCE})
|
||||
target_compile_definitions(cork-shared PUBLIC -DCORK_API=CORK_EXPORT)
|
||||
set_target_properties(cork-shared PROPERTIES OUTPUT_NAME cork)
|
||||
if (MINGW)
|
||||
target_link_libraries(cork-shared ws2_32)
|
||||
endif ()
|
||||
|
||||
set(LIBIPSET_SOURCE
|
||||
libipset/src/libipset/general.c
|
||||
|
||||
+20
-2
@@ -1,8 +1,10 @@
|
||||
# redir need linux/* stuff
|
||||
if (LINUX)
|
||||
option(WITH_SS_REDIR "Build ss-redir" ON)
|
||||
option(WITH_SS_MANAGER "Build ss-manager" ON)
|
||||
else ()
|
||||
option(WITH_SS_REDIR "Build ss-redir" OFF)
|
||||
option(WITH_SS_MANAGER "Build ss-manager" OFF)
|
||||
endif ()
|
||||
|
||||
|
||||
@@ -29,6 +31,9 @@ set(SS_SHARED_SOURCES
|
||||
json.c
|
||||
netutils.c
|
||||
)
|
||||
if (MINGW)
|
||||
set(SS_SHARED_SOURCES ${SS_SHARED_SOURCES} winsock.c)
|
||||
endif ()
|
||||
|
||||
set(LIBSHADOWSOCKS_LIBEV_SOURCE
|
||||
${SS_SHARED_SOURCES}
|
||||
@@ -110,6 +115,11 @@ list(APPEND DEPS
|
||||
${LIBMBEDTLS}
|
||||
${LIBMBEDCRYPTO}
|
||||
)
|
||||
|
||||
if (MINGW)
|
||||
list(APPEND DEPS ws2_32)
|
||||
add_compile_definitions(CARES_STATICLIB PCRE_STATIC)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
find_library(LIBSODIUM_SHARED sodium)
|
||||
@@ -158,7 +168,11 @@ if (WITH_STATIC)
|
||||
# By default we use normal name for static, all shared targets will add a `-shared' suffix
|
||||
add_executable(ss-server ${SS_SERVER_SOURCE})
|
||||
add_executable(ss-tunnel ${SS_TUNNEL_SOURCE})
|
||||
add_executable(ss-manager ${SS_MANAGER_SOURCE})
|
||||
if (WITH_SS_MANAGER)
|
||||
add_executable(ss-manager ${SS_MANAGER_SOURCE})
|
||||
else ()
|
||||
add_executable(ss-manager EXCLUDE_FROM_ALL ${SS_MANAGER_SOURCE})
|
||||
endif ()
|
||||
add_executable(ss-local ${SS_LOCAL_SOURCE})
|
||||
if (WITH_SS_REDIR)
|
||||
add_executable(ss-redir ${SS_REDIR_SOURCE})
|
||||
@@ -192,7 +206,11 @@ endif ()
|
||||
# For shared binary, we still use the same name as static, without `-shared', but will output to shared directory
|
||||
add_executable(ss-server-shared ${SS_SERVER_SOURCE})
|
||||
add_executable(ss-tunnel-shared ${SS_TUNNEL_SOURCE})
|
||||
add_executable(ss-manager-shared ${SS_MANAGER_SOURCE})
|
||||
if (WITH_SS_MANAGER)
|
||||
add_executable(ss-manager-shared ${SS_MANAGER_SOURCE})
|
||||
else ()
|
||||
add_executable(ss-manager-shared EXCLUDE_FROM_ALL ${SS_MANAGER_SOURCE})
|
||||
endif ()
|
||||
add_executable(ss-local-shared ${SS_LOCAL_SOURCE})
|
||||
if (WITH_SS_REDIR)
|
||||
add_executable(ss-redir-shared ${SS_REDIR_SOURCE})
|
||||
|
||||
Reference in New Issue
Block a user