2021-04-04 02:57:36 +00:00
|
|
|
|
cmake_minimum_required(VERSION 3.5)
|
2021-04-07 15:47:18 +00:00
|
|
|
|
|
|
|
|
|
include_directories(third/lua/include)
|
|
|
|
|
link_directories(third/lua/lib)
|
2021-04-05 15:40:14 +00:00
|
|
|
|
link_libraries(lua)
|
2021-04-14 16:33:28 +00:00
|
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
|
|
|
|
2021-04-04 18:32:21 +00:00
|
|
|
|
|
2021-04-04 02:57:36 +00:00
|
|
|
|
project(protoDebuger LANGUAGES CXX)
|
|
|
|
|
|
|
|
|
|
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
|
|
|
|
|
2021-04-04 18:32:21 +00:00
|
|
|
|
set(CMAKE_AUTOUIC FALSE)
|
|
|
|
|
set(CMAKE_AUTOMOC FALSE)
|
|
|
|
|
set(CMAKE_AUTORCC FALSE)
|
2021-04-04 02:57:36 +00:00
|
|
|
|
|
|
|
|
|
set(CMAKE_CXX_STANDARD 11)
|
|
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
|
|
2021-04-04 18:32:21 +00:00
|
|
|
|
find_package(Qt5 COMPONENTS Core Quick Widgets REQUIRED)
|
|
|
|
|
|
2021-04-05 15:40:14 +00:00
|
|
|
|
set(HEADERS # 待预编译的cpp头文件
|
2021-04-10 14:22:41 +00:00
|
|
|
|
qserialproto.h
|
|
|
|
|
globalvar.h
|
|
|
|
|
serialcontroller.h
|
2021-04-11 03:28:04 +00:00
|
|
|
|
sharedata.h
|
2021-04-05 15:40:14 +00:00
|
|
|
|
)
|
2021-04-04 18:32:21 +00:00
|
|
|
|
|
|
|
|
|
set(SOURCES # 待预编译的cpp代码
|
2021-04-10 14:22:41 +00:00
|
|
|
|
serialcontroller.cpp
|
|
|
|
|
qserialproto.cpp
|
|
|
|
|
globalvar.cpp
|
2021-04-11 03:28:04 +00:00
|
|
|
|
sharedata.cpp
|
2021-04-14 16:33:28 +00:00
|
|
|
|
lua_wraper.cpp
|
2021-04-15 17:13:04 +00:00
|
|
|
|
lua_bind.cpp
|
2021-04-04 18:32:21 +00:00
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
set(RESOURCES
|
|
|
|
|
qml.qrc
|
|
|
|
|
)
|
2021-04-05 15:40:14 +00:00
|
|
|
|
|
2021-04-04 18:32:21 +00:00
|
|
|
|
set(QMLS
|
|
|
|
|
main.qml
|
|
|
|
|
)
|
|
|
|
|
|
2021-04-10 14:22:41 +00:00
|
|
|
|
set (NO_MOC_SOURCES
|
|
|
|
|
main.cpp
|
|
|
|
|
globalvar.cpp
|
|
|
|
|
)
|
|
|
|
|
|
2021-04-04 18:32:21 +00:00
|
|
|
|
set (UIS
|
2021-04-10 14:22:41 +00:00
|
|
|
|
${QsswraperUI}
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
include(D:\\project\\c++qt\\qsswraper\\CMakeLists.txt)
|
2021-04-11 03:28:04 +00:00
|
|
|
|
include(D:\\project\\c++qt\\qsswraper\\extserial\\src\\qextserialport.cmake)
|
2021-04-04 18:32:21 +00:00
|
|
|
|
|
|
|
|
|
QT5_WRAP_CPP(MOC ${SOURCES} ) # moc预编译代码
|
2021-04-04 18:37:47 +00:00
|
|
|
|
QT5_WRAP_CPP(MOCHEADER ${HEADERS} ) # moc预编译代码
|
2021-04-04 18:32:21 +00:00
|
|
|
|
QT5_ADD_RESOURCES(RCC ${RESOURCES}) # rcc生成资源cpp
|
|
|
|
|
QT5_WRAP_UI(UIC ${UIS}) # uic生成ui_x.h
|
|
|
|
|
|
2021-04-11 03:28:04 +00:00
|
|
|
|
|
|
|
|
|
FOREACH(list ${UIC})
|
|
|
|
|
message("MOC " ${list} )
|
|
|
|
|
ENDFOREACH(list)
|
|
|
|
|
|
|
|
|
|
FOREACH(list ${MOC})
|
|
|
|
|
message("MOC " ${list} )
|
|
|
|
|
ENDFOREACH(list)
|
|
|
|
|
FOREACH(list ${NO_MOC_SOURCES})
|
|
|
|
|
message("NO_MOC_SOURCES " ${list} )
|
|
|
|
|
ENDFOREACH(list)
|
2021-04-04 18:32:21 +00:00
|
|
|
|
|
|
|
|
|
add_executable(protoDebuger #最后需要参与链接生成的是
|
|
|
|
|
${SOURCES} #1. 原先的cpp代码,
|
|
|
|
|
${MOC} #2. 预编译后的cpp
|
|
|
|
|
${RCC} #3. 资源cpp代码
|
2021-04-05 15:40:14 +00:00
|
|
|
|
${UIC}
|
2021-04-10 14:22:41 +00:00
|
|
|
|
${NO_MOC_SOURCES}
|
2021-04-04 18:32:21 +00:00
|
|
|
|
)
|
2021-04-04 02:57:36 +00:00
|
|
|
|
|
|
|
|
|
target_compile_definitions(protoDebuger
|
|
|
|
|
PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>)
|
2021-04-04 18:32:21 +00:00
|
|
|
|
|
2021-04-12 15:39:06 +00:00
|
|
|
|
find_package( Qt5SerialPort)
|
|
|
|
|
|
2021-04-04 02:57:36 +00:00
|
|
|
|
target_link_libraries(protoDebuger
|
2021-04-12 15:39:06 +00:00
|
|
|
|
PRIVATE Qt5::Core Qt5::Quick Qt5::Widgets Qt5::SerialPort ) # 指定引入的QT功能,和qmake .pro 文件中的QT+= XXX类似
|