Browse Source

vs2022下,开启新的协程选项

3.0.0
tearshark 10 months ago
parent
commit
bc5ee34456
3 changed files with 29 additions and 2 deletions
  1. 9
    2
      CMakeLists.txt
  2. 11
    0
      benchmark/benchmark_asio_echo.cpp
  3. 9
    0
      benchmark/test_async_cinatra_client.cpp

+ 9
- 2
CMakeLists.txt View File

@@ -34,7 +34,7 @@ message(STATUS "CMAKE_CXX_COMPILER_VERSION=${CMAKE_CXX_COMPILER_VERSION}")
if(${LIBRF_COMPILER_SETTING} STREQUAL "msvc")
if (${CMAKE_CXX_COMPILER_VERSION} VERSION_GREATER_EQUAL "19.30.0.0")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++20 /EHsc /await") #VS2022
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++20 /EHsc") #VS2022
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++latest /EHsc /await") #VS2019
endif()
@@ -147,6 +147,10 @@ target_include_directories(${PROJECT_NAME}
${CMAKE_CURRENT_SOURCE_DIR}/modern_cb
)
if(UNIX)
set_target_properties(${PROJECT_NAME} PROPERTIES INSTALL_RPATH "$ORIGIN/")
endif(UNIX)
if(LIBRF_USE_MIMALLOC)
set(LIB_MIMALLOC, "mimalloc")
else()
@@ -163,8 +167,11 @@ if(CMAKE_ENABLE_UNIT_TEST)
${CMAKE_CURRENT_SOURCE_DIR}/benchmark/benchmark_channel_passing_next.cpp
${ALL_TUTORIAL_FILES})
target_link_libraries(test_librf PUBLIC librf)
if(UNIX)
set_target_properties(test_librf PROPERTIES INSTALL_RPATH "$ORIGIN/")
endif(UNIX)
#add_subdirectory(benchmark)
add_subdirectory(benchmark)
endif()

+ 11
- 0
benchmark/benchmark_asio_echo.cpp View File

@@ -351,3 +351,14 @@ void resumable_main_benchmark_asio_client(intptr_t nNum)
{
resumable_main_benchmark_asio_client_with_callback(nNum);
}
#if LIBRF_TUTORIAL_STAND_ALONE
int main(int argc, const char* argv[])
{
if (argc > 1)
resumable_main_benchmark_asio_client(atoi(argv[1]));
else
resumable_main_benchmark_asio_server();
return 0;
}
#endif

+ 9
- 0
benchmark/test_async_cinatra_client.cpp View File

@@ -2,6 +2,7 @@
//依赖 https://github.com/tearshark/librf 项目
//依赖 https://github.com/qicosmos/cinatra 项目

#pragma warning(disable : 4996)
#include <iostream>
#include "../../cinatra/include/cinatra.hpp"
#include "librf/librf.h"
@@ -56,3 +57,11 @@ void test_async_cinatra_client()

librf::this_scheduler()->run_until_notask();
}

#if LIBRF_TUTORIAL_STAND_ALONE
int main()
{
test_async_cinatra_client();
return 0;
}
#endif

Loading…
Cancel
Save