migrate SerialChart project to V

2018-04-02  本文已影响0人  stnevermore

There is a fantasitic qt epistasis software named "SerialChart" which draw beatiful curves with outputs from sensors.


SerialChart.png

The link is https://github.com/starlino/serialchart . Now I've migrated this project to vs2013 with Qt and record the issues.
What troubles is how to make CMakeList well. After searching many versions of CMakeLists.txt, i get the file done.

cmake_minimum_required (VERSION 3.10)
cmake_policy(SET CMP0071 NEW)

set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_STATIC_LIBRARY_SUFFIX})

PROJECT(serialChart)

set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)

set( HEAD_FILES
    chart.h
    common.h
    configuration.h
    decoderbase.h
    decoderbin.h
    decodercsv.h
    decoderhdlc.h
    decoderplugin.h
    displaybase.h
    hiddevice.h
    mainwindow.h
    plugin.h
    portbase.h
    porthid.h
    portrs232.h
    serialchartjs.h
)

set( SRC_FILES
    chart.cpp
    configuration.cpp
    decoderbase.cpp
    decoderbin.cpp
    decodercsv.cpp
    decoderhdlc.cpp
    decoderplugin.cpp
    displaybase.cpp
    hiddevice.cpp
    main.cpp
    mainwindow.cpp
    plugin.cpp
    portbase.cpp
    porthid.cpp
    portrs232.cpp
    serialchartjs.cpp
)

######set( UI_FILES mainwindow.ui)
FILE(GLOB UI_FILES *.ui)
set( RSC_FILES resources.qrc)

find_package(Qt5 COMPONENTS Widgets REQUIRED QUIET)
find_package(Qt5Core)
find_package(Qt5Widgets)
find_package(Qt5WebKit)
find_package(Qt5Gui)
find_package(Qt5Network)
find_package(Qt5WebKitWidgets)
find_package(Qt5SerialPort)

qt5_wrap_ui(UI_HEADERS ${UI_FILES})
qt5_add_resources(QRC_FILES ${RSC_FILES} )

source_group("Generated" FILES 
    ${UI_HEADERS}
    ${QRC_FILES}
)

add_executable(${PROJECT_NAME} WIN32 ${SRC_FILES} ${HEAD_FILES} ${RSC_FILES} ${UI_HEADERS})

qt5_use_modules(${PROJECT_NAME} Core Gui Widgets Network WebKit WebKitWidgets SerialPort)

Now i use cmake-gui to create the sln file,but there appears the problem like following shows:


Link Errors.png

Usually, Link errors like "error LNK2019" are caused by lacking of linked library. Add the SetupAPI.Lib to additional dependencies and the problem resolves

上一篇下一篇

猜你喜欢

热点阅读