Skip to content

Commit

Permalink
Merge pull request #102 from GengGode/dev-new-api
Browse files Browse the repository at this point in the history
rm old apis
  • Loading branch information
GengGode authored Feb 10, 2024
2 parents 65f184f + 4e2f53d commit 84aed92
Show file tree
Hide file tree
Showing 13 changed files with 241 additions and 606 deletions.
59 changes: 45 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,26 +1,41 @@
cmake_minimum_required(VERSION 3.15)
project(cvAutoTrack)

set(BUILD_CVAUTOTRACK_TESTS OFF CACHE BOOL "build cvAutoTrack tests")
set(BUILD_DOC OFF CACHE BOOL "build cvAutoTrack doc")

include(cmake/parse_version.cmake)
include(cmake/auto_subdirectory.cmake)
include(cmake/add_pch_configure.cmake)

#=======================================================================================================================
# 设置dll输出目录
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
# 设置安装目录
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install)
#=======================================================================================================================
# 设置第三方目录
set(DependentPatryDir ${CMAKE_SOURCE_DIR}/dependent_party)
set(ThridPatryDir ${CMAKE_SOURCE_DIR}/third_party)
set(IncludeDir ${CMAKE_SOURCE_DIR}/include)
set(SourceDir ${CMAKE_SOURCE_DIR}/source)
#=======================================================================================================================
include(cmake/auto_subdirectory.cmake)
include(cmake/add_pch_configure.cmake)
#=======================================================================================================================
include(cmake/parse_version.cmake)
auto_increment_version_file("source/resource/version_hash.hash" "source/resource/version.ver")
parse_version_file("source/resource/version.ver")
get_commit_hash(PROJECT_VERSION_HASH)
get_git_branch(PROJECT_VERSION_BRANCH)
#=======================================================================================================================
set(BUILD_DYANMIC_LINK_DEPS ON CACHE BOOL "动态链接依赖库")
set(BUILD_TESTS OFF CACHE BOOL "编译测试")
set(BUILD_DOC OFF CACHE BOOL "编译文档")



include_directories(${IncludeDir})
include_directories(${ThridPatryDir})
include_directories(${DependentPatryDir})


# 设置输出目录
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
#=======================================================================================================================
# 设置编译选项
set(CMAKE_CXX_STANDARD 17)
if(MSVC)
Expand All @@ -29,12 +44,10 @@ if(MSVC)
add_definitions(-DUNICODE -D_UNICODE)
endif()
add_compile_options(/utf-8)

project(libcvAutoTrack)

#=======================================================================================================================
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
Set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER "cmake_targets")

#=======================================================================================================================
# 包含子项目
add_subdirectory(source)
if(BUILD_CVAUTOTRACK_TESTS)
Expand All @@ -44,3 +57,21 @@ if(BUILD_CVAUTOTRACK_TESTS)
message(STATUS "编译内容:cvAutoTrack | 不编译tests")
message(STATUS " (如果需要编译tests,请设置BUILD_CVAUTOTRACK_TESTS=ON)")
endif()
#=======================================================================================================================
message(STATUS "==============================================================")

