Browse Source

去掉 {fmt} 库的依赖

3.0.0
tearshark 2 years ago
parent
commit
06945058fe
4 changed files with 5 additions and 14 deletions
  1. 0
    4
      CMakeLists.txt
  2. 4
    4
      librf/src/def.h
  3. 1
    1
      tutorial/CMakeLists.txt
  4. 0
    5
      tutorial/test_async_resumable.cpp

+ 0
- 4
CMakeLists.txt View File

${PROJECT_SOURCE_DIR}/librf/src/config.h ${PROJECT_SOURCE_DIR}/librf/src/config.h
) )
#{fmt}
add_definitions(-DFMT_HEADER_ONLY=1)
find_package(fmt)
include_directories( include_directories(
${PROJECT_SOURCE_DIR}/librf ${PROJECT_SOURCE_DIR}/librf
) )

+ 4
- 4
librf/src/def.h View File

namespace std namespace std
{ {
using experimental::coroutine_traits; using experimental::coroutine_traits;
using experimental::coroutine_handle;
using experimental::suspend_if;
using experimental::suspend_always;
using experimental::suspend_never;
using experimental::coroutine_handle;
using experimental::suspend_if;
using experimental::suspend_always;
using experimental::suspend_never;
} }
#endif #endif

+ 1
- 1
tutorial/CMakeLists.txt View File

message(STATUS "Generating test target: ${TUTORIAL_FILE_NAME}") message(STATUS "Generating test target: ${TUTORIAL_FILE_NAME}")


add_executable(${TUTORIAL_FILE_NAME} ${TUTORIAL_FILE_PATH}) add_executable(${TUTORIAL_FILE_NAME} ${TUTORIAL_FILE_PATH})
target_link_libraries(${TUTORIAL_FILE_NAME} PRIVATE fmt::fmt-header-only PUBLIC librf ${LIB_MIMALLOC})
target_link_libraries(${TUTORIAL_FILE_NAME} PUBLIC librf ${LIB_MIMALLOC})
endforeach(TUTORIAL_FILE_PATH) endforeach(TUTORIAL_FILE_PATH)

+ 0
- 5
tutorial/test_async_resumable.cpp View File

#include <chrono> #include <chrono>
#include <iostream> #include <iostream>
#include <string> #include <string>
#include <fmt/format.h>
#include "librf.h" #include "librf.h"
auto ns = std::chrono::duration_cast<std::chrono::nanoseconds>(end - start).count(); auto ns = std::chrono::duration_cast<std::chrono::nanoseconds>(end - start).count();
fmt::print("{:>2}:{:<30}{:<10}{:>16} ns{:>8} ns/op{:>10} w/cps\n", idx, name, count, ns, ns / count, count * 100ll * 1000ll / ns);
/*
std::cout << idx << ":" << name << " "; std::cout << idx << ":" << name << " ";
std::cout << count << " " << ns << " ns "; std::cout << count << " " << ns << " ns ";
std::cout << (ns / count) << " ns/op" << " "; std::cout << (ns / count) << " ns/op" << " ";
std::cout << (count * 100ll * 1000ll / ns) << "w/cps" << std::endl; std::cout << (count * 100ll * 1000ll / ns) << "w/cps" << std::endl;
*/
lock_console.unlock(); lock_console.unlock();
} }

Loading…
Cancel
Save