AntiClipSettings/CMakeLists.txt
2024-08-19 09:33:04 +08:00

107 lines
3.0 KiB
CMake

cmake_minimum_required(VERSION 3.16)
project(AntiClipSettings VERSION 0.1 LANGUAGES C CXX)
set(APPLICATION_NAME "T009上位机")
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(Projects_ROOT E:/Projects)
set(Libraries_ROOT ${Projects_ROOT}/Libraries)
set(BOOST_ROOT ${Libraries_ROOT}/boost_1_86_0_msvc2022_64bit)
set(Boost_INCLUDE_DIR ${BOOST_ROOT}/include/boost-1_86)
option(Boost_USE_STATIC_LIBS OFF)
add_compile_definitions(
BOOST_USE_WINAPI_VERSION=BOOST_WINAPI_VERSION_WIN10
)
set(FFmpeg_ROOT ${Libraries_ROOT}/ffmpeg-7.0.1-full_build-shared)
set(FFmpeg_INCLUDE_DIR ${FFmpeg_ROOT}/include)
set(FFmpeg_LIB_DIR ${FFmpeg_ROOT}/lib)
find_package(Boost REQUIRED COMPONENTS json)
find_package(Qt6 REQUIRED COMPONENTS Qml Quick Network)
qt_standard_project_setup(REQUIRES 6.5)
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)
qt_add_executable(AntiClipSettings
AntiClipSettings.rc
main.cpp
Application.h Application.cpp
DataStructure.h
DeviceConnection.h DeviceConnection.cpp
DeviceListModel.h DeviceListModel.cpp
H264Palyer.h H264Palyer.cpp
VideoFrameProvider.h VideoFrameProvider.cpp
)
qt_add_qml_module(AntiClipSettings
URI AntiClipSettings
QML_FILES
Main.qml
DeviceView.qml
NetworkSettingPopup.qml
OtaPopup.qml
)
# 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
)
add_subdirectory(${Projects_ROOT}/Kylin/Universal Universal)
add_subdirectory(${Projects_ROOT}/Kylin/Encrypt Encrypt)
target_include_directories(AntiClipSettings
PRIVATE ${FFmpeg_INCLUDE_DIR}
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}
)
target_link_directories(AntiClipSettings
PRIVATE ${FFmpeg_LIB_DIR}
)
target_link_libraries(AntiClipSettings
PRIVATE Qt6::Qml
PRIVATE Qt6::Quick
PRIVATE Qt6::Network
PRIVATE Boost::json
PRIVATE avcodec
PRIVATE swscale
PRIVATE avutil
PRIVATE avdevice
PRIVATE avformat
PRIVATE Universal
PRIVATE Encrypt
)
include(GNUInstallDirs)
install(TARGETS AntiClipSettings
BUNDLE DESTINATION .
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
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})