♻️ 使用module重构所有代码
This commit is contained in:
@@ -4,6 +4,7 @@ project(test_scheduler LANGUAGES C CXX)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 23)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP 1)
|
||||
|
||||
find_package(spdlog CONFIG REQUIRED)
|
||||
find_package(fmt CONFIG REQUIRED)
|
||||
@@ -14,11 +15,21 @@ if(UNIX AND NOT APPLE)
|
||||
endif()
|
||||
|
||||
set(SOURCES
|
||||
test_async_executor.cpp
|
||||
../../src/scheduler/async_executor.cpp)
|
||||
test_async_executor.cppm)
|
||||
|
||||
add_executable(${PROJECT_NAME} ${SOURCES})
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../src)
|
||||
target_sources(
|
||||
${PROJECT_NAME}
|
||||
PRIVATE
|
||||
FILE_SET cxx_modules TYPE CXX_MODULES
|
||||
BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../../src/scheduler
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../src/bridge
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
FILES ../../src/scheduler/async_executor.cppm
|
||||
../../src/bridge/spdlog.cppm
|
||||
../../src/bridge/taskflow.cppm
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_async_executor.cppm)
|
||||
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE SPDLOG_HEADER_ONLY FMT_HEADER_ONLY)
|
||||
|
||||
@@ -27,9 +38,8 @@ target_link_libraries(
|
||||
PRIVATE Taskflow::Taskflow spdlog::spdlog_header_only fmt::fmt-header-only
|
||||
$<$<PLATFORM_ID:Linux>:Threads::Threads>)
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
|
||||
target_compile_options(
|
||||
${PROJECT_NAME}
|
||||
PRIVATE -Wall -Wextra -Wpedantic $<$<CONFIG:Debug>:-g -O0>
|
||||
$<$<CONFIG:Release>:-O3>)
|
||||
endif()
|
||||
target_compile_options(
|
||||
${PROJECT_NAME}
|
||||
PRIVATE -Wall -Wextra -Wpedantic $<$<CONFIG:Debug>:-g -O0>
|
||||
-Wno-import-implementation-partition-unit-in-interface-unit
|
||||
$<$<CONFIG:Release>:-O3>)
|
||||
|
||||
+6
-11
@@ -1,15 +1,10 @@
|
||||
#include <atomic>
|
||||
#include <chrono>
|
||||
#include <functional>
|
||||
#include <iostream>
|
||||
#include <optional>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
#include <vector>
|
||||
#include <mutex>
|
||||
module;
|
||||
|
||||
#include "../../src/scheduler/async_executor.hpp"
|
||||
export module lsp.test.scheduler.async_executor;
|
||||
|
||||
import std;
|
||||
|
||||
import lsp.scheduler.async_executor;
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
Reference in New Issue
Block a user