From 7519765018750640da7198194084c6d5f19127a7 Mon Sep 17 00:00:00 2001 From: taynpg Date: Tue, 24 Dec 2024 12:47:12 +0800 Subject: [PATCH] =?UTF-8?q?compile=EF=BC=9A=E4=BF=AE=E6=AD=A3win=E4=B8=8Bm?= =?UTF-8?q?ingw=E7=BC=96=E8=AF=91=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 6 ++++++ client/CMakeLists.txt | 3 +++ ofen | 2 +- server/CMakeLists.txt | 5 ++++- 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 66ae85e..42f9a20 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,6 +8,12 @@ if (MSVC) add_compile_options(/source-charset:utf-8) endif() +if (CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND CMAKE_SYSTEM_NAME MATCHES "Windows") + MESSAGE(STATUS "Add MinGW Param.") + add_compile_options(-finput-charset=utf-8) + add_compile_options(-fexec-charset=gbk) +endif() + set(CMAKE_DEBUG_POSTFIX "d") message(STATUS "System: ${CMAKE_SYSTEM_NAME}") message(STATUS "Compiler CXX ID: ${CMAKE_CXX_COMPILER_ID}") diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index 1be1123..b774a32 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -12,4 +12,7 @@ add_executable(transmc main.cpp client.h client.cpp file_oper.h file_oper.cpp) target_link_libraries(transmc PRIVATE trans_net trans_util) if (UNIX) target_link_libraries(transmc PRIVATE pthread) +endif() +if (CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND CMAKE_SYSTEM_NAME MATCHES "Windows") + target_link_libraries(transmc PRIVATE ws2_32 wsock32) endif() \ No newline at end of file diff --git a/ofen b/ofen index cf6168a..1e83e39 160000 --- a/ofen +++ b/ofen @@ -1 +1 @@ -Subproject commit cf6168a89a784521df0c9d63a049bc025daa1b85 +Subproject commit 1e83e393eb2ee59d05690a7c39bf807c994560b2 diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt index 2a72936..5c26e0a 100644 --- a/server/CMakeLists.txt +++ b/server/CMakeLists.txt @@ -10,5 +10,8 @@ endif() add_executable(transms main.cpp server.h server.cpp) target_link_libraries(transms PRIVATE trans_net trans_util) if (UNIX) -target_link_libraries(transms PRIVATE pthread) + target_link_libraries(transms PRIVATE pthread) +endif() +if (CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND CMAKE_SYSTEM_NAME MATCHES "Windows") + target_link_libraries(transms PRIVATE ws2_32 wsock32) endif() \ No newline at end of file