Skip to content

Commit

Permalink
[platform] support mingw-w64
Browse files Browse the repository at this point in the history
  • Loading branch information
poor-circle committed Jul 28, 2023
1 parent 158c5f9 commit febdfc1
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/coro_http/examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,8 @@ endif()

add_executable(coro_http_example example.cpp)
add_executable(coro_http_channel channel.cpp)

if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_SYSTEM_NAME MATCHES "Windows") # mingw-w64
target_link_libraries(coro_http_example wsock32 ws2_32)
target_link_libraries(coro_http_channel wsock32 ws2_32)
endif()
4 changes: 4 additions & 0 deletions src/coro_io/examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,7 @@ endif()

add_executable(coro_io_example main.cpp)

if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_SYSTEM_NAME MATCHES "Windows") # mingw-w64
target_link_libraries(coro_io_example wsock32 ws2_32)
endif()

3 changes: 3 additions & 0 deletions src/coro_io/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ add_executable(coro_io_test
test_client_pool.cpp
main.cpp
)
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_SYSTEM_NAME MATCHES "Windows") # mingw-w64
target_link_libraries(coro_io_test wsock32 ws2_32)
endif()
add_test(NAME coro_io_test COMMAND coro_io_test)


Expand Down
9 changes: 8 additions & 1 deletion src/coro_rpc/benchmark/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/output/benchmark)

add_executable(coro_rpc_benchmark_server server.cpp)

add_executable(coro_rpc_benchmark_client client.cpp)

if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_SYSTEM_NAME MATCHES "Windows") # mingw-w64
target_link_libraries(coro_rpc_benchmark_server wsock32 ws2_32)
target_link_libraries(coro_rpc_benchmark_client wsock32 ws2_32)
endif()

if (GENERATE_BENCHMARK_DATA)
add_executable(coro_rpc_benchmark_data_gen data_gen.cpp)
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_SYSTEM_NAME MATCHES "Windows") # mingw-w64
target_link_libraries(coro_rpc_benchmark_data_gen wsock32 ws2_32)
endif()
target_compile_definitions(coro_rpc_benchmark_data_gen PRIVATE GENERATE_BENCHMARK_DATA)
add_custom_command(
TARGET coro_rpc_benchmark_data_gen POST_BUILD
Expand Down
9 changes: 9 additions & 0 deletions src/coro_rpc/examples/base_examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,12 @@ add_executable(coro_rpc_example_client client.cpp)
add_executable(coro_rpc_example_concurrent_clients concurrent_clients.cpp)
add_executable(coro_rpc_example_server server.cpp rpc_service.cpp)

if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_SYSTEM_NAME MATCHES "Windows") # mingw-w64
target_link_libraries(coro_rpc_example_channel wsock32 ws2_32)
target_link_libraries(coro_rpc_example_client_pool wsock32 ws2_32)
target_link_libraries(coro_rpc_example_client_pools wsock32 ws2_32)
target_link_libraries(coro_rpc_example_client wsock32 ws2_32)
target_link_libraries(coro_rpc_example_concurrent_clients wsock32 ws2_32)
target_link_libraries(coro_rpc_example_server wsock32 ws2_32)
endif()

5 changes: 5 additions & 0 deletions src/coro_rpc/examples/file_transfer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,8 @@ add_executable(coro_rpc_file_server
)
add_executable(coro_rpc_file_client file_client.cpp)

if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_SYSTEM_NAME MATCHES "Windows") # mingw-w64
target_link_libraries(coro_rpc_file_server wsock32 ws2_32)
target_link_libraries(coro_rpc_file_client wsock32 ws2_32)
endif()

Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ endif()
target_compile_definitions(coro_rpc_example_use_rest_rpc_protocol PRIVATE HAVE_MSGPACK)
target_compile_definitions(coro_rpc_example_use_rest_rpc_protocol PRIVATE MSGPACK_NO_BOOST)

if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_SYSTEM_NAME MATCHES "Windows") # mingw-w64
target_link_libraries(coro_rpc_example_use_rest_rpc_protocol wsock32 ws2_32)
endif()

else()
message(WARNING "Could Not Found Msgpack, disable coro_rpc_example_use_rest_rpc_protocol")
endif()
9 changes: 8 additions & 1 deletion src/coro_rpc/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,11 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/output/tests/coro_rpc)

add_executable(coro_rpc_regist_test_1 rpc_api.cpp test_register_duplication_1.cpp)
add_executable(coro_rpc_regist_test_2 rpc_api.cpp test_register_duplication_2.cpp)
add_executable(coro_rpc_regist_test_3 rpc_api.cpp test_register_duplication_3.cpp)
add_executable(coro_rpc_regist_test_3 rpc_api.cpp test_register_duplication_3.cpp)

if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_SYSTEM_NAME MATCHES "Windows") # mingw-w64
target_link_libraries(coro_rpc_test wsock32 ws2_32)
target_link_libraries(coro_rpc_regist_test_1 wsock32 ws2_32)
target_link_libraries(coro_rpc_regist_test_2 wsock32 ws2_32)
target_link_libraries(coro_rpc_regist_test_3 wsock32 ws2_32)
endif()

0 comments on commit febdfc1

Please sign in to comment.