diff --git a/protoDebuger/CMakeLists.txt b/protoDebuger/CMakeLists.txt index ab91e4f..d67a413 100644 --- a/protoDebuger/CMakeLists.txt +++ b/protoDebuger/CMakeLists.txt @@ -1,44 +1,82 @@ cmake_minimum_required(VERSION 3.5) + project(protoDebuger LANGUAGES CXX) + set(CMAKE_INCLUDE_CURRENT_DIR ON) -set(CMAKE_AUTOUIC ON) -set(CMAKE_AUTOMOC ON) -set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC FALSE) +set(CMAKE_AUTOMOC FALSE) +set(CMAKE_AUTORCC FALSE) set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) -# QtCreator supports the following variables for Android, which are identical to qmake Android variables. -# Check http://doc.qt.io/qt-5/deployment-android.html for more information. -# They need to be set before the find_package(Qt5 ...) call. +include_directories(third/lua/include) +link_directories(third/lua/lib) +link_libraries(lua) -#if(ANDROID) -# set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android") -# if (ANDROID_ABI STREQUAL "armeabi-v7a") -# set(ANDROID_EXTRA_LIBS -# ${CMAKE_CURRENT_SOURCE_DIR}/path/to/libcrypto.so -# ${CMAKE_CURRENT_SOURCE_DIR}/path/to/libssl.so) -# endif() -#endif() +find_package(Qt5 COMPONENTS Core Quick Widgets REQUIRED) -find_package(Qt5 COMPONENTS Core Quick REQUIRED) +#include(D:\\project\\c++qt\\qsswraper\\CMakeLists.txt) -if(ANDROID) - add_library(protoDebuger SHARED - main.cpp - qml.qrc - ) -else() - add_executable(protoDebuger - main.cpp - qml.qrc - ) -endif() + +set(SOURCES # 待预编译的cpp代码 + dialog.cpp + main.cpp +) + +set(HEADERS # 待预编译的cpp头文件 + dialog.h +) + + +set(RESOURCES + qml.qrc + +) +set(QMLS + main.qml +) + +set (UIS + "dialog.ui" + ${QsswraperUI} +) + +QT5_WRAP_CPP(MOC ${SOURCES} ) # moc预编译代码 +QT5_ADD_RESOURCES(RCC ${RESOURCES}) # rcc生成资源cpp +QT5_WRAP_UI(UIC ${UIS}) # uic生成ui_x.h + + +FOREACH(list ${MOCHEADER}) + message("MOCHEADER file " ${list}) +ENDFOREACH(list) + +FOREACH(list ${MOC}) + message("MOC file " ${list}) +ENDFOREACH(list) + +FOREACH(list ${SOURCES}) + message("SOURCES file " ${list}) +ENDFOREACH(list) +FOREACH(list ${UIC}) + message("UIC file " ${list}) +ENDFOREACH(list) +FOREACH(list ${RCC}) + message("RCC file " ${list}) +ENDFOREACH(list) + +add_executable(protoDebuger #最后需要参与链接生成的是 + ${SOURCES} #1. 原先的cpp代码, + ${MOC} #2. 预编译后的cpp + ${RCC} #3. 资源cpp代码 +) target_compile_definitions(protoDebuger PRIVATE $<$,$>:QT_QML_DEBUG>) + target_link_libraries(protoDebuger - PRIVATE Qt5::Core Qt5::Quick) + PRIVATE Qt5::Core Qt5::Quick Qt5::Widgets) # 指定引入的QT功能,和qmake .pro 文件中的QT+= XXX类似 + diff --git a/protoDebuger/dialog.cpp b/protoDebuger/dialog.cpp new file mode 100644 index 0000000..58c3e72 --- /dev/null +++ b/protoDebuger/dialog.cpp @@ -0,0 +1,14 @@ +#include "dialog.h" +#include "ui_dialog.h" + +Dialog::Dialog(QWidget *parent) : + QDialog(parent), + ui(new Ui::Dialog) +{ + ui->setupUi(this); +} + +Dialog::~Dialog() +{ + delete ui; +} diff --git a/protoDebuger/dialog.h b/protoDebuger/dialog.h new file mode 100644 index 0000000..17537d1 --- /dev/null +++ b/protoDebuger/dialog.h @@ -0,0 +1,22 @@ +#ifndef DIALOG_H +#define DIALOG_H + +#include + +namespace Ui { +class Dialog; +} + +class Dialog : public QDialog +{ + Q_OBJECT + +public: + explicit Dialog(QWidget *parent = nullptr); + ~Dialog(); + +private: + Ui::Dialog *ui; +}; + +#endif // DIALOG_H diff --git a/protoDebuger/dialog.ui b/protoDebuger/dialog.ui new file mode 100644 index 0000000..685874d --- /dev/null +++ b/protoDebuger/dialog.ui @@ -0,0 +1,71 @@ + + + + + Dialog + + + + 0 + 0 + 400 + 300 + + + + Dialog + + + + + 30 + 240 + 341 + 32 + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + buttonBox + accepted() + Dialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + Dialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/protoDebuger/lua_wraper.h b/protoDebuger/lua_wraper.h new file mode 100644 index 0000000..3027286 --- /dev/null +++ b/protoDebuger/lua_wraper.h @@ -0,0 +1,23 @@ +#ifndef LUA_WRAPER_H +#define LUA_WRAPER_H + + +#include +extern "C" { +#include "lua.h" +#include "lauxlib.h" +#include "lualib.h" +} + +void TestLua(){ + char buff[256]; + int error; + lua_State *L = luaL_newstate(); //打开lua + if(nullptr != L){ + printf("shit is nullptr"); + } + luaL_openlibs(L); //打开标准库 + + lua_close(L); +} +#endif // LUA_WRAPER_H diff --git a/protoDebuger/main.cpp b/protoDebuger/main.cpp index 417a7b3..c766ce1 100644 --- a/protoDebuger/main.cpp +++ b/protoDebuger/main.cpp @@ -1,11 +1,14 @@ -#include +#include #include +#include "lua_wraper.h" +#include "dialog.h" int main(int argc, char *argv[]) { QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); - QGuiApplication app(argc, argv); + QApplication app(argc, argv); +// TestLua(); QQmlApplicationEngine engine; const QUrl url(QStringLiteral("qrc:/main.qml")); QObject::connect(&engine, &QQmlApplicationEngine::objectCreated, @@ -14,6 +17,8 @@ int main(int argc, char *argv[]) QCoreApplication::exit(-1); }, Qt::QueuedConnection); engine.load(url); + Dialog a; + a.show(); return app.exec(); }