Skip to content

Commit

Permalink
fix: header error (#180)
Browse files Browse the repository at this point in the history
  • Loading branch information
MistEO authored Mar 27, 2024
1 parent 8564afe commit cbfd75c
Show file tree
Hide file tree
Showing 27 changed files with 135 additions and 298 deletions.
2 changes: 1 addition & 1 deletion source/LibraryHolder/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ set_target_properties(LibraryHolder PROPERTIES POSITION_INDEPENDENT_CODE ON)
target_include_directories(LibraryHolder
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${MAA_PRIVATE_INC} ${MAA_PUBLIC_INC})

target_link_libraries(LibraryHolder MaaUtils HeaderOnlyLibraries Boost::system)
target_link_libraries(LibraryHolder MaaUtils HeaderOnlyLibraries Boost::system ${OpenCV_LIBS})

add_dependencies(LibraryHolder MaaUtils)

Expand Down
6 changes: 3 additions & 3 deletions source/LibraryHolder/ControlUnit/ControlUnit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ bool check_version(const std::string& func_name)
LogInfo << typeid(ControlUnitT).name() << "Library version:" << version;

if (std::strcmp(version, MAA_VERSION) != 0) {
LogWarn << "ControlUnit and MaaFramework are not same version,"
<< "ControlUnit:" << version << "MaaFramework:" << MAA_VERSION;
LogWarn << "ControlUnit and MaaFramework are not same version," << "ControlUnit:" << version
<< "MaaFramework:" << MAA_VERSION;
}
return true;
}
Expand Down Expand Up @@ -219,4 +219,4 @@ std::shared_ptr<MAA_CTRL_UNIT_NS::ControlUnitAPI>
destroy_control_unit);
}

MAA_NS_END
MAA_NS_END
1 change: 1 addition & 0 deletions source/MaaAdbControlUnit/API/AdbControlUnitAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "Screencap/RawByNetcat.h"
#include "Screencap/RawWithGzip.h"
#include "Utils/Logger.h"
#include "Utils/Platform.h"

using MAA_NS::path;

Expand Down
2 changes: 1 addition & 1 deletion source/MaaAdbControlUnit/Input/MaatouchInput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
#include <format>
#include <ranges>

#include "Utils/Codec.h"
#include "Utils/Logger.h"
#include "Utils/Platform.h"

MAA_CTRL_UNIT_NS_BEGIN

Expand Down
1 change: 1 addition & 0 deletions source/MaaAdbControlUnit/Input/MinitouchInput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <ranges>

#include "Utils/Logger.h"
#include "Utils/Platform.h"

MAA_CTRL_UNIT_NS_BEGIN

Expand Down
1 change: 1 addition & 0 deletions source/MaaAdbControlUnit/Manager/ControlUnitMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include "MaaFramework/MaaMsg.h"
#include "Utils/Logger.h"
#include "Utils/Platform.h"

MAA_CTRL_UNIT_NS_BEGIN

Expand Down
4 changes: 2 additions & 2 deletions source/MaaAdbControlUnit/Screencap/Minicap/MinicapBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <ranges>

#include "Utils/Logger.h"
#include "Utils/NoWarningCV.hpp"
#include "Utils/Platform.h"

MAA_CTRL_UNIT_NS_BEGIN

Expand Down Expand Up @@ -77,4 +77,4 @@ bool MinicapBase::init(int swidth, int sheight)
return set_wh(swidth, sheight);
}

MAA_CTRL_UNIT_NS_END
MAA_CTRL_UNIT_NS_END
3 changes: 2 additions & 1 deletion source/MaaDbgControlUnit/API/DbgControlUnitAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "CarouselImage/CarouselImage.h"
#include "ReplayRecording/ReplayRecordingMgr.h"
#include "Utils/Logger.h"
#include "Utils/Platform.h"

MaaStringView MaaDbgControlUnitGetVersion()
{
Expand Down Expand Up @@ -43,4 +44,4 @@ void MaaDbgControlUnitDestroy(MaaControlUnitHandle handle)
if (handle) {
delete handle;
}
}
}
3 changes: 2 additions & 1 deletion source/MaaFramework/Instance/InstanceStatus.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "InstanceStatus.h"

#include "Utils/Logger.h"
#include "Utils/NoWarningCV.hpp"

MAA_NS_BEGIN

Expand Down Expand Up @@ -128,4 +129,4 @@ bool InstanceStatus::cv_mat_equal(const cv::Mat& lhs, const cv::Mat& rhs)
return eq2;
}

MAA_NS_END
MAA_NS_END
3 changes: 2 additions & 1 deletion source/MaaFramework/Resource/PipelineResMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include "Utils/Codec.h"
#include "Utils/Logger.h"
#include "Utils/Platform.h"
#include "Utils/StringMisc.hpp"
#include "Vision/VisionTypes.h"

Expand Down Expand Up @@ -1417,4 +1418,4 @@ bool PipelineResMgr::parse_action_target(
return true;
}

