Compare commits

...

2 Commits

Author SHA1 Message Date
bmy
8897841258 feat: 设置默认读取二进制文件下目录的配置文件 2024-06-04 12:12:22 +08:00
bmy
69e2d61fae feat: 增加彩色日志输出 2024-06-04 11:29:07 +08:00
2 changed files with 12 additions and 2 deletions

View File

@@ -11,6 +11,8 @@ set(main main.cc
set(LOGC logc/log.c)
set(TOML tomlc99/toml.c)
# 设置彩色日志输出
add_definitions(-DLOG_USE_COLOR)
# 查找并添加 OpenCV 的头文件目录
set(OpenCV_DIR ${CMAKE_SOURCE_DIR}/opencv-mobile-4.9.0-armlinux/lib/cmake/opencv4)
@@ -19,6 +21,9 @@ find_package(OpenCV REQUIRED)
set(ZMQ zmq)
set(PTHREAD pthread)
message("copy config file")
file(COPY config.toml DESTINATION ./)
message(STATUS " version: ${OpenCV_VERSION}")
message(STATUS " include path: ${OpenCV_INCLUDE_DIRS}")
include_directories(${OpenCV_INCLUDE_DIRS})

View File

@@ -8,14 +8,19 @@
#include "tomlc99/toml.h"
#include "capture.h"
#define config_file_path "../config.toml"
#define config_file_path "config.toml"
int main(int argc, char **argv)
{
FILE *fp;
char errbuf[200];
fp = fopen(config_file_path, "r");
char *config_path;
config_path = getcwd(NULL, 0);
sprintf(config_path, "%s/%s", config_path, config_file_path);
log_info("load config from %s", config_path);
fp = fopen(config_path, "r");
if (!fp)
{
log_error("can not open conifg file");