message(STATUS "Config : ")
message(STATUS " 当前版本 : ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
message(STATUS " 产物名称 : ${PROJECT_NAME}")
message(STATUS " 动态链接 : ${BUILD_DYANMIC_LINK_DEPS}")
message(STATUS " 编译测试 : ${BUILD_TESTS}")
message(STATUS "Resource : ")
message(STATUS " 地图数量 : ${model_rec_file}")
message(STATUS "Library : ")
message(STATUS " opencv_include_dir : ${opencv_include_dir}")
message(STATUS " opencv_version : ${opencv_version}")
message(STATUS "Include : ")
message(STATUS " include_dir : ${include_dir}")
message(STATUS "Install : ")
message(STATUS " CMAKE_INSTALL_PREFIX : ${CMAKE_INSTALL_PREFIX}")
message(STATUS "==============================================================\n")
6 changes: 3 additions & 3 deletions cmake/parse_version.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ function(parse_version_file version_file)
list(GET version_content_list 0 version_major)
list(GET version_content_list 1 version_minor)
list(GET version_content_list 2 version_patch)
set(VERSION_MAJOR ${version_major} PARENT_SCOPE)
set(VERSION_MINOR ${version_minor} PARENT_SCOPE)
set(VERSION_PATCH ${version_patch} PARENT_SCOPE)
set(PROJECT_VERSION_MAJOR ${version_major} PARENT_SCOPE)
set(PROJECT_VERSION_MINOR ${version_minor} PARENT_SCOPE)
set(PROJECT_VERSION_PATCH ${version_patch} PARENT_SCOPE)
endfunction(parse_version_file)

function(version_file_patch_update version_file)
Expand Down
40 changes: 11 additions & 29 deletions include/cvAutoTrack.h
Original file line number Diff line number Diff line change
Expand Up @@ -268,38 +268,23 @@ extern "C"
/// @param scale 缩放比例
/// @return 设置成功
bool CVAUTOTRACK_API SetWorldScale(double scale);
bool CVAUTOTRACK_API ImportMapBlock(int uuid, const char* image_encode_data, int image_data_size);
bool CVAUTOTRACK_API ImportMapBlockData(int uuid, const char* image_data, int image_width, int image_height, int image_channels);
bool CVAUTOTRACK_API ImportMapBlockCenter(int uuid, int x, int y);
bool CVAUTOTRACK_API ImportMapBlockRelativeCenter(int uuid, int parent_uuid, int x, int y);
bool CVAUTOTRACK_API ImportMapBlockCenterScale(int uuid, int x, int y, double scale);
bool CVAUTOTRACK_API ImportMapBlockRelativeCenterScale(int uuid, int parent_uuid, int x, int y, double scale);
bool CVAUTOTRACK_API GetTransformOfMap(double& x, double& y, double& a, int& mapId);
bool CVAUTOTRACK_API GetPositionOfMap(double& x, double& y, int& mapId);
bool CVAUTOTRACK_API GetDirection(double& a);
bool CVAUTOTRACK_API GetRotation(double& a);
bool CVAUTOTRACK_API GetStar(double& x, double& y, bool& isEnd);
bool CVAUTOTRACK_API GetStarJson(char* json_buff, int buff_size);
bool CVAUTOTRACK_API GetUID(int& uid);
bool CVAUTOTRACK_API GetAllInfo(double& x, double& y, int& mapId, double& a, double& r, int& uid);
bool CVAUTOTRACK_API GetInfoLoadPicture(const char* path, int& uid, double& x, double& y, double& a);
bool CVAUTOTRACK_API GetInfoLoadVideo(const char* path, const char* out_path);

bool CVAUTOTRACK_API GetTransformOfMap(double &x, double &y, double &a, int &mapId);
bool CVAUTOTRACK_API GetPositionOfMap(double &x, double &y, int &mapId);
bool CVAUTOTRACK_API GetDirection(double &a);
bool CVAUTOTRACK_API GetRotation(double &a);
bool CVAUTOTRACK_API GetUID(int &uid);
bool CVAUTOTRACK_API GetAllInfo(double &x, double &y, int &mapId, double &a, double &r, int &uid);
bool CVAUTOTRACK_API DebugCapture();
bool CVAUTOTRACK_API DebugCapturePath(const char* path);
int CVAUTOTRACK_API GetLastErr();
int CVAUTOTRACK_API GetLastErrMsg(char* msg_buff, int buff_size);
int CVAUTOTRACK_API GetLastErrJson(char* json_buff, int buff_size);
bool CVAUTOTRACK_API GetMapIsEmbedded();
bool CVAUTOTRACK_API GetCompileVersion(char* version_buff, int buff_size);
int CVAUTOTRACK_API GetLastErrMsg(char *msg_buff, int buff_size);
int CVAUTOTRACK_API GetLastErrJson(char *json_buff, int buff_size);

bool CVAUTOTRACK_API GetCompileVersion(char *version_buff, int buff_size);
bool CVAUTOTRACK_API GetCompileTime(char* time_buff, int buff_size);
bool CVAUTOTRACK_API GetCoreModulePath(char* path_buff, int buff_size);

/// @brief
/// @param doc_buff
/// @param buff_size
/// @return
bool CVAUTOTRACK_API GetHelpDoc(char* doc_buff, int buff_size);

#ifdef __cplusplus
}
#endif
Expand Down Expand Up @@ -401,11 +386,8 @@ struct cvAutoTrack
bool bind_call(GetPositionOfMap, double_ref x, double_ref y, int_ref mapId);
bool bind_call(GetDirection, double_ref a);
bool bind_call(GetRotation, double_ref a);
bool bind_call(GetStar, double_ref x, double_ref y, bool_ref isEnd);
bool bind_call(GetUID, int_ref uid);
bool bind_call(GetAllInfo, double_ref x, double_ref y, int_ref mapId, double_ref a, double_ref r, int_ref uid);
bool bind_call(GetInfoLoadPicture, char_ptr path, int_ref uid, double_ref x, double_ref y, double_ref a);
bool bind_call(GetInfoLoadVideo, char_ptr path, char_ptr pathOutFile);
bool bind_call(DebugCapture);
int bind_call(GetLastErr);
int bind_call(GetLastErrMsg, char_ptr msg_buff, int buff_size);
Expand Down
Loading

0 comments on commit 84aed92

Please sign in to comment.