From 798962e8bb751ccb14027fe8ad8fbff0c4937c6d Mon Sep 17 00:00:00 2001 From: luocai Date: Mon, 16 Dec 2024 15:34:40 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=82=E9=85=8DLinux=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 27 +++++++++++++++++++++------ DeviceConnection.cpp | 6 +++++- DeviceConnection.h | 2 ++ 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 01733a8..c45ca73 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,12 @@ set(APPLICATION_NAME "视觉防夹设备上位机工具") set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(Libraries_ROOT E:/Projects/Libraries CACHE STRING "Libraries directory.") +if(LINUX) + set(Libraries_ROOT /opt/Libraries CACHE STRING "Libraries directory.") +else() + set(Libraries_ROOT E:/Projects/Libraries CACHE STRING "Libraries directory.") +endif() + find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Qml Quick Network QuickControls2) find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Qml Quick Network QuickControls2) @@ -24,7 +29,11 @@ else() add_compile_options("$<$:/utf-8>") set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) - set(BOOST_ROOT ${Libraries_ROOT}/boost_1_83_0_msvc2022_64bit) + if(LINUX) + set(BOOST_ROOT ${Libraries_ROOT}/boost_1_83_0) + else() + set(BOOST_ROOT ${Libraries_ROOT}/boost_1_83_0_msvc2022_64bit) + endif() set(Boost_INCLUDE_DIR ${BOOST_ROOT}/include/boost-1_83) set(FFmpeg_ROOT ${Libraries_ROOT}/ffmpeg-6.1.1-full_build-shared) endif() @@ -39,8 +48,13 @@ set(FFmpeg_INCLUDE_DIR ${FFmpeg_ROOT}/include) set(FFmpeg_LIB_DIR ${FFmpeg_ROOT}/lib) if(CMAKE_BUILD_TYPE STREQUAL "Debug") - set(JPEGTURBO_ROOT ${Libraries_ROOT}/libjpeg-turbo-3.0.3_msvc2022_64bit_debug) - set(MBEDTLS_ROOT ${Libraries_ROOT}/mbedtls-3.6.2_msvc2022_64bit_debug) + if(LINUX) + set(MBEDTLS_ROOT ${Libraries_ROOT}/mbedtls-3.6.2) + set(JPEGTURBO_ROOT ${Libraries_ROOT}/libjpeg-turbo-3.1.0) + else() + set(MBEDTLS_ROOT ${Libraries_ROOT}/mbedtls-3.6.2_msvc2022_64bit_debug) + set(JPEGTURBO_ROOT ${Libraries_ROOT}/libjpeg-turbo-3.0.3_msvc2022_64bit_debug) + endif() else() set(JPEGTURBO_ROOT ${Libraries_ROOT}/libjpeg-turbo-3.0.3_msvc2022_64bit_release) set(MBEDTLS_ROOT ${Libraries_ROOT}/mbedtls-3.6.2_msvc2022_64bit_release) @@ -137,8 +151,9 @@ target_link_libraries(AntiClipSettings PRIVATE avformat PRIVATE Universal PRIVATE Encrypt - PRIVATE turbojpeg-static - PRIVATE Ws2_32 + $<$:turbojpeg> + $<$:turbojpeg-static> + $<$:Ws2_32> ) include(GNUInstallDirs) diff --git a/DeviceConnection.cpp b/DeviceConnection.cpp index 00e2efe..182fe46 100644 --- a/DeviceConnection.cpp +++ b/DeviceConnection.cpp @@ -5,13 +5,17 @@ #include #include #include -#include #include #include #include #include #include #include +#ifdef Q_OS_LINUX +#include +#else +#include +#endif DeviceConnection::DeviceConnection(QObject *parent) : QObject{parent} { } diff --git a/DeviceConnection.h b/DeviceConnection.h index b3d6c5e..af0aeef 100644 --- a/DeviceConnection.h +++ b/DeviceConnection.h @@ -9,8 +9,10 @@ #include #include #include +#include class NetworkInfomation; +class QTimer; class DeviceConnection : public QObject { Q_OBJECT