2024-08-13 09:54:41 +08:00
|
|
|
cmake_minimum_required(VERSION 3.16)
|
|
|
|
|
2024-09-18 19:10:12 +08:00
|
|
|
project(AntiClipSettings VERSION 1.3 LANGUAGES C CXX)
|
2024-08-27 11:14:36 +08:00
|
|
|
set(APPLICATION_NAME "视觉防夹设备上位机工具")
|
2024-08-13 09:54:41 +08:00
|
|
|
|
2024-08-13 20:06:10 +08:00
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
2024-08-13 09:54:41 +08:00
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
|
2024-08-13 20:06:10 +08:00
|
|
|
set(Projects_ROOT E:/Projects)
|
|
|
|
set(Libraries_ROOT ${Projects_ROOT}/Libraries)
|
|
|
|
|
2024-08-26 14:55:15 +08:00
|
|
|
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Qml Quick Network QuickControls2)
|
|
|
|
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Qml Quick Network QuickControls2)
|
|
|
|
|
2024-08-24 22:35:35 +08:00
|
|
|
if (Qt6_FOUND)
|
|
|
|
qt_standard_project_setup(REQUIRES 6.5)
|
|
|
|
set(BOOST_ROOT ${Libraries_ROOT}/boost_1_86_0_msvc2022_64bit)
|
|
|
|
set(Boost_INCLUDE_DIR ${BOOST_ROOT}/include/boost-1_86)
|
|
|
|
add_compile_definitions(
|
|
|
|
BOOST_USE_WINAPI_VERSION=BOOST_WINAPI_VERSION_WIN10
|
|
|
|
)
|
|
|
|
else()
|
2024-08-26 16:46:41 +08:00
|
|
|
add_compile_options("$<$<C_COMPILER_ID:MSVC>:/utf-8>")
|
|
|
|
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")
|
2024-08-24 22:35:35 +08:00
|
|
|
set(CMAKE_AUTOMOC ON)
|
|
|
|
set(CMAKE_AUTORCC ON)
|
|
|
|
set(BOOST_ROOT ${Libraries_ROOT}/boost_1_83_0_msvc2022_64bit)
|
|
|
|
set(Boost_INCLUDE_DIR ${BOOST_ROOT}/include/boost-1_83)
|
|
|
|
endif()
|
2024-08-13 20:06:10 +08:00
|
|
|
option(Boost_USE_STATIC_LIBS OFF)
|
|
|
|
|
2024-10-15 17:48:51 +08:00
|
|
|
set(FFmpeg_ROOT ${Libraries_ROOT}/ffmpeg-7.0.2-full_build-shared)
|
2024-08-13 20:06:10 +08:00
|
|
|
set(FFmpeg_INCLUDE_DIR ${FFmpeg_ROOT}/include)
|
|
|
|
set(FFmpeg_LIB_DIR ${FFmpeg_ROOT}/lib)
|
|
|
|
|
2024-09-11 20:02:15 +08:00
|
|
|
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|
|
|
set(JPEGTURBO_ROOT ${Libraries_ROOT}/libjpeg-turbo-3.0.3_msvc2022_64bit_debug)
|
|
|
|
else()
|
|
|
|
set(JPEGTURBO_ROOT ${Libraries_ROOT}/libjpeg-turbo-3.0.3_msvc2022_64bit_release)
|
|
|
|
endif()
|
|
|
|
set(JPEGTURBO_INCLUDE_DIR ${JPEGTURBO_ROOT}/include)
|
|
|
|
set(JPEGTURBO_LIB_DIR ${JPEGTURBO_ROOT}/lib)
|
|
|
|
|
2024-08-13 20:06:10 +08:00
|
|
|
find_package(Boost REQUIRED COMPONENTS json)
|
2024-08-13 09:54:41 +08:00
|
|
|
|
2024-08-13 20:06:10 +08:00
|
|
|
execute_process(
|
|
|
|
COMMAND D:/msys64/usr/bin/git rev-parse --short HEAD
|
|
|
|
OUTPUT_VARIABLE GIT_COMMIT_ID
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
|
|
)
|
|
|
|
configure_file(Configuration.h.in Configuration.h)
|
|
|
|
|
2024-08-24 22:35:35 +08:00
|
|
|
add_executable(AntiClipSettings
|
|
|
|
AntiClipSettings.rc AntiClipSettings.qrc
|
2024-08-13 09:54:41 +08:00
|
|
|
main.cpp
|
2024-08-13 20:06:10 +08:00
|
|
|
Application.h Application.cpp
|
2024-08-16 16:24:15 +08:00
|
|
|
DataStructure.h
|
2024-08-21 09:26:06 +08:00
|
|
|
DataCollection.h DataCollection.cpp
|
2024-08-13 20:06:10 +08:00
|
|
|
DeviceConnection.h DeviceConnection.cpp
|
2024-08-16 16:24:15 +08:00
|
|
|
DeviceListModel.h DeviceListModel.cpp
|
2024-08-13 20:06:10 +08:00
|
|
|
H264Palyer.h H264Palyer.cpp
|
|
|
|
VideoFrameProvider.h VideoFrameProvider.cpp
|
2024-09-11 14:18:56 +08:00
|
|
|
Settings.h Settings.cpp
|
2024-08-13 09:54:41 +08:00
|
|
|
)
|
|
|
|
|
2024-08-24 22:35:35 +08:00
|
|
|
if (Qt6_FOUND)
|
2024-08-13 09:54:41 +08:00
|
|
|
qt_add_qml_module(AntiClipSettings
|
|
|
|
URI AntiClipSettings
|
2024-08-24 22:35:35 +08:00
|
|
|
VERSION 1.0
|
2024-08-13 09:54:41 +08:00
|
|
|
QML_FILES
|
2024-08-21 09:26:06 +08:00
|
|
|
qml/Main.qml
|
|
|
|
qml/DeviceView.qml
|
|
|
|
qml/IconButton.qml
|
|
|
|
qml/MessageDialog.qml
|
|
|
|
qml/NetworkSettingPopup.qml
|
|
|
|
qml/OtaPopup.qml
|
|
|
|
qml/StatusTip.qml
|
2024-08-21 16:03:49 +08:00
|
|
|
qml/IpTextField.qml
|
2024-08-21 09:26:06 +08:00
|
|
|
RESOURCES
|
|
|
|
resources/popup_close.svg
|
|
|
|
resources/prompt_delete.svg
|
|
|
|
resources/successfull.svg
|
|
|
|
resources/warning.svg
|
2024-08-13 09:54:41 +08:00
|
|
|
)
|
2024-08-24 22:35:35 +08:00
|
|
|
endif()
|
2024-08-13 09:54:41 +08:00
|
|
|
|
|
|
|
# Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1.
|
|
|
|
# If you are developing for iOS or macOS you should consider setting an
|
|
|
|
# explicit, fixed bundle identifier manually though.
|
|
|
|
set_target_properties(AntiClipSettings PROPERTIES
|
|
|
|
# MACOSX_BUNDLE_GUI_IDENTIFIER com.example.AntiClipSettings
|
|
|
|
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
|
|
|
|
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
|
|
|
|
MACOSX_BUNDLE TRUE
|
|
|
|
WIN32_EXECUTABLE TRUE
|
|
|
|
)
|
|
|
|
|
2024-08-13 20:06:10 +08:00
|
|
|
add_subdirectory(${Projects_ROOT}/Kylin/Universal Universal)
|
2024-08-19 09:33:04 +08:00
|
|
|
add_subdirectory(${Projects_ROOT}/Kylin/Encrypt Encrypt)
|
2024-08-13 20:06:10 +08:00
|
|
|
|
|
|
|
target_include_directories(AntiClipSettings
|
|
|
|
PRIVATE ${FFmpeg_INCLUDE_DIR}
|
|
|
|
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}
|
2024-09-11 20:02:15 +08:00
|
|
|
PRIVATE ${JPEGTURBO_INCLUDE_DIR}
|
2024-08-13 20:06:10 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
target_link_directories(AntiClipSettings
|
|
|
|
PRIVATE ${FFmpeg_LIB_DIR}
|
2024-09-11 20:02:15 +08:00
|
|
|
PRIVATE ${JPEGTURBO_LIB_DIR}
|
2024-08-13 20:06:10 +08:00
|
|
|
)
|
|
|
|
|
2024-08-13 09:54:41 +08:00
|
|
|
target_link_libraries(AntiClipSettings
|
2024-08-24 22:35:35 +08:00
|
|
|
PRIVATE Qt${QT_VERSION_MAJOR}::Qml
|
|
|
|
PRIVATE Qt${QT_VERSION_MAJOR}::Quick
|
|
|
|
PRIVATE Qt${QT_VERSION_MAJOR}::QuickControls2
|
|
|
|
PRIVATE Qt${QT_VERSION_MAJOR}::Network
|
2024-08-13 20:06:10 +08:00
|
|
|
PRIVATE Boost::json
|
|
|
|
PRIVATE avcodec
|
|
|
|
PRIVATE swscale
|
|
|
|
PRIVATE avutil
|
|
|
|
PRIVATE avdevice
|
|
|
|
PRIVATE avformat
|
|
|
|
PRIVATE Universal
|
2024-08-19 09:33:04 +08:00
|
|
|
PRIVATE Encrypt
|
2024-09-11 14:18:56 +08:00
|
|
|
PRIVATE turbojpeg-static
|
2024-08-24 22:35:35 +08:00
|
|
|
PRIVATE Ws2_32
|
2024-08-13 09:54:41 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
include(GNUInstallDirs)
|
|
|
|
install(TARGETS AntiClipSettings
|
|
|
|
BUNDLE DESTINATION .
|
|
|
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
|
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
|
|
|
)
|
2024-08-13 20:06:10 +08:00
|
|
|
|
2024-08-24 22:35:35 +08:00
|
|
|
if (Qt6_FOUND)
|
|
|
|
qt_generate_deploy_qml_app_script(
|
|
|
|
TARGET AntiClipSettings
|
|
|
|
OUTPUT_SCRIPT deploy_script
|
|
|
|
MACOS_BUNDLE_POST_BUILD
|
|
|
|
NO_UNSUPPORTED_PLATFORM_ERROR
|
|
|
|
DEPLOY_USER_QML_MODULES_ON_UNSUPPORTED_PLATFORM
|
|
|
|
)
|
|
|
|
install(SCRIPT ${deploy_script})
|
|
|
|
endif()
|