#message("Qt5.cmake 正在加载。") #set(CMAKE_AUTOMOC ON) #set(CMAKE_AUTORCC ON) #set(CMAKE_AUTOUIC ON) set(Qt5_Plugin_DIR) if(${G_Architecture_Name} MATCHES "^cl_Windows" OR ${G_Architecture_Name} MATCHES "^vs") # include_directories(C:/Qt/5.15.2/Src) # set(Qt5_BaseDIR C:/Qt/5.15.2/msvc2019_64) set(ver 5.14.2) set(t msvc2017_64) # set(ver 5.15.2) # set(t msvc2019_64) set(qb D:/Qt/Qt${ver}) include_directories(${qb}/Src) set(Qt5_BaseDIR ${qb}/${ver}/${t}) set(Qt5_Plugin_DIR ${Qt5_BaseDIR}/plugins) elseif(${G_Architecture_Name} MATCHES "^gxx_Windows") set(Qt5_BaseDIR D:/Qt5.14.2/5.14.2/mingw73_64) set(Qt5_Plugin_DIR ${Qt5_BaseDIR}/plugins) elseif(${G_Architecture_Name} MATCHES "^rk356x") set(Qt5_BaseDIR /opt/atk-dlrk356x-toolchain/aarch64-buildroot-linux-gnu/sysroot/usr) set(Qt5_Plugin_DIR /opt/atk-dlrk356x-toolchain/aarch64-buildroot-linux-gnu/sysroot/usr/lib/qt/plugins) elseif(${G_Architecture_Name} MATCHES "^win_ubuntu_20_04_pure_") set(Qt5_BaseDIR C:/wyc/Environment/qt512_x86_ubuntu2004/5.15.2/gcc_64) set(Qt5_Plugin_DIR ${Qt5_BaseDIR}/plugins) #C:\wyc\toolchain\ubuntu_20_04_pure\x86_64-wyc-linux-gnu\sysroot\usr\include\libdrm set(_GL_INCDIRS "${CMAKE_SYSROOT}/usr/include") elseif(${G_Architecture_Name} MATCHES "^ubuntu_20_04") set(Qt5_BaseDIR /aenv/Qt/5.14.2/5.14.2/gcc_64) set(Qt5_Plugin_DIR ${Qt5_BaseDIR}/plugins) else() set(Qt5_BaseDIR /opt/Qt/5.15.2/gcc_64) set(Qt5_Plugin_DIR ${Qt5_BaseDIR}/plugins) endif() set(Qt5_DIR "${Qt5_BaseDIR}/lib/cmake/Qt5") set(Qt5_Deploy "${Qt5_BaseDIR}/bin/windeployqt.exe") message("Qt5_DIR ${Qt5_DIR}") find_package(Qt5 REQUIRED COMPONENTS Core Gui Widgets Svg Xml Network Sql 3DCore 3DRender 3DInput 3DExtras Quick 3DQuickScene2D QuickWidgets Qml PrintSupport Multimedia SerialPort CONFIG ) #find_package(Qt5 COMPONENTS DataVisualization) arm # C:/Qt/5.15.2/msvc2019_64/bin/windeployqt.exe ${exe} function(_windows_deploy_qt _package_name_ targetPath outputDir) __check_none_extr_params(${ARGC} "${ARGN}" "${ARGV}") _install_command(${_package_name_} "\"${Qt5_Deploy}\" --no-translations --no-system-d3d-compiler --no-virtualkeyboard --no-compiler-runtime --no-webkit2 --no-angle --no-opengl-sw --plugindir \"${outputDir}\" --libdir \"${outputDir}\" \"${targetPath}\"" ) endfunction() function(_linux_deploy_qt _package_name_ abs_exe_path outputDir) __check_none_extr_params(${ARGC} "${ARGN}" "${ARGV}") set(deploy_sh ${CMAKE_SOURCE_DIR}/0_linux_pro/2_deploy.sh) if(NOT EXISTS ${deploy_sh}) message(STATUS "Qt5.cmake _linux_deploy_qt error! 找不到${deploy_sh}!") endif() get_filename_component(filename ${abs_exe_path} NAME) set(abs_temp_dir "/tmp/${filename}_runtime") install(CODE " execute_process( COMMAND bash -c \"source ${deploy_sh} && deploy_qt ${abs_exe_path} ${abs_temp_dir} ${Qt5_BaseDIR} ${Qt5_Plugin_DIR}\" WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} RESULT_VARIABLE result OUTPUT_VARIABLE output ERROR_VARIABLE error_output ) # 输出结果和错误信息 message(STATUS \"Result: \${result}\") message(STATUS \"Output: \${output}\") message(STATUS \"Error Output: \${error_output}\") file(COPY ${abs_temp_dir}.tar.gz DESTINATION ${outputDir}) " COMPONENT ${_package_name_} ) # because: Invalid cross-device link 不能跨系统 # file(MAKE_DIRECTORY ${outputDir}) # get_filename_component(filename ${abs_runtime_dir_path} NAME) # file(RENAME ${abs_runtime_dir_path}.tar.gz ${outputDir}/${filename}.tar.gz) endfunction() # _linux_deploy_qt(/aenv/win/wyc/projects/CLionProjects/plantSunCat/cmake-build-ubuntu-release/mainProjects/yC_exe_cxx_Linux_Release /aenv/run2time) # windeployqt.exe #Options: # -?, -h, --help Displays help on commandline options. # --help-all Displays help including Qt specific options. # -v, --version Displays version information. # --dir Use directory instead of binary directory. # --libdir Copy libraries to path. # --plugindir Copy plugins to path. # --debug Assume debug binaries. # --release Assume release binaries. # --pdb Deploy .pdb files (MSVC). # --force Force updating files. # --dry-run Simulation mode. Behave normally, but do not # move/update any files. # --no-patchqt Do not patch the Qt5Core library. # --no-plugins Skip plugin deployment. # --no-libraries Skip library deployment. # --qmldir Scan for QML-imports starting from directory. # --qmlimport Add the given path to the QML module search # locations. # --no-quick-import Skip deployment of Qt Quick imports. # --no-translations Skip deployment of translations. # --no-system-d3d-compiler Skip deployment of the system D3D compiler. # --compiler-runtime Deploy compiler runtime (Desktop only). # --no-virtualkeyboard Disable deployment of the Virtual Keyboard. # --no-compiler-runtime Do not deploy compiler runtime (Desktop only). # --webkit2 Deployment of WebKit2 (web process). # --no-webkit2 Skip deployment of WebKit2. # --json Print to stdout in JSON format. # --angle Force deployment of ANGLE. # --no-angle Disable deployment of ANGLE. # --no-opengl-sw Do not deploy the software rasterizer library. # --list