Win10 + CLion + Raspberry Pi + QT remote call Python development

Principles: to develop on a machine is not in use on both machines! !

  1. First, you need to configure remote QT development environment

  2. Configuration Cmake

    cmake_minimum_required(VERSION 3.14)
    project(qt_test)
    
    set(CMAKE_CXX_STANDARD 14)
    
    set(CMAKE_AUTOMOC on)
    set(CMAKE_AUTOUIC on)
    set(CMAKE_AUTORCC on)
    set(CMAKE_INCLUDE_CURRENT_DIR on)
    
    
    find_package(PythonLibs 3.5 REQUIRED)   √
    find_package(Qt5 COMPONENTS Widgets Core Gui)
    include_directories(${PYTHON_INCLUDE_DIRS})   √
    
    add_executable(qt_test src/main.cpp src/mainwindow.cpp)
    target_link_libraries(qt_test python3.5 Qt5::Core Qt5::Gui Qt5::Widgets ${CMAKE_DL_LIBS} )  √

    Where the lines 12, 14, added Python-related parameters.

  3. Then you can call Python files in * .cpp file

    Reference Test here on this paper it

  4. reference:

    1. https://blog.csdn.net/wmx843230304wmx/article/details/79004437
    2. https://segmentfault.com/q/1010000018242759/revision

Guess you like

Origin www.cnblogs.com/BANLOONG/p/11576901.html