Skip to content

Commit

Permalink
update:修改目录结构
Browse files Browse the repository at this point in the history
  • Loading branch information
GengGode committed Dec 3, 2023
1 parent 69cf4d5 commit e87a741
Show file tree
Hide file tree
Showing 104 changed files with 58 additions and 63 deletions.
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ include(cmake/add_pch_configure.cmake)

# 设置第三方目录
set(ThridPatryDir ${CMAKE_SOURCE_DIR}/third_party)
set(SourceDir ${CMAKE_SOURCE_DIR}/source/src)
set(IncludeDir ${CMAKE_SOURCE_DIR}/include)
set(SourceDir ${CMAKE_SOURCE_DIR}/source)

# 设置输出目录
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
Expand Down
File renamed without changes.
5 changes: 4 additions & 1 deletion source/src/AutoTrack.cpp → source/AutoTrack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@
#include "version/Version.h"
#include "utils/convect.string.h"

AutoTrack::AutoTrack() : res(Resources::getInstance()), err(ErrorCode::getInstance())
ErrorCode &err = ErrorCode::getInstance();
Resources &res = Resources::getInstance();

AutoTrack::AutoTrack()
{
err.enableWirteFile();

Expand Down
12 changes: 1 addition & 11 deletions source/src/AutoTrack.h → source/AutoTrack.h
Original file line number Diff line number Diff line change
@@ -1,20 +1,10 @@
#pragma once
#include "match/type/MatchType.h"

class Resources;
class ErrorCode;
class AutoTrack
{
Resources& res;
ErrorCode& err;

private:
AutoTrack();
public:
static AutoTrack& Instance() {
static AutoTrack _instance;
return _instance;
}
AutoTrack();

#pragma region 外部接口
bool init();
Expand Down
23 changes: 10 additions & 13 deletions source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,13 @@ endif()
find_package(OpenCV REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})

include_directories(include)
include_directories(src)


file(GLOB_RECURSE CppFiles "src/*.cpp")
file(GLOB_RECURSE HppFiles "src/*.h")
file(GLOB_RECURSE CppFiles "*.cpp")
file(GLOB_RECURSE HppFiles "*.h")
set(VerRcFile "${CMAKE_CURRENT_SOURCE_DIR}/resource/version.rc")
set(VerHppFile "${CMAKE_CURRENT_SOURCE_DIR}/resource/version.h")
set(InfaceHppFile "${IncludeDir}/cvAutoTrack.h")

auto_increment_version_file("resource/version_hash.hash" "resource/version.ver")
parse_version_file("resource/version.ver")
Expand All @@ -42,26 +41,24 @@ if(BUILD_CAPTURE_DXGI)
add_definitions(-DBUILD_CAPTURE_DXGI)
endif()

source_group("include" FILES include/cvAutoTrack.h)
source_group("include" FILES ${InfaceHppFile})
source_group(TREE ${CMAKE_SOURCE_DIR} FILES ${CppFiles} ${HppFiles} ${RcFiles} ${RcFile} ${VerRcFile})
source_group("version" FILES ${VerRcFile})

add_library(cvAutoTrack SHARED
include/cvAutoTrack.h
src/cvAutoTrack.cpp
${CppFiles}
include_directories(${IncludeDir})
include_directories(${SourceDir})
add_library(cvAutoTrack SHARED ${InfaceHppFile}
${HppFiles}
#${RcFiles}
${CppFiles}
cvAutoTrack.cpp
${RcFile}
${VerRcFile}
)



set_target_properties(cvAutoTrack PROPERTIES VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH})
set_target_properties(cvAutoTrack PROPERTIES FOLDER "cvAutoTrack")

add_pch_define(cvAutoTrack ${CMAKE_CURRENT_SOURCE_DIR}/src/pch.h ${CMAKE_CURRENT_SOURCE_DIR}/src/pch.cpp)
add_pch_define(cvAutoTrack ${SourceDir}/pch.h ${SourceDir}/pch.cpp)

add_compile_options(/MP)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
66 changes: 34 additions & 32 deletions source/src/cvAutoTrack.cpp → source/cvAutoTrack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//

#include "pch.h"
#include "cvAutoTrack.h"
#include <cvAutoTrack.h>
#include "ErrorCode.h"
#include "AutoTrack.h"
#include <atomic>
Expand All @@ -12,119 +12,121 @@
return at_func
#define UNINIT_RETURN()\
if(_inited.load()==false) return false;

static AutoTrack _at;
static std::atomic<bool> _inited = true;

bool __stdcall InitResource()
{
INSTALL_DUMP(AutoTrack::Instance().init());
INSTALL_DUMP(_at.init());
_inited = true;
}
bool __stdcall UnInitResource()
{
INSTALL_DUMP(AutoTrack::Instance().uninit());
INSTALL_DUMP(_at.uninit());
}
bool __stdcall SetUseBitbltCaptureMode()
{
INSTALL_DUMP(AutoTrack::Instance().SetUseBitbltCaptureMode());
INSTALL_DUMP(_at.SetUseBitbltCaptureMode());
}
bool __stdcall SetUseGraphicsCaptureMode()
{
INSTALL_DUMP(AutoTrack::Instance().SetUseDx11CaptureMode());
INSTALL_DUMP(_at.SetUseDx11CaptureMode());
}
bool __stdcall SetHandle(long long int handle = 0)
{
INSTALL_DUMP(AutoTrack::Instance().SetHandle(handle));
INSTALL_DUMP(_at.SetHandle(handle));
}
bool __stdcall SetWorldCenter(double x, double y)
{
INSTALL_DUMP(AutoTrack::Instance().SetWorldCenter(x, y));
INSTALL_DUMP(_at.SetWorldCenter(x, y));
}
bool __stdcall SetWorldScale(double scale)
{
INSTALL_DUMP(AutoTrack::Instance().SetWorldScale(scale));
INSTALL_DUMP(_at.SetWorldScale(scale));
}
bool __stdcall ImportMapBlock(int id_x, int id_y, const char* image_data, int image_data_size, int image_width, int image_height)
{
INSTALL_DUMP(AutoTrack::Instance().ImportMapBlock(id_x, id_y, image_data, image_data_size, image_width, image_height));
INSTALL_DUMP(_at.ImportMapBlock(id_x, id_y, image_data, image_data_size, image_width, image_height));
}
bool __stdcall ImportMapBlockCenter(int x, int y)
{
INSTALL_DUMP(AutoTrack::Instance().ImportMapBlockCenter(x, y));
INSTALL_DUMP(_at.ImportMapBlockCenter(x, y));
}
bool __stdcall ImportMapBlockCenterScale(int x, int y, double scale)
{
INSTALL_DUMP(AutoTrack::Instance().ImportMapBlockCenterScale(x, y, scale));
INSTALL_DUMP(_at.ImportMapBlockCenterScale(x, y, scale));
}
bool __stdcall GetTransformOfMap(double& x, double& y, double& a, int& mapId)
{
UNINIT_RETURN();
INSTALL_DUMP(AutoTrack::Instance().GetTransformOfMap(x, y, a, mapId));
INSTALL_DUMP(_at.GetTransformOfMap(x, y, a, mapId));
}
bool __stdcall GetPositionOfMap(double& x, double& y, int& mapId)
{
UNINIT_RETURN();
INSTALL_DUMP(AutoTrack::Instance().GetPositionOfMap(x, y, mapId));
INSTALL_DUMP(_at.GetPositionOfMap(x, y, mapId));
}
bool __stdcall GetDirection(double& a)
{
UNINIT_RETURN();
INSTALL_DUMP(AutoTrack::Instance().GetDirection(a));
INSTALL_DUMP(_at.GetDirection(a));
}
bool __stdcall GetRotation(double& a)
{
UNINIT_RETURN();
INSTALL_DUMP(AutoTrack::Instance().GetRotation(a));
INSTALL_DUMP(_at.GetRotation(a));
}
bool __stdcall GetStar(double& x, double& y, bool& isEnd)
{
UNINIT_RETURN();
INSTALL_DUMP(AutoTrack::Instance().GetStar(x, y, isEnd));
INSTALL_DUMP(_at.GetStar(x, y, isEnd));
}
bool __stdcall GetStarJson(char* json_buff, int buff_size)
{
UNINIT_RETURN();
INSTALL_DUMP(AutoTrack::Instance().GetStarJson(json_buff));
INSTALL_DUMP(_at.GetStarJson(json_buff));
}
bool __stdcall GetUID(int& uid)
{
UNINIT_RETURN();
INSTALL_DUMP(AutoTrack::Instance().GetUID(uid));
INSTALL_DUMP(_at.GetUID(uid));
}
bool __stdcall GetAllInfo(double& x, double& y, int& mapId, double& a, double& r, int& uid)
{
UNINIT_RETURN();
INSTALL_DUMP(AutoTrack::Instance().GetAllInfo(x, y, mapId, a, r, uid));
return AutoTrack::Instance().GetAllInfo(x, y, mapId, a, r, uid);
INSTALL_DUMP(_at.GetAllInfo(x, y, mapId, a, r, uid));
return _at.GetAllInfo(x, y, mapId, a, r, uid);
}
bool __stdcall GetInfoLoadPicture(const char* path, int& uid, double& x, double& y, double& a)
{
UNINIT_RETURN();
INSTALL_DUMP(AutoTrack::Instance().GetInfoLoadPicture(path, uid, x, y, a));
INSTALL_DUMP(_at.GetInfoLoadPicture(path, uid, x, y, a));
}
bool __stdcall GetInfoLoadVideo(const char* path, const char* out_path)
{
UNINIT_RETURN();
INSTALL_DUMP(AutoTrack::Instance().GetInfoLoadVideo(path, out_path));
INSTALL_DUMP(_at.GetInfoLoadVideo(path, out_path));
}
int __stdcall GetLastErr()
{
INSTALL_DUMP(AutoTrack::Instance().GetLastError());
INSTALL_DUMP(_at.GetLastError());
}
int __stdcall GetLastErrMsg(char* msg_buff, int buff_size)
{
INSTALL_DUMP(AutoTrack::Instance().GetLastErrMsg(msg_buff, buff_size));
INSTALL_DUMP(_at.GetLastErrMsg(msg_buff, buff_size));
}
int __stdcall GetLastErrJson(char* json_buff, int buff_size)
{
INSTALL_DUMP(AutoTrack::Instance().GetLastErrJson(json_buff, buff_size));
INSTALL_DUMP(_at.GetLastErrJson(json_buff, buff_size));
}
bool __stdcall SetDisableFileLog()
{
INSTALL_DUMP(AutoTrack::Instance().SetDisableFileLog());
INSTALL_DUMP(_at.SetDisableFileLog());
}
bool __stdcall SetEnableFileLog()
{
INSTALL_DUMP(AutoTrack::Instance().SetEnableFileLog());
INSTALL_DUMP(_at.SetEnableFileLog());
}

#include "Ver.h"
Expand All @@ -138,21 +140,21 @@ bool __stdcall GetCompileTime(char* time_buff, int buff_size)
}
bool __stdcall GetMapIsEmbedded()
{
INSTALL_DUMP(AutoTrack::Instance().GetMapIsEmbedded());
INSTALL_DUMP(_at.GetMapIsEmbedded());
}
bool __stdcall DebugCapture()
{
INSTALL_DUMP(AutoTrack::Instance().DebugCapture());
INSTALL_DUMP(_at.DebugCapture());
}
bool __stdcall DebugCapturePath(const char* path_buff, int buff_size)
{
INSTALL_DUMP(AutoTrack::Instance().DebugCapturePath(path_buff, buff_size));
INSTALL_DUMP(_at.DebugCapturePath(path_buff, buff_size));
}
bool __stdcall startServe()
{
INSTALL_DUMP(AutoTrack::Instance().startServe());
INSTALL_DUMP(_at.startServe());
}
bool __stdcall stopServe()
{
INSTALL_DUMP(AutoTrack::Instance().stopServe());
INSTALL_DUMP(_at.stopServe());
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion source/resource/version.ver
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8.0.45
8.1.0
2 changes: 1 addition & 1 deletion source/resource/version_hash.hash
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4b629b2
69cf4d5
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions tests/api_GetCompileVersion/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
get_filename_component(dir_name ${CMAKE_CURRENT_SOURCE_DIR} NAME)
set(test_name test_${dir_name})
add_executable(${test_name} main.cpp)
include_directories(${IncludeDir})
set_property(TARGET ${test_name} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
set_target_properties(${test_name} PROPERTIES FOLDER "tests")
target_link_libraries(${test_name} cvAutoTrack)
Expand Down
2 changes: 1 addition & 1 deletion tests/api_GetCompileVersion/main.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <iostream>
//#include <gtest/gtest.h>
#include <opencv2/opencv.hpp>
#include "../../../source/include/cvAutoTrack.h"
#include <cvAutoTrack.h>


int main()
Expand Down
1 change: 1 addition & 0 deletions tests/impl_cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
get_filename_component(dir_name ${CMAKE_CURRENT_SOURCE_DIR} NAME)
set(test_name test_${dir_name})
add_executable(${test_name} main.cpp)
include_directories(${IncludeDir})
set_property(TARGET ${test_name} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
set_target_properties(${test_name} PROPERTIES FOLDER "tests")
target_link_libraries(${test_name} ${OpenCV_LIBS} cvAutoTrack fmt::fmt-header-only)
Expand Down
3 changes: 1 addition & 2 deletions tests/impl_cpp/main.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include <iostream>
// #include <cvAutoTrack.h>
#include "../../../source/include/cvAutoTrack.h"
#include <cvAutoTrack.h>
#include <fmt/format.h>
#include <Windows.h>
#include <vector>
Expand Down

0 comments on commit e87a741

Please sign in to comment.