add linux.

This commit is contained in:
amass 2024-09-03 23:30:45 +08:00
parent c7c24e9388
commit 239cb2d10f
6 changed files with 38 additions and 14 deletions

View File

@ -6,7 +6,6 @@
#include "Configuration.h" #include "Configuration.h"
#include "Database.h" #include "Database.h"
#include "DateTime.h" #include "DateTime.h"
#include "DeviceDiscovery.h"
#include "ImageDecoder.h" #include "ImageDecoder.h"
#include "StringUtility.h" #include "StringUtility.h"
#include "VideoFrameProvider.h" #include "VideoFrameProvider.h"
@ -21,6 +20,9 @@
#include <filesystem> #include <filesystem>
#include <fstream> #include <fstream>
#include <mbedtls/md5.h> #include <mbedtls/md5.h>
#ifdef WIN32
#include "DeviceDiscovery.h"
#endif
constexpr uint32_t ImageSliceSize = (4000 - 32); constexpr uint32_t ImageSliceSize = (4000 - 32);
@ -113,11 +115,13 @@ QStringList Application::availableSerialPorts() const {
QStringList Application::availableUsbVideoCameras() const { QStringList Application::availableUsbVideoCameras() const {
QStringList ret; QStringList ret;
#ifdef WIN32
DeviceDiscovery d; DeviceDiscovery d;
auto devices = d.devices(); auto devices = d.devices();
for (auto &device : devices) { for (auto &device : devices) {
ret << QString::fromStdString(device); ret << QString::fromStdString(device);
} }
#endif
return ret; return ret;
} }

View File

@ -1,9 +1,11 @@
#include "ModuleCommunication.h" #include "ModuleCommunication.h"
#include "BoostLog.h" #include "BoostLog.h"
#include "StringUtility.h" #include "StringUtility.h"
#include <WinSock2.h>
#include <mbedtls/md5.h> #include <mbedtls/md5.h>
#include <sstream> #include <sstream>
#ifdef WIN32
#include <WinSock2.h>
#endif
static inline uint8_t xor_checksum_byte(const uint8_t *data, uint32_t len) { static inline uint8_t xor_checksum_byte(const uint8_t *data, uint32_t len) {
uint8_t sum = 0; uint8_t sum = 0;

View File

@ -5,15 +5,28 @@ project(SmartLockerTools VERSION 0.1 LANGUAGES C CXX)
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(Projects_ROOT E:/Projects) if(WIN32)
set(Libraries_ROOT ${Projects_ROOT}/Libraries) set(Projects_ROOT E:/Projects)
set(Libraries_ROOT ${Projects_ROOT}/Libraries)
set(BOOST_ROOT ${Libraries_ROOT}/boost_1_86_0_msvc2022_64bit) set(BOOST_ROOT ${Libraries_ROOT}/boost_1_86_0_msvc2022_64bit)
set(Boost_INCLUDE_DIR ${BOOST_ROOT}/include/boost-1_86) set(Boost_INCLUDE_DIR ${BOOST_ROOT}/include/boost-1_86)
option(Boost_USE_STATIC_LIBS OFF) add_compile_definitions(
add_compile_definitions(
BOOST_USE_WINAPI_VERSION=BOOST_WINAPI_VERSION_WIN10 BOOST_USE_WINAPI_VERSION=BOOST_WINAPI_VERSION_WIN10
) )
else()
execute_process(
COMMAND sh -c "echo $HOME"
OUTPUT_VARIABLE USER_HOME
OUTPUT_STRIP_TRAILING_WHITESPACE
)
set(Projects_ROOT ${USER_HOME}/Projects)
set(Libraries_ROOT /opt/Libraries)
set(BOOST_ROOT ${Libraries_ROOT}/boost_1_86_0)
set(Boost_INCLUDE_DIR ${BOOST_ROOT}/include)
endif()
option(Boost_USE_STATIC_LIBS OFF)
set(FFmpeg_ROOT ${Libraries_ROOT}/ffmpeg-7.0.1-full_build-shared) set(FFmpeg_ROOT ${Libraries_ROOT}/ffmpeg-7.0.1-full_build-shared)
set(FFmpeg_INCLUDE_DIR ${FFmpeg_ROOT}/include) set(FFmpeg_INCLUDE_DIR ${FFmpeg_ROOT}/include)
@ -25,11 +38,15 @@ execute_process(
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_STRIP_TRAILING_WHITESPACE
) )
add_subdirectory(${Projects_ROOT}/Kylin/Universal Universal) include(FetchContent)
add_subdirectory(${Projects_ROOT}/Kylin/Encrypt Encrypt) FetchContent_Declare(Kylin
add_subdirectory(${Projects_ROOT}/Kylin/Fluent Fluent) GIT_REPOSITORY https://gitea.amass.fun/amass/Kylin.git
)
FetchContent_MakeAvailable(Kylin)
add_subdirectory(Peripheral) add_subdirectory(Peripheral)
add_subdirectory(Database) add_subdirectory(Database)
add_subdirectory(Analyser) add_subdirectory(Analyser)
add_subdirectory(OtaUpdate) if(WIN32)
add_subdirectory(OtaUpdate)
endif()

View File

@ -3,6 +3,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include <cstdint>
class PalmFeature { class PalmFeature {
public: public:

View File

@ -4,7 +4,7 @@ find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS SerialPort)
set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOMOC ON)
add_library(Peripheral add_library(Peripheral
DeviceDiscovery.h DeviceDiscovery.cpp $<$<PLATFORM_ID:Windows>:DeviceDiscovery.h DeviceDiscovery.cpp>
CdcUpdater.h CdcUpdater.cpp CdcUpdater.h CdcUpdater.cpp
) )