MAA_RES_NS_END
MAA_RES_NS_END
3 changes: 2 additions & 1 deletion source/MaaFramework/Task/PipelineTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "Task/CustomAction.h"
#include "Utils/ImageIo.h"
#include "Utils/Logger.h"
#include "Utils/Uuid.h"

MAA_TASK_NS_BEGIN

Expand Down Expand Up @@ -292,4 +293,4 @@ std::filesystem::path PipelineTask::dump_image(const cv::Mat& image) const
return filepath;
}

MAA_TASK_NS_END
MAA_TASK_NS_END
36 changes: 20 additions & 16 deletions source/MaaProjectInterface/CLI/interactor.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#include "interactor.h"

#include <algorithm>
#include <format>
#include <ranges>
#include <unordered_set>

#include "MaaToolkit/Device/MaaToolkitDevice.h"
Expand Down Expand Up @@ -162,15 +164,15 @@ void Interactor::print_config() const

std::cout << "Controller:\n\n";
std::cout << "\t"
<< MaaNS::utf8_to_crt(std::format(
<< MAA_LOG_NS::utf8_to_crt(std::format(
"{}\n\t\t{}\n\t\t{}",
config_.configuration().controller.name,
MaaNS::path_to_utf8_string(config_.configuration().controller.adb_path),
config_.configuration().controller.address))
<< "\n\n";

std::cout << "Resource:\n\n";
std::cout << "\t" << MaaNS::utf8_to_crt(config_.configuration().resource) << "\n\n";
std::cout << "\t" << MAA_LOG_NS::utf8_to_crt(config_.configuration().resource) << "\n\n";

std::cout << "Tasks:\n\n";
print_config_tasks(false);
Expand All @@ -182,11 +184,11 @@ void Interactor::welcome() const
std::cout << "Welcome to use Maa Project Interface CLI!\n";
}
else {
std::cout << MaaNS::utf8_to_crt(config_.interface_data().message) << "\n";
std::cout << MAA_LOG_NS::utf8_to_crt(config_.interface_data().message) << "\n";
}
std::cout << "MaaFramework: " << MAA_VERSION << "\n\n";

std::cout << "Version: " << MaaNS::utf8_to_crt(config_.interface_data().version) << "\n\n";
std::cout << "Version: " << MAA_LOG_NS::utf8_to_crt(config_.interface_data().version) << "\n\n";
}

