mirror of
https://github.com/sipeed/MaixCDK.git
synced 2026-09-15 06:03:02 -05:00
fix linux compile error
This commit is contained in:
@@ -10,6 +10,8 @@
|
||||
# "nn",
|
||||
# "json"
|
||||
# ]
|
||||
# elif platform == "linux":
|
||||
# return []
|
||||
# else:
|
||||
# raise Exception("maixcam_lib component.py not add this platform support yet")
|
||||
# raise Exception("ahrs component.py not add this platform support yet")
|
||||
|
||||
|
||||
@@ -3,12 +3,14 @@ config OMP_ENABLE
|
||||
bool "Enable omp"
|
||||
default n if PLATFORM = "maixcam"
|
||||
default y if PLATFORM = "maixcam2"
|
||||
default y if PLATFORM = "linux"
|
||||
help
|
||||
Enable OMP to accelerate performance on multi-core platforms.
|
||||
config OMP_ENABLE_DYNAMIC
|
||||
bool "Enable omp dynamic"
|
||||
default n if PLATFORM = "maixcam"
|
||||
default n if PLATFORM = "maixcam2"
|
||||
default y if PLATFORM = "linux"
|
||||
depends on OMP_ENABLE
|
||||
help
|
||||
Enable or disable dynamic adjustment of the number of threads in a parallel region
|
||||
|
||||
@@ -50,16 +50,9 @@ namespace maix::sys
|
||||
return "Unkonwn";
|
||||
}
|
||||
|
||||
std::string maixpy_version()
|
||||
std::string _get_maixpy_version_from_file(const std::string &version_path)
|
||||
{
|
||||
#if PLATFORM_MAIXCAM
|
||||
std::ifstream version_file("/usr/lib/python3.11/site-packages/maix/version.py");
|
||||
#elif PLATFORM_MAIXCAM2
|
||||
std::ifstream version_file("/usr/local/lib/python3.13/site-packages/maix/version.py");
|
||||
#else
|
||||
log::warn("maixpy_version() not implemented for this platform");
|
||||
return "";
|
||||
#endif
|
||||
std::ifstream version_file(version_path);
|
||||
// fast way, read /usr/lib/python3.11/site-packages/maix/version.py
|
||||
// find key value:
|
||||
// version_major = 4
|
||||
@@ -109,6 +102,19 @@ namespace maix::sys
|
||||
return version_stream.str();
|
||||
}
|
||||
|
||||
std::string maixpy_version()
|
||||
{
|
||||
#if PLATFORM_MAIXCAM
|
||||
return _get_maixpy_version_from_file("/usr/lib/python3.11/site-packages/maix/version.py");
|
||||
#elif PLATFORM_MAIXCAM2
|
||||
return _get_maixpy_version_from_file("/usr/local/lib/python3.13/site-packages/maix/version.pyy");
|
||||
#else
|
||||
log::warn("maixpy_version() not implemented for this platform");
|
||||
return "";
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
std::string runtime_version()
|
||||
{
|
||||
fs::File *file = fs::open(LIB_VERSION_FILE_PATH, "r");
|
||||
|
||||
@@ -87,6 +87,8 @@ namespace maix::comm
|
||||
}},
|
||||
};
|
||||
#else
|
||||
std::map<std::string, std::map<std::string, std::string>> pins_map = {
|
||||
};
|
||||
log::warn("not set pinmap for this platform");
|
||||
#endif
|
||||
auto it = pins_map.find(port_name);
|
||||
@@ -113,6 +115,7 @@ namespace maix::comm
|
||||
{"uart2", "/dev/ttyS2"},
|
||||
// {"uart3", "/dev/ttyS3"},// default used by WiFi, to avoid error, we not use it.
|
||||
};
|
||||
return ports;
|
||||
#elif PLATFORM_MAIXCAM2
|
||||
std::vector<std::vector<std::string>> ports = {
|
||||
// {"uart0", "/dev/ttyS0"}, // debug serial, not used by default.
|
||||
@@ -121,11 +124,11 @@ namespace maix::comm
|
||||
{"uart3", "/dev/ttyS3"},
|
||||
{"uart4", "/dev/ttyS4"}, // 6pin 1.25mm, default use this one.
|
||||
};
|
||||
return ports;
|
||||
#else
|
||||
log::warn("this platform no valid uart yet");
|
||||
return {};
|
||||
#endif
|
||||
return ports;
|
||||
}
|
||||
|
||||
|
||||
@@ -260,14 +263,14 @@ namespace maix::comm
|
||||
auto ports = get_uart_ports();
|
||||
#if PLATFORM_MAIXCAM
|
||||
std::string default_port = "uart0";
|
||||
auto default_device = _get_uart_device_by_name(default_port, ports);
|
||||
std::string default_device = _get_uart_device_by_name(default_port, ports);
|
||||
#elif PLATFORM_MAIXCAM2
|
||||
std::string default_port = "uart4";
|
||||
auto default_device = _get_uart_device_by_name(default_port, ports);
|
||||
std::string default_device = _get_uart_device_by_name(default_port, ports);
|
||||
#else
|
||||
log::warn("this platform no default uart yet");
|
||||
std::string default_port = "";
|
||||
auto default_device = "";
|
||||
std::string default_device = "";
|
||||
#endif
|
||||
|
||||
auto name = app::get_sys_config_kv("comm", "uart_port", "default");
|
||||
|
||||
@@ -10,6 +10,8 @@ def add_requirements(platform : str, find_dirs : list):
|
||||
"nn",
|
||||
"json"
|
||||
]
|
||||
elif platform == "linux":
|
||||
return []
|
||||
else:
|
||||
raise Exception("maixcam_lib component.py not add this platform support yet")
|
||||
raise Exception("llm component.py not add this platform support yet")
|
||||
|
||||
|
||||
Binary file not shown.
@@ -13,6 +13,7 @@ elseif(PLATFORM_MAIXCAM2)
|
||||
append_srcs_dir(ADD_SRCS "port/maixcam2")
|
||||
list(APPEND ADD_REQUIREMENTS eigen librosa_simple OpenCC onnxruntime)
|
||||
else()
|
||||
list(APPEND ADD_PRIVATE_INCLUDE "port/linux")
|
||||
append_srcs_dir(ADD_SRCS "port/linux")
|
||||
endif()
|
||||
|
||||
|
||||
@@ -21,8 +21,10 @@ def add_requirements(platform : str, find_dirs : list):
|
||||
"OpenCC",
|
||||
"onnxruntime"
|
||||
])
|
||||
elif platform == "linux":
|
||||
pass
|
||||
else:
|
||||
raise Exception("maixcam_lib component.py not add this platform support yet")
|
||||
raise Exception("nn component.py not add this platform support yet")
|
||||
return reqs
|
||||
|
||||
|
||||
|
||||
13
components/nn/port/linux/maix_nn_linux.cpp
Normal file
13
components/nn/port/linux/maix_nn_linux.cpp
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
#include "maix_nn.hpp"
|
||||
|
||||
namespace maix::nn
|
||||
{
|
||||
err::Err mud_load_raw_model(const std::string &model_path, MUD *mud_obj)
|
||||
{
|
||||
log::error("mud_load_raw_model not impl yet");
|
||||
return err::ERR_NOT_IMPL;
|
||||
}
|
||||
|
||||
} // namespace maix::nn
|
||||
|
||||
9
components/nn/port/linux/maix_nn_linux.hpp
Normal file
9
components/nn/port/linux/maix_nn_linux.hpp
Normal file
@@ -0,0 +1,9 @@
|
||||
#include "global_config.h"
|
||||
#include "maix_nn.hpp"
|
||||
#include "maix_image.hpp"
|
||||
|
||||
namespace maix::nn
|
||||
{
|
||||
err::Err mud_load_raw_model(const std::string &model_path, MUD *mud_obj);
|
||||
|
||||
} // namespace maix::nn
|
||||
@@ -13,6 +13,8 @@
|
||||
|
||||
#if PLATFORM_MAIXCAM || PLATFORM_MAIXCAM2
|
||||
#include "maix_nn_maixcam.hpp"
|
||||
#else
|
||||
#include "maix_nn_linux.hpp"
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -1067,6 +1067,7 @@ namespace maix::camera
|
||||
int height;
|
||||
void *buff;
|
||||
bool buff_alloc;
|
||||
bool _is_opened;
|
||||
};
|
||||
|
||||
std::vector<std::string> list_devices()
|
||||
@@ -1429,6 +1430,11 @@ namespace maix::camera
|
||||
}
|
||||
|
||||
|
||||
std::vector<int> get_sensor_size()
|
||||
{
|
||||
return {0, 0};
|
||||
}
|
||||
|
||||
std::vector<int> Camera::get_sensor_size() {
|
||||
return {0, 0};
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#include "maix_pipeline.hpp"
|
||||
#include "ax_middleware.hpp"
|
||||
|
||||
namespace maix::pipeline {
|
||||
Stream::Stream(void *stream, bool auto_delete, std::string from) {
|
||||
|
||||
Reference in New Issue
Block a user