Как мне перевести cmake в файл qmake? - PullRequest
0 голосов
/ 26 октября 2019

У меня есть файл cmake, который генерирует некоторые исполняемые файлы, они работают. У меня есть приложение Qt, которое компилируется, но оно продолжает падать при запуске. enter image description here Я думаю, что приложение не подбирает правильные файлы. Не могли бы вы помочь с переводом файла cmake в qmake.

Код ниже - единственный код, который у меня есть в моей основной.

Я использую Qt 5.11.2, собранный с MSVC 2015 64.

#include "matplotlibcpp.h"
namespace plt = matplotlibcpp;
int main() {
    plt::plot({1,3,2,4});
    plt::show();
}

Командная строка Вывод с использованием CMAKE

E:\matplotlib-cpp-master\contrib>WinBuild.cmd
-- Selecting Windows SDK version 10.0.14393.0 to target Windows 10.0.18362.
-- Configuring done
-- Generating done
-- Build files have been written to: E:/matplotlib-cpp-master/examples/build
Microsoft (R) Build Engine version 14.0.25420.1
Copyright (C) Microsoft Corporation. All rights reserved.

  animation.vcxproj -> E:\matplotlib-cpp-master\examples\build\Release\animation.exe
  bar.vcxproj -> E:\matplotlib-cpp-master\examples\build\Release\bar.exe
  basic.vcxproj -> E:\matplotlib-cpp-master\examples\build\Release\basic.exe
  minimal.vcxproj -> E:\matplotlib-cpp-master\examples\build\Release\minimal.exe
  modern.vcxproj -> E:\matplotlib-cpp-master\examples\build\Release\modern.exe
  nonblock.vcxproj -> E:\matplotlib-cpp-master\examples\build\Release\nonblock.exe
  xkcd.vcxproj -> E:\matplotlib-cpp-master\examples\build\Release\xkcd.exe

E:\matplotlib-cpp-master\contrib>

ФАЙЛ CMAKE

     cmake_minimum_required(VERSION 3.7)
project (MatplotlibCPP_Test)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(PythonLibs REQUIRED)
include_directories(${PYTHON_INCLUDE_DIRS})

include_directories(${PYTHONHOME}/include)
include_directories("C:/Users/rafael/AppData/Roaming/Python/Python37/site-packages/numpy/core/include")
link_directories("C:/Program Files/Python37/libs")

add_definitions(-DMATPLOTLIBCPP_PYTHON_HEADER=Python.h)

# message(STATUS "*** dump start cmake variables ***")
# get_cmake_property(_variableNames VARIABLES)
# foreach(_variableName ${_variableNames})
#         message(STATUS "${_variableName}=${${_variableName}}")
# endforeach()
# message(STATUS "*** dump end ***")

add_executable(minimal ${CMAKE_CURRENT_SOURCE_DIR}/../examples/minimal.cpp)
add_executable(basic ${CMAKE_CURRENT_SOURCE_DIR}/../examples/basic.cpp)
add_executable(modern ${CMAKE_CURRENT_SOURCE_DIR}/../examples/modern.cpp)
add_executable(animation ${CMAKE_CURRENT_SOURCE_DIR}/../examples/animation.cpp)
add_executable(nonblock ${CMAKE_CURRENT_SOURCE_DIR}/../examples/nonblock.cpp)
add_executable(xkcd ${CMAKE_CURRENT_SOURCE_DIR}/../examples/xkcd.cpp)
add_executable(bar ${CMAKE_CURRENT_SOURCE_DIR}/../examples/bar.cpp)

ФАЙЛ QT .PRO

 QT       += core gui

    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

    CONFIG += c++11
    CONFIG += no_keywords    #Solve Python SLOT ISSUE

    # The following define makes your compiler emit warnings if you use
    # any Qt feature that has been marked deprecated (the exact warnings
    # depend on your compiler). Please consult the documentation of the
    # deprecated API in order to know how to port your code away from it.
    DEFINES += QT_DEPRECATED_WARNINGS

    DEFINES += -DMATPLOTLIBCPP_PYTHON_HEADER = Python.h

    # You can also make your code fail to compile if it uses deprecated APIs.
    # In order to do so, uncomment the following line.
    # You can also select to disable deprecated APIs only up to a certain version of Qt.
    #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0

    SOURCES += \
        main.cpp \
        mainwindow.cpp \
        pressure.cpp

    HEADERS += \
        mainwindow.h \
        matplotlibcpp.h \
        pressure.h

    FORMS += \
        mainwindow.ui

    # Default rules for deployment.
    qnx: target.path = /tmp/$${TARGET}/bin
    else: unix:!android: target.path = /opt/$${TARGET}/bin
    !isEmpty(target.path): INSTALLS += target

    #INCLUDEPATH += "E:\\PyBind11\\include"
    INCLUDEPATH += "C:\\Program Files\\Python37\\include"
    #INCLUDEPATH += "C:\\Program Files\\Python37\\Lib\\site-packages\\numpy\\core\\include"
    INCLUDEPATH += "C:\\users\\rafael\\appdata\\roaming\\python\\python37\\site-packages\\numpy\\core\\include"
    LIBS += "C:\\Program Files\\Python37\\libs\\python37_d.lib"
    LIBS += "C:\\Program Files\\Python37\\libs\\python37.lib"
...