bool Interactor::interact_once()
Expand Down Expand Up @@ -244,7 +246,7 @@ void Interactor::select_controller()
if (all_controllers.size() != 1) {
std::cout << "### Select controller ###\n\n";
for (size_t i = 0; i < all_controllers.size(); ++i) {
std::cout << MaaNS::utf8_to_crt(
std::cout << MAA_LOG_NS::utf8_to_crt(
std::format("\t{}. {}\n", i + 1, all_controllers[i].name));
}
std::cout << "\n";
Expand Down Expand Up @@ -307,7 +309,7 @@ void Interactor::select_adb_auto_detect()
std::string path = MaaToolkitGetDeviceAdbPath(i);
std::string address = MaaToolkitGetDeviceAdbSerial(i);

std::cout << MaaNS::utf8_to_crt(
std::cout << MAA_LOG_NS::utf8_to_crt(
std::format("\t{}. {}\n\t\t{}\n\t\t{}\n", i + 1, name, path, address));
}
std::cout << "\n";
Expand Down Expand Up @@ -350,7 +352,7 @@ void Interactor::select_resource()
if (all_resources.size() != 1) {
std::cout << "### Select resource ###\n\n";
for (size_t i = 0; i < all_resources.size(); ++i) {
std::cout << MaaNS::utf8_to_crt(
std::cout << MAA_LOG_NS::utf8_to_crt(
std::format("\t{}. {}\n", i + 1, all_resources[i].name));
}
std::cout << "\n";
Expand All @@ -376,7 +378,8 @@ void Interactor::add_task()

std::cout << "### Add task ###\n\n";
for (size_t i = 0; i < all_data_tasks.size(); ++i) {
std::cout << MaaNS::utf8_to_crt(std::format("\t{}. {}\n", i + 1, all_data_tasks[i].name));
std::cout << MAA_LOG_NS::utf8_to_crt(
std::format("\t{}. {}\n", i + 1, all_data_tasks[i].name));
}
std::cout << "\n";
auto input_indexes = input_multi(all_data_tasks.size());
Expand All @@ -398,12 +401,12 @@ void Interactor::add_task()
Configuration::Option { option_name, opt.default_case });
continue;
}
std::cout << MaaNS::utf8_to_crt(std::format(
std::cout << MAA_LOG_NS::utf8_to_crt(std::format(
"\n\n## Input option of \"{}\" for \"{}\" ##\n\n",
option_name,
data_task.name));
for (size_t i = 0; i < opt.cases.size(); ++i) {
std::cout << MaaNS::utf8_to_crt(
std::cout << MAA_LOG_NS::utf8_to_crt(
std::format("\t{}. {}\n", i + 1, opt.cases[i].name));
}
std::cout << "\n";
Expand Down Expand Up @@ -477,15 +480,15 @@ void Interactor::print_config_tasks(bool with_index) const
for (size_t i = 0; i < all_config_tasks.size(); ++i) {
const auto& task = all_config_tasks[i];
if (with_index) {
std::cout << MaaNS::utf8_to_crt(std::format("\t{}. {}\n", i + 1, task.name));
std::cout << MAA_LOG_NS::utf8_to_crt(std::format("\t{}. {}\n", i + 1, task.name));
}
else {
std::cout << MaaNS::utf8_to_crt(std::format("\t- {}\n", task.name));
std::cout << MAA_LOG_NS::utf8_to_crt(std::format("\t- {}\n", task.name));
}

for (const auto& [key, value] : task.option) {
std::cout << "\t\t- " << MaaNS::utf8_to_crt(key) << ": " << MaaNS::utf8_to_crt(value)
<< "\n";
std::cout << "\t\t- " << MAA_LOG_NS::utf8_to_crt(key) << ": "
<< MAA_LOG_NS::utf8_to_crt(value) << "\n";
}
}
std::cout << "\n";
Expand All @@ -507,5 +510,6 @@ void Interactor::on_maafw_notify(
std::ignore = pthis;

std::string entry = json::parse(details_json).value_or(json::value())["entry"].as_string();
std::cout << MaaNS::utf8_to_crt(std::format("on_maafw_notify: {} {}", msg, entry)) << std::endl;
}
std::cout << MAA_LOG_NS::utf8_to_crt(std::format("on_maafw_notify: {} {}", msg, entry))
<< std::endl;
}
1 change: 1 addition & 0 deletions source/MaaProjectInterface/CLI/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include "MaaToolkit/MaaToolkitAPI.h"
#include "Utils/Runtime.h"
#include "Utils/Platform.h"

#include "interactor.h"

Expand Down
3 changes: 3 additions & 0 deletions source/MaaProjectInterface/Impl/Parser.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#include "ProjectInterface/Parser.h"

#include <ranges>
#include <functional>

#include "Utils/Logger.h"

MAA_PROJECT_INTERFACE_NS_BEGIN
Expand Down
1 change: 1 addition & 0 deletions source/MaaToolkit/API/MaaToolkitConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "Config/GlobalOptionConfig.h"
#include "Utils/Logger.h"
#include "Utils/Runtime.h"
#include "Utils/Platform.h"

MaaBool MaaToolkitInitOptionConfig(MaaStringView user_path, MaaStringView default_json)
{
Expand Down
3 changes: 2 additions & 1 deletion source/MaaToolkit/API/MaaToolkitExecAgent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "ExecAgent/ActionExecAgent.h"
#include "ExecAgent/RecognizerExecAgent.h"
#include "Utils/Logger.h"
#include "Utils/Platform.h"

using namespace MAA_TOOLKIT_NS;

Expand Down Expand Up @@ -136,4 +137,4 @@ MaaBool
MaaToolkitUnregisterCustomActionExecutor(MaaInstanceHandle handle, MaaStringView action_name)
{
return UnregisterExecutor(ExecutorType::Action, handle, action_name);
}
}
3 changes: 2 additions & 1 deletion source/MaaToolkit/AdbDevice/DeviceMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include <future>

#include "ControlUnit/ControlUnitAPI.h"
#include "LibraryHolder/ControlUnit.h"
#include "Utils/Logger.h"

Expand Down Expand Up @@ -168,4 +169,4 @@ MaaAdbControllerType DeviceMgr::check_adb_controller_type(
return kInputType | kScreencapType;
}

MAA_TOOLKIT_NS_END
MAA_TOOLKIT_NS_END
1 change: 1 addition & 0 deletions source/MaaToolkit/ExecAgent/ExecAgentBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <mutex>
#include <string_view>
#include <thread>
#include <filesystem>

#include <meojson/json.hpp>

Expand Down
2 changes: 1 addition & 1 deletion source/MaaUtils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ file(GLOB_RECURSE maa_utils_header ${MAA_PRIVATE_INC}/Utils/*)
add_library(MaaUtils SHARED ${maa_utils_src} ${maa_utils_header})
target_include_directories(MaaUtils
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${MAA_PRIVATE_INC} ${MAA_PUBLIC_INC})
target_link_libraries(MaaUtils PRIVATE HeaderOnlyLibraries Boost::system)
target_link_libraries(MaaUtils PRIVATE HeaderOnlyLibraries Boost::system ${OpenCV_LIBS})
target_compile_definitions(MaaUtils PRIVATE MAA_UTILS_EXPORTS)

install(
Expand Down
Loading

0 comments on commit cbfd75c

Please sign in to comment.