VoiletCStudio v1.0 - 紫罗兰 C 工程配置器
功能特性: - JSON 格式工程配置文件 - 虚拟目录管理(类似 MDK) - 跨平台 CMake 自动生成 - 一键编译 Debug/Release - 拖拽文件打开工程 - 实时编译输出显示 作者:虾哥 日期:2026-04-09
This commit is contained in:
23
.qmake.stash
Normal file
23
.qmake.stash
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
QMAKE_CXX.QT_COMPILER_STDCXX = 201703L
|
||||||
|
QMAKE_CXX.QMAKE_GCC_MAJOR_VERSION = 14
|
||||||
|
QMAKE_CXX.QMAKE_GCC_MINOR_VERSION = 2
|
||||||
|
QMAKE_CXX.QMAKE_GCC_PATCH_VERSION = 0
|
||||||
|
QMAKE_CXX.COMPILER_MACROS = \
|
||||||
|
QT_COMPILER_STDCXX \
|
||||||
|
QMAKE_GCC_MAJOR_VERSION \
|
||||||
|
QMAKE_GCC_MINOR_VERSION \
|
||||||
|
QMAKE_GCC_PATCH_VERSION
|
||||||
|
QMAKE_CXX.INCDIRS = \
|
||||||
|
/usr/include/c++/14 \
|
||||||
|
/usr/include/x86_64-linux-gnu/c++/14 \
|
||||||
|
/usr/include/c++/14/backward \
|
||||||
|
/usr/lib/gcc/x86_64-linux-gnu/14/include \
|
||||||
|
/usr/local/include \
|
||||||
|
/usr/include/x86_64-linux-gnu \
|
||||||
|
/usr/include
|
||||||
|
QMAKE_CXX.LIBDIRS = \
|
||||||
|
/usr/lib/gcc/x86_64-linux-gnu/14 \
|
||||||
|
/usr/lib/x86_64-linux-gnu \
|
||||||
|
/usr/lib \
|
||||||
|
/lib/x86_64-linux-gnu \
|
||||||
|
/lib
|
||||||
444
Makefile
Normal file
444
Makefile
Normal file
@@ -0,0 +1,444 @@
|
|||||||
|
#############################################################################
|
||||||
|
# Makefile for building: VoiletCStudio
|
||||||
|
# Generated by qmake (3.1) (Qt 5.15.15)
|
||||||
|
# Project: VoiletCStudio.pro
|
||||||
|
# Template: app
|
||||||
|
# Command: /usr/lib/qt5/bin/qmake -o Makefile VoiletCStudio.pro
|
||||||
|
#############################################################################
|
||||||
|
|
||||||
|
MAKEFILE = Makefile
|
||||||
|
|
||||||
|
EQ = =
|
||||||
|
|
||||||
|
####### Compiler, tools and options
|
||||||
|
|
||||||
|
CC = gcc
|
||||||
|
CXX = g++
|
||||||
|
DEFINES = -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB
|
||||||
|
CFLAGS = -pipe -O2 -Wall -Wextra -D_REENTRANT -fPIC $(DEFINES)
|
||||||
|
CXXFLAGS = -pipe -O2 -std=gnu++11 -Wall -Wextra -D_REENTRANT -fPIC $(DEFINES)
|
||||||
|
INCPATH = -I. -I/usr/include/x86_64-linux-gnu/qt5 -I/usr/include/x86_64-linux-gnu/qt5/QtWidgets -I/usr/include/x86_64-linux-gnu/qt5/QtGui -I/usr/include/x86_64-linux-gnu/qt5/QtCore -I. -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++
|
||||||
|
QMAKE = /usr/lib/qt5/bin/qmake
|
||||||
|
DEL_FILE = rm -f
|
||||||
|
CHK_DIR_EXISTS= test -d
|
||||||
|
MKDIR = mkdir -p
|
||||||
|
COPY = cp -f
|
||||||
|
COPY_FILE = cp -f
|
||||||
|
COPY_DIR = cp -f -R
|
||||||
|
INSTALL_FILE = install -m 644 -p
|
||||||
|
INSTALL_PROGRAM = install -m 755 -p
|
||||||
|
INSTALL_DIR = cp -f -R
|
||||||
|
QINSTALL = /usr/lib/qt5/bin/qmake -install qinstall
|
||||||
|
QINSTALL_PROGRAM = /usr/lib/qt5/bin/qmake -install qinstall -exe
|
||||||
|
DEL_FILE = rm -f
|
||||||
|
SYMLINK = ln -f -s
|
||||||
|
DEL_DIR = rmdir
|
||||||
|
MOVE = mv -f
|
||||||
|
TAR = tar -cf
|
||||||
|
COMPRESS = gzip -9f
|
||||||
|
DISTNAME = VoiletCStudio1.0.0
|
||||||
|
DISTDIR = /home/anonymous/Desktop/VoiletCStudio/.tmp/VoiletCStudio1.0.0
|
||||||
|
LINK = g++
|
||||||
|
LFLAGS = -Wl,-O1
|
||||||
|
LIBS = $(SUBLIBS) /usr/lib/x86_64-linux-gnu/libQt5Widgets.so /usr/lib/x86_64-linux-gnu/libQt5Gui.so /usr/lib/x86_64-linux-gnu/libQt5Core.so -lGL -lpthread
|
||||||
|
AR = ar cqs
|
||||||
|
RANLIB =
|
||||||
|
SED = sed
|
||||||
|
STRIP = strip
|
||||||
|
|
||||||
|
####### Output directory
|
||||||
|
|
||||||
|
OBJECTS_DIR = ./
|
||||||
|
|
||||||
|
####### Files
|
||||||
|
|
||||||
|
SOURCES = src/main.cpp \
|
||||||
|
src/mainwindow.cpp \
|
||||||
|
src/projectconfig.cpp \
|
||||||
|
src/cmakegenerator.cpp moc_mainwindow.cpp \
|
||||||
|
moc_projectconfig.cpp \
|
||||||
|
moc_cmakegenerator.cpp
|
||||||
|
OBJECTS = main.o \
|
||||||
|
mainwindow.o \
|
||||||
|
projectconfig.o \
|
||||||
|
cmakegenerator.o \
|
||||||
|
moc_mainwindow.o \
|
||||||
|
moc_projectconfig.o \
|
||||||
|
moc_cmakegenerator.o
|
||||||
|
DIST = /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/spec_pre.prf \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/unix.conf \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/linux.conf \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/sanitize.conf \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/gcc-base.conf \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/gcc-base-unix.conf \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/g++-base.conf \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/g++-unix.conf \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/qconfig.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_accessibility_support_private.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_bootstrap_private.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_concurrent.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_concurrent_private.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_core.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_core_private.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_dbus.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_dbus_private.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_devicediscovery_support_private.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_edid_support_private.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_egl_support_private.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_eglfs_kms_support_private.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_eglfsdeviceintegration_private.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_eventdispatcher_support_private.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_fb_support_private.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_fontdatabase_support_private.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_glx_support_private.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_gui.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_gui_private.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_input_support_private.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_kms_support_private.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_linuxaccessibility_support_private.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_network.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_network_private.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_opengl.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_opengl_private.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_openglextensions.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_openglextensions_private.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_platformcompositor_support_private.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_printsupport.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_printsupport_private.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_service_support_private.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_sql.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_sql_private.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_testlib.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_testlib_private.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_theme_support_private.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_vulkan_support_private.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_widgets.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_widgets_private.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_xcb_qpa_lib_private.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_xkbcommon_support_private.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_xml.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_xml_private.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_functions.prf \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_config.prf \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++/qmake.conf \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/spec_post.prf \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/exclusive_builds.prf \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/toolchain.prf \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/default_pre.prf \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/resolve_config.prf \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/default_post.prf \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/warn_on.prf \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt.prf \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/resources_functions.prf \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/resources.prf \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/moc.prf \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/unix/opengl.prf \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/uic.prf \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/unix/thread.prf \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qmake_use.prf \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/file_copies.prf \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/testcase_targets.prf \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/exceptions.prf \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/yacc.prf \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/lex.prf \
|
||||||
|
VoiletCStudio.pro src/mainwindow.h \
|
||||||
|
src/projectconfig.h \
|
||||||
|
src/cmakegenerator.h src/main.cpp \
|
||||||
|
src/mainwindow.cpp \
|
||||||
|
src/projectconfig.cpp \
|
||||||
|
src/cmakegenerator.cpp
|
||||||
|
QMAKE_TARGET = VoiletCStudio
|
||||||
|
DESTDIR =
|
||||||
|
TARGET = VoiletCStudio
|
||||||
|
|
||||||
|
|
||||||
|
first: all
|
||||||
|
####### Build rules
|
||||||
|
|
||||||
|
VoiletCStudio: $(OBJECTS)
|
||||||
|
$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
|
||||||
|
|
||||||
|
Makefile: VoiletCStudio.pro /usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++/qmake.conf /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/spec_pre.prf \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/unix.conf \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/linux.conf \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/sanitize.conf \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/gcc-base.conf \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/gcc-base-unix.conf \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/g++-base.conf \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/g++-unix.conf \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/qconfig.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_accessibility_support_private.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_bootstrap_private.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_concurrent.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_concurrent_private.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_core.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_core_private.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_dbus.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_dbus_private.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_devicediscovery_support_private.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_edid_support_private.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_egl_support_private.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_eglfs_kms_support_private.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_eglfsdeviceintegration_private.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_eventdispatcher_support_private.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_fb_support_private.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_fontdatabase_support_private.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_glx_support_private.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_gui.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_gui_private.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_input_support_private.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_kms_support_private.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_linuxaccessibility_support_private.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_network.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_network_private.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_opengl.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_opengl_private.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_openglextensions.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_openglextensions_private.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_platformcompositor_support_private.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_printsupport.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_printsupport_private.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_service_support_private.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_sql.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_sql_private.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_testlib.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_testlib_private.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_theme_support_private.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_vulkan_support_private.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_widgets.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_widgets_private.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_xcb_qpa_lib_private.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_xkbcommon_support_private.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_xml.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_xml_private.pri \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_functions.prf \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_config.prf \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++/qmake.conf \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/spec_post.prf \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/exclusive_builds.prf \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/toolchain.prf \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/default_pre.prf \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/resolve_config.prf \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/default_post.prf \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/warn_on.prf \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt.prf \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/resources_functions.prf \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/resources.prf \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/moc.prf \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/unix/opengl.prf \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/uic.prf \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/unix/thread.prf \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qmake_use.prf \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/file_copies.prf \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/testcase_targets.prf \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/exceptions.prf \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/yacc.prf \
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/lex.prf \
|
||||||
|
VoiletCStudio.pro
|
||||||
|
$(QMAKE) -o Makefile VoiletCStudio.pro
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/spec_pre.prf:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/unix.conf:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/linux.conf:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/sanitize.conf:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/gcc-base.conf:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/gcc-base-unix.conf:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/g++-base.conf:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/g++-unix.conf:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/qconfig.pri:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_accessibility_support_private.pri:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_bootstrap_private.pri:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_concurrent.pri:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_concurrent_private.pri:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_core.pri:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_core_private.pri:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_dbus.pri:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_dbus_private.pri:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_devicediscovery_support_private.pri:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_edid_support_private.pri:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_egl_support_private.pri:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_eglfs_kms_support_private.pri:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_eglfsdeviceintegration_private.pri:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_eventdispatcher_support_private.pri:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_fb_support_private.pri:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_fontdatabase_support_private.pri:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_glx_support_private.pri:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_gui.pri:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_gui_private.pri:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_input_support_private.pri:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_kms_support_private.pri:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_linuxaccessibility_support_private.pri:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_network.pri:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_network_private.pri:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_opengl.pri:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_opengl_private.pri:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_openglextensions.pri:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_openglextensions_private.pri:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_platformcompositor_support_private.pri:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_printsupport.pri:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_printsupport_private.pri:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_service_support_private.pri:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_sql.pri:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_sql_private.pri:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_testlib.pri:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_testlib_private.pri:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_theme_support_private.pri:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_vulkan_support_private.pri:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_widgets.pri:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_widgets_private.pri:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_xcb_qpa_lib_private.pri:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_xkbcommon_support_private.pri:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_xml.pri:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_xml_private.pri:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_functions.prf:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_config.prf:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++/qmake.conf:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/spec_post.prf:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/exclusive_builds.prf:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/toolchain.prf:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/default_pre.prf:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/resolve_config.prf:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/default_post.prf:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/warn_on.prf:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt.prf:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/resources_functions.prf:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/resources.prf:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/moc.prf:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/unix/opengl.prf:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/uic.prf:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/unix/thread.prf:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qmake_use.prf:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/file_copies.prf:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/testcase_targets.prf:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/exceptions.prf:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/yacc.prf:
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/lex.prf:
|
||||||
|
VoiletCStudio.pro:
|
||||||
|
qmake: FORCE
|
||||||
|
@$(QMAKE) -o Makefile VoiletCStudio.pro
|
||||||
|
|
||||||
|
qmake_all: FORCE
|
||||||
|
|
||||||
|
|
||||||
|
all: Makefile VoiletCStudio
|
||||||
|
|
||||||
|
dist: distdir FORCE
|
||||||
|
(cd `dirname $(DISTDIR)` && $(TAR) $(DISTNAME).tar $(DISTNAME) && $(COMPRESS) $(DISTNAME).tar) && $(MOVE) `dirname $(DISTDIR)`/$(DISTNAME).tar.gz . && $(DEL_FILE) -r $(DISTDIR)
|
||||||
|
|
||||||
|
distdir: FORCE
|
||||||
|
@test -d $(DISTDIR) || mkdir -p $(DISTDIR)
|
||||||
|
$(COPY_FILE) --parents $(DIST) $(DISTDIR)/
|
||||||
|
$(COPY_FILE) --parents /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/data/dummy.cpp $(DISTDIR)/
|
||||||
|
$(COPY_FILE) --parents src/mainwindow.h src/projectconfig.h src/cmakegenerator.h $(DISTDIR)/
|
||||||
|
$(COPY_FILE) --parents src/main.cpp src/mainwindow.cpp src/projectconfig.cpp src/cmakegenerator.cpp $(DISTDIR)/
|
||||||
|
|
||||||
|
|
||||||
|
clean: compiler_clean
|
||||||
|
-$(DEL_FILE) $(OBJECTS)
|
||||||
|
-$(DEL_FILE) *~ core *.core
|
||||||
|
|
||||||
|
|
||||||
|
distclean: clean
|
||||||
|
-$(DEL_FILE) $(TARGET)
|
||||||
|
-$(DEL_FILE) .qmake.stash
|
||||||
|
-$(DEL_FILE) Makefile
|
||||||
|
|
||||||
|
|
||||||
|
####### Sub-libraries
|
||||||
|
|
||||||
|
mocclean: compiler_moc_header_clean compiler_moc_objc_header_clean compiler_moc_source_clean
|
||||||
|
|
||||||
|
mocables: compiler_moc_header_make_all compiler_moc_objc_header_make_all compiler_moc_source_make_all
|
||||||
|
|
||||||
|
check: first
|
||||||
|
|
||||||
|
benchmark: first
|
||||||
|
|
||||||
|
compiler_rcc_make_all:
|
||||||
|
compiler_rcc_clean:
|
||||||
|
compiler_moc_predefs_make_all: moc_predefs.h
|
||||||
|
compiler_moc_predefs_clean:
|
||||||
|
-$(DEL_FILE) moc_predefs.h
|
||||||
|
moc_predefs.h: /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/data/dummy.cpp
|
||||||
|
g++ -pipe -O2 -std=gnu++11 -Wall -Wextra -dM -E -o moc_predefs.h /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/data/dummy.cpp
|
||||||
|
|
||||||
|
compiler_moc_header_make_all: moc_mainwindow.cpp moc_projectconfig.cpp moc_cmakegenerator.cpp
|
||||||
|
compiler_moc_header_clean:
|
||||||
|
-$(DEL_FILE) moc_mainwindow.cpp moc_projectconfig.cpp moc_cmakegenerator.cpp
|
||||||
|
moc_mainwindow.cpp: src/mainwindow.h \
|
||||||
|
src/projectconfig.h \
|
||||||
|
src/cmakegenerator.h \
|
||||||
|
moc_predefs.h \
|
||||||
|
/usr/lib/qt5/bin/moc
|
||||||
|
/usr/lib/qt5/bin/moc $(DEFINES) --include /home/anonymous/Desktop/VoiletCStudio/moc_predefs.h -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++ -I/home/anonymous/Desktop/VoiletCStudio -I/usr/include/x86_64-linux-gnu/qt5 -I/usr/include/x86_64-linux-gnu/qt5/QtWidgets -I/usr/include/x86_64-linux-gnu/qt5/QtGui -I/usr/include/x86_64-linux-gnu/qt5/QtCore -I/usr/include/c++/14 -I/usr/include/x86_64-linux-gnu/c++/14 -I/usr/include/c++/14/backward -I/usr/lib/gcc/x86_64-linux-gnu/14/include -I/usr/local/include -I/usr/include/x86_64-linux-gnu -I/usr/include src/mainwindow.h -o moc_mainwindow.cpp
|
||||||
|
|
||||||
|
moc_projectconfig.cpp: src/projectconfig.h \
|
||||||
|
moc_predefs.h \
|
||||||
|
/usr/lib/qt5/bin/moc
|
||||||
|
/usr/lib/qt5/bin/moc $(DEFINES) --include /home/anonymous/Desktop/VoiletCStudio/moc_predefs.h -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++ -I/home/anonymous/Desktop/VoiletCStudio -I/usr/include/x86_64-linux-gnu/qt5 -I/usr/include/x86_64-linux-gnu/qt5/QtWidgets -I/usr/include/x86_64-linux-gnu/qt5/QtGui -I/usr/include/x86_64-linux-gnu/qt5/QtCore -I/usr/include/c++/14 -I/usr/include/x86_64-linux-gnu/c++/14 -I/usr/include/c++/14/backward -I/usr/lib/gcc/x86_64-linux-gnu/14/include -I/usr/local/include -I/usr/include/x86_64-linux-gnu -I/usr/include src/projectconfig.h -o moc_projectconfig.cpp
|
||||||
|
|
||||||
|
moc_cmakegenerator.cpp: src/cmakegenerator.h \
|
||||||
|
src/projectconfig.h \
|
||||||
|
moc_predefs.h \
|
||||||
|
/usr/lib/qt5/bin/moc
|
||||||
|
/usr/lib/qt5/bin/moc $(DEFINES) --include /home/anonymous/Desktop/VoiletCStudio/moc_predefs.h -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++ -I/home/anonymous/Desktop/VoiletCStudio -I/usr/include/x86_64-linux-gnu/qt5 -I/usr/include/x86_64-linux-gnu/qt5/QtWidgets -I/usr/include/x86_64-linux-gnu/qt5/QtGui -I/usr/include/x86_64-linux-gnu/qt5/QtCore -I/usr/include/c++/14 -I/usr/include/x86_64-linux-gnu/c++/14 -I/usr/include/c++/14/backward -I/usr/lib/gcc/x86_64-linux-gnu/14/include -I/usr/local/include -I/usr/include/x86_64-linux-gnu -I/usr/include src/cmakegenerator.h -o moc_cmakegenerator.cpp
|
||||||
|
|
||||||
|
compiler_moc_objc_header_make_all:
|
||||||
|
compiler_moc_objc_header_clean:
|
||||||
|
compiler_moc_source_make_all:
|
||||||
|
compiler_moc_source_clean:
|
||||||
|
compiler_uic_make_all:
|
||||||
|
compiler_uic_clean:
|
||||||
|
compiler_yacc_decl_make_all:
|
||||||
|
compiler_yacc_decl_clean:
|
||||||
|
compiler_yacc_impl_make_all:
|
||||||
|
compiler_yacc_impl_clean:
|
||||||
|
compiler_lex_make_all:
|
||||||
|
compiler_lex_clean:
|
||||||
|
compiler_clean: compiler_moc_predefs_clean compiler_moc_header_clean
|
||||||
|
|
||||||
|
####### Compile
|
||||||
|
|
||||||
|
main.o: src/main.cpp src/mainwindow.h \
|
||||||
|
src/projectconfig.h \
|
||||||
|
src/cmakegenerator.h
|
||||||
|
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o src/main.cpp
|
||||||
|
|
||||||
|
mainwindow.o: src/mainwindow.cpp src/mainwindow.h \
|
||||||
|
src/projectconfig.h \
|
||||||
|
src/cmakegenerator.h
|
||||||
|
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o mainwindow.o src/mainwindow.cpp
|
||||||
|
|
||||||
|
projectconfig.o: src/projectconfig.cpp src/projectconfig.h
|
||||||
|
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o projectconfig.o src/projectconfig.cpp
|
||||||
|
|
||||||
|
cmakegenerator.o: src/cmakegenerator.cpp src/cmakegenerator.h \
|
||||||
|
src/projectconfig.h
|
||||||
|
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o cmakegenerator.o src/cmakegenerator.cpp
|
||||||
|
|
||||||
|
moc_mainwindow.o: moc_mainwindow.cpp
|
||||||
|
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_mainwindow.o moc_mainwindow.cpp
|
||||||
|
|
||||||
|
moc_projectconfig.o: moc_projectconfig.cpp
|
||||||
|
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_projectconfig.o moc_projectconfig.cpp
|
||||||
|
|
||||||
|
moc_cmakegenerator.o: moc_cmakegenerator.cpp
|
||||||
|
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_cmakegenerator.o moc_cmakegenerator.cpp
|
||||||
|
|
||||||
|
####### Install
|
||||||
|
|
||||||
|
install_target: first FORCE
|
||||||
|
@test -d $(INSTALL_ROOT)/opt/VoiletCStudio/bin || mkdir -p $(INSTALL_ROOT)/opt/VoiletCStudio/bin
|
||||||
|
$(QINSTALL_PROGRAM) $(QMAKE_TARGET) $(INSTALL_ROOT)/opt/VoiletCStudio/bin/$(QMAKE_TARGET)
|
||||||
|
-$(STRIP) $(INSTALL_ROOT)/opt/VoiletCStudio/bin/$(QMAKE_TARGET)
|
||||||
|
|
||||||
|
uninstall_target: FORCE
|
||||||
|
-$(DEL_FILE) $(INSTALL_ROOT)/opt/VoiletCStudio/bin/$(QMAKE_TARGET)
|
||||||
|
-$(DEL_DIR) $(INSTALL_ROOT)/opt/VoiletCStudio/bin/
|
||||||
|
|
||||||
|
|
||||||
|
install: install_target FORCE
|
||||||
|
|
||||||
|
uninstall: uninstall_target FORCE
|
||||||
|
|
||||||
|
FORCE:
|
||||||
|
|
||||||
146
README.md
Normal file
146
README.md
Normal file
@@ -0,0 +1,146 @@
|
|||||||
|
# VoiletCStudio - 紫罗兰 C 工具箱
|
||||||
|
|
||||||
|
Qt5 跨平台 C 工程配置器,自动生成 CMakeLists.txt
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🚀 功能特性
|
||||||
|
|
||||||
|
### 1. 工程配置管理
|
||||||
|
- ✅ JSON 格式配置文件
|
||||||
|
- ✅ 新建/打开/保存工程
|
||||||
|
- ✅ Ctrl+S 快速保存
|
||||||
|
|
||||||
|
### 2. 编译工具链配置
|
||||||
|
- ✅ 编译器路径选择
|
||||||
|
- ✅ 汇编器路径选择
|
||||||
|
- ✅ 链接器路径选择
|
||||||
|
- ✅ 支持 MinGW/GCC/Clang
|
||||||
|
|
||||||
|
### 3. 文件管理
|
||||||
|
- ✅ 虚拟目录(类似 MDK)
|
||||||
|
- ✅ .c 源文件分类管理
|
||||||
|
- ✅ .h 包含目录管理
|
||||||
|
- ✅ 库文件管理(.a/.so/.lib)
|
||||||
|
|
||||||
|
### 4. 编译配置
|
||||||
|
- ✅ 编译宏定义
|
||||||
|
- ✅ 自定义编译选项
|
||||||
|
- ✅ Debug/Release 模式
|
||||||
|
|
||||||
|
### 5. CMake 生成
|
||||||
|
- ✅ 自动生成 CMakeLists.txt
|
||||||
|
- ✅ 支持 make debug/release
|
||||||
|
- ✅ 跨平台兼容
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📋 使用方法
|
||||||
|
|
||||||
|
### 编译
|
||||||
|
```bash
|
||||||
|
cd VoiletCStudio
|
||||||
|
qmake
|
||||||
|
make
|
||||||
|
```
|
||||||
|
|
||||||
|
### 运行
|
||||||
|
```bash
|
||||||
|
./VoiletCStudio
|
||||||
|
```
|
||||||
|
|
||||||
|
### 使用流程
|
||||||
|
1. 新建工程
|
||||||
|
2. 配置编译器路径
|
||||||
|
3. 添加虚拟目录和源文件
|
||||||
|
4. 添加包含目录和库文件
|
||||||
|
5. 添加编译宏和选项
|
||||||
|
6. 保存工程(JSON)
|
||||||
|
7. 生成 CMakeLists.txt
|
||||||
|
8. 使用 CMake 编译
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🛠️ CMake 使用
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 配置
|
||||||
|
cmake -B build
|
||||||
|
|
||||||
|
# 编译 Debug
|
||||||
|
make debug
|
||||||
|
|
||||||
|
# 编译 Release
|
||||||
|
make release
|
||||||
|
|
||||||
|
# 或直接使用
|
||||||
|
cmake --build build --config Debug
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📁 项目结构
|
||||||
|
|
||||||
|
```
|
||||||
|
VoiletCStudio/
|
||||||
|
├── src/
|
||||||
|
│ ├── main.cpp # 主程序入口
|
||||||
|
│ ├── mainwindow.cpp/h # 主窗口
|
||||||
|
│ ├── projectconfig.cpp/h # 配置管理
|
||||||
|
│ └── cmakegenerator.cpp/h # CMake 生成
|
||||||
|
├── resources/ # 资源文件
|
||||||
|
├── VoiletCStudio.pro # Qt 项目文件
|
||||||
|
└── README.md # 说明文档
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 💻 跨平台支持
|
||||||
|
|
||||||
|
| 平台 | 编译器 | 状态 |
|
||||||
|
|------|--------|------|
|
||||||
|
| Windows | MinGW | ✅ |
|
||||||
|
| Linux | GCC | ✅ |
|
||||||
|
| macOS | Clang | ✅ |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📝 配置文件格式
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"projectName": "MyProject",
|
||||||
|
"projectPath": "/path/to/project",
|
||||||
|
"compilerPath": "/usr/bin/gcc",
|
||||||
|
"virtualDirs": {
|
||||||
|
"App": {
|
||||||
|
"name": "App",
|
||||||
|
"files": ["src/main.c"]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"includeDirs": ["./include"],
|
||||||
|
"libraries": ["libmylib.a"],
|
||||||
|
"defines": ["DEBUG"],
|
||||||
|
"compilerOptions": ["-Wall"]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🎯 特色
|
||||||
|
|
||||||
|
- **类 MDK 虚拟目录**:像 Keil MDK 一样管理源文件
|
||||||
|
- **一键生成 CMake**:自动生成完整的 CMakeLists.txt
|
||||||
|
- **跨平台**:Windows/Linux/macOS 全支持
|
||||||
|
- **轻量级**:纯 Qt5 实现,无额外依赖
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📄 许可证
|
||||||
|
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**作者:虾哥**
|
||||||
|
**日期:2026-04-09**
|
||||||
BIN
VoiletCStudio
Executable file
BIN
VoiletCStudio
Executable file
Binary file not shown.
26
VoiletCStudio.pro
Normal file
26
VoiletCStudio.pro
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
QT += core gui widgets
|
||||||
|
|
||||||
|
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||||
|
|
||||||
|
CONFIG += c++11
|
||||||
|
|
||||||
|
TARGET = VoiletCStudio
|
||||||
|
TEMPLATE = app
|
||||||
|
|
||||||
|
# 源文件
|
||||||
|
SOURCES += \
|
||||||
|
src/main.cpp \
|
||||||
|
src/mainwindow.cpp \
|
||||||
|
src/projectconfig.cpp \
|
||||||
|
src/cmakegenerator.cpp
|
||||||
|
|
||||||
|
# 头文件
|
||||||
|
HEADERS += \
|
||||||
|
src/mainwindow.h \
|
||||||
|
src/projectconfig.h \
|
||||||
|
src/cmakegenerator.h
|
||||||
|
|
||||||
|
# 默认部署规则
|
||||||
|
qnx: target.path = /tmp/$${TARGET}/bin
|
||||||
|
else: unix:!android: target.path = /opt/$${TARGET}/bin
|
||||||
|
!isEmpty(target.path): INSTALLS += target
|
||||||
BIN
cmakegenerator.o
Normal file
BIN
cmakegenerator.o
Normal file
Binary file not shown.
BIN
mainwindow.o
Normal file
BIN
mainwindow.o
Normal file
Binary file not shown.
155
moc_cmakegenerator.cpp
Normal file
155
moc_cmakegenerator.cpp
Normal file
@@ -0,0 +1,155 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
** Meta object code from reading C++ file 'cmakegenerator.h'
|
||||||
|
**
|
||||||
|
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.15.15)
|
||||||
|
**
|
||||||
|
** WARNING! All changes made in this file will be lost!
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
#include "src/cmakegenerator.h"
|
||||||
|
#include <QtCore/qbytearray.h>
|
||||||
|
#include <QtCore/qmetatype.h>
|
||||||
|
#if !defined(Q_MOC_OUTPUT_REVISION)
|
||||||
|
#error "The header file 'cmakegenerator.h' doesn't include <QObject>."
|
||||||
|
#elif Q_MOC_OUTPUT_REVISION != 67
|
||||||
|
#error "This file was generated using the moc from 5.15.15. It"
|
||||||
|
#error "cannot be used with the include files from this version of Qt."
|
||||||
|
#error "(The moc has changed too much.)"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
QT_BEGIN_MOC_NAMESPACE
|
||||||
|
QT_WARNING_PUSH
|
||||||
|
QT_WARNING_DISABLE_DEPRECATED
|
||||||
|
struct qt_meta_stringdata_CMakeGenerator_t {
|
||||||
|
QByteArrayData data[6];
|
||||||
|
char stringdata0[56];
|
||||||
|
};
|
||||||
|
#define QT_MOC_LITERAL(idx, ofs, len) \
|
||||||
|
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
|
||||||
|
qptrdiff(offsetof(qt_meta_stringdata_CMakeGenerator_t, stringdata0) + ofs \
|
||||||
|
- idx * sizeof(QByteArrayData)) \
|
||||||
|
)
|
||||||
|
static const qt_meta_stringdata_CMakeGenerator_t qt_meta_stringdata_CMakeGenerator = {
|
||||||
|
{
|
||||||
|
QT_MOC_LITERAL(0, 0, 14), // "CMakeGenerator"
|
||||||
|
QT_MOC_LITERAL(1, 15, 14), // "cmakeGenerated"
|
||||||
|
QT_MOC_LITERAL(2, 30, 0), // ""
|
||||||
|
QT_MOC_LITERAL(3, 31, 4), // "path"
|
||||||
|
QT_MOC_LITERAL(4, 36, 13), // "errorOccurred"
|
||||||
|
QT_MOC_LITERAL(5, 50, 5) // "error"
|
||||||
|
|
||||||
|
},
|
||||||
|
"CMakeGenerator\0cmakeGenerated\0\0path\0"
|
||||||
|
"errorOccurred\0error"
|
||||||
|
};
|
||||||
|
#undef QT_MOC_LITERAL
|
||||||
|
|
||||||
|
static const uint qt_meta_data_CMakeGenerator[] = {
|
||||||
|
|
||||||
|
// content:
|
||||||
|
8, // revision
|
||||||
|
0, // classname
|
||||||
|
0, 0, // classinfo
|
||||||
|
2, 14, // methods
|
||||||
|
0, 0, // properties
|
||||||
|
0, 0, // enums/sets
|
||||||
|
0, 0, // constructors
|
||||||
|
0, // flags
|
||||||
|
2, // signalCount
|
||||||
|
|
||||||
|
// signals: name, argc, parameters, tag, flags
|
||||||
|
1, 1, 24, 2, 0x06 /* Public */,
|
||||||
|
4, 1, 27, 2, 0x06 /* Public */,
|
||||||
|
|
||||||
|
// signals: parameters
|
||||||
|
QMetaType::Void, QMetaType::QString, 3,
|
||||||
|
QMetaType::Void, QMetaType::QString, 5,
|
||||||
|
|
||||||
|
0 // eod
|
||||||
|
};
|
||||||
|
|
||||||
|
void CMakeGenerator::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
|
||||||
|
{
|
||||||
|
if (_c == QMetaObject::InvokeMetaMethod) {
|
||||||
|
auto *_t = static_cast<CMakeGenerator *>(_o);
|
||||||
|
(void)_t;
|
||||||
|
switch (_id) {
|
||||||
|
case 0: _t->cmakeGenerated((*reinterpret_cast< const QString(*)>(_a[1]))); break;
|
||||||
|
case 1: _t->errorOccurred((*reinterpret_cast< const QString(*)>(_a[1]))); break;
|
||||||
|
default: ;
|
||||||
|
}
|
||||||
|
} else if (_c == QMetaObject::IndexOfMethod) {
|
||||||
|
int *result = reinterpret_cast<int *>(_a[0]);
|
||||||
|
{
|
||||||
|
using _t = void (CMakeGenerator::*)(const QString & );
|
||||||
|
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&CMakeGenerator::cmakeGenerated)) {
|
||||||
|
*result = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
using _t = void (CMakeGenerator::*)(const QString & );
|
||||||
|
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&CMakeGenerator::errorOccurred)) {
|
||||||
|
*result = 1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QT_INIT_METAOBJECT const QMetaObject CMakeGenerator::staticMetaObject = { {
|
||||||
|
QMetaObject::SuperData::link<QObject::staticMetaObject>(),
|
||||||
|
qt_meta_stringdata_CMakeGenerator.data,
|
||||||
|
qt_meta_data_CMakeGenerator,
|
||||||
|
qt_static_metacall,
|
||||||
|
nullptr,
|
||||||
|
nullptr
|
||||||
|
} };
|
||||||
|
|
||||||
|
|
||||||
|
const QMetaObject *CMakeGenerator::metaObject() const
|
||||||
|
{
|
||||||
|
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
void *CMakeGenerator::qt_metacast(const char *_clname)
|
||||||
|
{
|
||||||
|
if (!_clname) return nullptr;
|
||||||
|
if (!strcmp(_clname, qt_meta_stringdata_CMakeGenerator.stringdata0))
|
||||||
|
return static_cast<void*>(this);
|
||||||
|
return QObject::qt_metacast(_clname);
|
||||||
|
}
|
||||||
|
|
||||||
|
int CMakeGenerator::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
|
||||||
|
{
|
||||||
|
_id = QObject::qt_metacall(_c, _id, _a);
|
||||||
|
if (_id < 0)
|
||||||
|
return _id;
|
||||||
|
if (_c == QMetaObject::InvokeMetaMethod) {
|
||||||
|
if (_id < 2)
|
||||||
|
qt_static_metacall(this, _c, _id, _a);
|
||||||
|
_id -= 2;
|
||||||
|
} else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
|
||||||
|
if (_id < 2)
|
||||||
|
*reinterpret_cast<int*>(_a[0]) = -1;
|
||||||
|
_id -= 2;
|
||||||
|
}
|
||||||
|
return _id;
|
||||||
|
}
|
||||||
|
|
||||||
|
// SIGNAL 0
|
||||||
|
void CMakeGenerator::cmakeGenerated(const QString & _t1)
|
||||||
|
{
|
||||||
|
void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(std::addressof(_t1))) };
|
||||||
|
QMetaObject::activate(this, &staticMetaObject, 0, _a);
|
||||||
|
}
|
||||||
|
|
||||||
|
// SIGNAL 1
|
||||||
|
void CMakeGenerator::errorOccurred(const QString & _t1)
|
||||||
|
{
|
||||||
|
void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(std::addressof(_t1))) };
|
||||||
|
QMetaObject::activate(this, &staticMetaObject, 1, _a);
|
||||||
|
}
|
||||||
|
QT_WARNING_POP
|
||||||
|
QT_END_MOC_NAMESPACE
|
||||||
BIN
moc_cmakegenerator.o
Normal file
BIN
moc_cmakegenerator.o
Normal file
Binary file not shown.
233
moc_mainwindow.cpp
Normal file
233
moc_mainwindow.cpp
Normal file
@@ -0,0 +1,233 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
** Meta object code from reading C++ file 'mainwindow.h'
|
||||||
|
**
|
||||||
|
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.15.15)
|
||||||
|
**
|
||||||
|
** WARNING! All changes made in this file will be lost!
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
#include "src/mainwindow.h"
|
||||||
|
#include <QtCore/qbytearray.h>
|
||||||
|
#include <QtCore/qmetatype.h>
|
||||||
|
#if !defined(Q_MOC_OUTPUT_REVISION)
|
||||||
|
#error "The header file 'mainwindow.h' doesn't include <QObject>."
|
||||||
|
#elif Q_MOC_OUTPUT_REVISION != 67
|
||||||
|
#error "This file was generated using the moc from 5.15.15. It"
|
||||||
|
#error "cannot be used with the include files from this version of Qt."
|
||||||
|
#error "(The moc has changed too much.)"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
QT_BEGIN_MOC_NAMESPACE
|
||||||
|
QT_WARNING_PUSH
|
||||||
|
QT_WARNING_DISABLE_DEPRECATED
|
||||||
|
struct qt_meta_stringdata_MainWindow_t {
|
||||||
|
QByteArrayData data[30];
|
||||||
|
char stringdata0[438];
|
||||||
|
};
|
||||||
|
#define QT_MOC_LITERAL(idx, ofs, len) \
|
||||||
|
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
|
||||||
|
qptrdiff(offsetof(qt_meta_stringdata_MainWindow_t, stringdata0) + ofs \
|
||||||
|
- idx * sizeof(QByteArrayData)) \
|
||||||
|
)
|
||||||
|
static const qt_meta_stringdata_MainWindow_t qt_meta_stringdata_MainWindow = {
|
||||||
|
{
|
||||||
|
QT_MOC_LITERAL(0, 0, 10), // "MainWindow"
|
||||||
|
QT_MOC_LITERAL(1, 11, 10), // "newProject"
|
||||||
|
QT_MOC_LITERAL(2, 22, 0), // ""
|
||||||
|
QT_MOC_LITERAL(3, 23, 11), // "openProject"
|
||||||
|
QT_MOC_LITERAL(4, 35, 11), // "saveProject"
|
||||||
|
QT_MOC_LITERAL(5, 47, 13), // "saveProjectAs"
|
||||||
|
QT_MOC_LITERAL(6, 61, 13), // "generateCMake"
|
||||||
|
QT_MOC_LITERAL(7, 75, 12), // "compileDebug"
|
||||||
|
QT_MOC_LITERAL(8, 88, 14), // "compileRelease"
|
||||||
|
QT_MOC_LITERAL(9, 103, 14), // "compileProject"
|
||||||
|
QT_MOC_LITERAL(10, 118, 9), // "buildType"
|
||||||
|
QT_MOC_LITERAL(11, 128, 20), // "onProjectNameChanged"
|
||||||
|
QT_MOC_LITERAL(12, 149, 4), // "text"
|
||||||
|
QT_MOC_LITERAL(13, 154, 21), // "onCompilerPathChanged"
|
||||||
|
QT_MOC_LITERAL(14, 176, 22), // "onAssemblerPathChanged"
|
||||||
|
QT_MOC_LITERAL(15, 199, 19), // "onLinkerPathChanged"
|
||||||
|
QT_MOC_LITERAL(16, 219, 13), // "addVirtualDir"
|
||||||
|
QT_MOC_LITERAL(17, 233, 13), // "addSourceFile"
|
||||||
|
QT_MOC_LITERAL(18, 247, 16), // "removeSourceFile"
|
||||||
|
QT_MOC_LITERAL(19, 264, 13), // "addIncludeDir"
|
||||||
|
QT_MOC_LITERAL(20, 278, 16), // "removeIncludeDir"
|
||||||
|
QT_MOC_LITERAL(21, 295, 10), // "addLibrary"
|
||||||
|
QT_MOC_LITERAL(22, 306, 13), // "removeLibrary"
|
||||||
|
QT_MOC_LITERAL(23, 320, 9), // "addDefine"
|
||||||
|
QT_MOC_LITERAL(24, 330, 12), // "removeDefine"
|
||||||
|
QT_MOC_LITERAL(25, 343, 17), // "addCompilerOption"
|
||||||
|
QT_MOC_LITERAL(26, 361, 20), // "removeCompilerOption"
|
||||||
|
QT_MOC_LITERAL(27, 382, 18), // "browseCompilerPath"
|
||||||
|
QT_MOC_LITERAL(28, 401, 19), // "browseAssemblerPath"
|
||||||
|
QT_MOC_LITERAL(29, 421, 16) // "browseLinkerPath"
|
||||||
|
|
||||||
|
},
|
||||||
|
"MainWindow\0newProject\0\0openProject\0"
|
||||||
|
"saveProject\0saveProjectAs\0generateCMake\0"
|
||||||
|
"compileDebug\0compileRelease\0compileProject\0"
|
||||||
|
"buildType\0onProjectNameChanged\0text\0"
|
||||||
|
"onCompilerPathChanged\0onAssemblerPathChanged\0"
|
||||||
|
"onLinkerPathChanged\0addVirtualDir\0"
|
||||||
|
"addSourceFile\0removeSourceFile\0"
|
||||||
|
"addIncludeDir\0removeIncludeDir\0"
|
||||||
|
"addLibrary\0removeLibrary\0addDefine\0"
|
||||||
|
"removeDefine\0addCompilerOption\0"
|
||||||
|
"removeCompilerOption\0browseCompilerPath\0"
|
||||||
|
"browseAssemblerPath\0browseLinkerPath"
|
||||||
|
};
|
||||||
|
#undef QT_MOC_LITERAL
|
||||||
|
|
||||||
|
static const uint qt_meta_data_MainWindow[] = {
|
||||||
|
|
||||||
|
// content:
|
||||||
|
8, // revision
|
||||||
|
0, // classname
|
||||||
|
0, 0, // classinfo
|
||||||
|
26, 14, // methods
|
||||||
|
0, 0, // properties
|
||||||
|
0, 0, // enums/sets
|
||||||
|
0, 0, // constructors
|
||||||
|
0, // flags
|
||||||
|
0, // signalCount
|
||||||
|
|
||||||
|
// slots: name, argc, parameters, tag, flags
|
||||||
|
1, 0, 144, 2, 0x08 /* Private */,
|
||||||
|
3, 0, 145, 2, 0x08 /* Private */,
|
||||||
|
4, 0, 146, 2, 0x08 /* Private */,
|
||||||
|
5, 0, 147, 2, 0x08 /* Private */,
|
||||||
|
6, 0, 148, 2, 0x08 /* Private */,
|
||||||
|
7, 0, 149, 2, 0x08 /* Private */,
|
||||||
|
8, 0, 150, 2, 0x08 /* Private */,
|
||||||
|
9, 1, 151, 2, 0x08 /* Private */,
|
||||||
|
11, 1, 154, 2, 0x08 /* Private */,
|
||||||
|
13, 0, 157, 2, 0x08 /* Private */,
|
||||||
|
14, 0, 158, 2, 0x08 /* Private */,
|
||||||
|
15, 0, 159, 2, 0x08 /* Private */,
|
||||||
|
16, 0, 160, 2, 0x08 /* Private */,
|
||||||
|
17, 0, 161, 2, 0x08 /* Private */,
|
||||||
|
18, 0, 162, 2, 0x08 /* Private */,
|
||||||
|
19, 0, 163, 2, 0x08 /* Private */,
|
||||||
|
20, 0, 164, 2, 0x08 /* Private */,
|
||||||
|
21, 0, 165, 2, 0x08 /* Private */,
|
||||||
|
22, 0, 166, 2, 0x08 /* Private */,
|
||||||
|
23, 0, 167, 2, 0x08 /* Private */,
|
||||||
|
24, 0, 168, 2, 0x08 /* Private */,
|
||||||
|
25, 0, 169, 2, 0x08 /* Private */,
|
||||||
|
26, 0, 170, 2, 0x08 /* Private */,
|
||||||
|
27, 0, 171, 2, 0x08 /* Private */,
|
||||||
|
28, 0, 172, 2, 0x08 /* Private */,
|
||||||
|
29, 0, 173, 2, 0x08 /* Private */,
|
||||||
|
|
||||||
|
// slots: parameters
|
||||||
|
QMetaType::Void,
|
||||||
|
QMetaType::Void,
|
||||||
|
QMetaType::Bool,
|
||||||
|
QMetaType::Bool,
|
||||||
|
QMetaType::Void,
|
||||||
|
QMetaType::Void,
|
||||||
|
QMetaType::Void,
|
||||||
|
QMetaType::Void, QMetaType::QString, 10,
|
||||||
|
QMetaType::Void, QMetaType::QString, 12,
|
||||||
|
QMetaType::Void,
|
||||||
|
QMetaType::Void,
|
||||||
|
QMetaType::Void,
|
||||||
|
QMetaType::Void,
|
||||||
|
QMetaType::Void,
|
||||||
|
QMetaType::Void,
|
||||||
|
QMetaType::Void,
|
||||||
|
QMetaType::Void,
|
||||||
|
QMetaType::Void,
|
||||||
|
QMetaType::Void,
|
||||||
|
QMetaType::Void,
|
||||||
|
QMetaType::Void,
|
||||||
|
QMetaType::Void,
|
||||||
|
QMetaType::Void,
|
||||||
|
QMetaType::Void,
|
||||||
|
QMetaType::Void,
|
||||||
|
QMetaType::Void,
|
||||||
|
|
||||||
|
0 // eod
|
||||||
|
};
|
||||||
|
|
||||||
|
void MainWindow::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
|
||||||
|
{
|
||||||
|
if (_c == QMetaObject::InvokeMetaMethod) {
|
||||||
|
auto *_t = static_cast<MainWindow *>(_o);
|
||||||
|
(void)_t;
|
||||||
|
switch (_id) {
|
||||||
|
case 0: _t->newProject(); break;
|
||||||
|
case 1: _t->openProject(); break;
|
||||||
|
case 2: { bool _r = _t->saveProject();
|
||||||
|
if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = std::move(_r); } break;
|
||||||
|
case 3: { bool _r = _t->saveProjectAs();
|
||||||
|
if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = std::move(_r); } break;
|
||||||
|
case 4: _t->generateCMake(); break;
|
||||||
|
case 5: _t->compileDebug(); break;
|
||||||
|
case 6: _t->compileRelease(); break;
|
||||||
|
case 7: _t->compileProject((*reinterpret_cast< const QString(*)>(_a[1]))); break;
|
||||||
|
case 8: _t->onProjectNameChanged((*reinterpret_cast< const QString(*)>(_a[1]))); break;
|
||||||
|
case 9: _t->onCompilerPathChanged(); break;
|
||||||
|
case 10: _t->onAssemblerPathChanged(); break;
|
||||||
|
case 11: _t->onLinkerPathChanged(); break;
|
||||||
|
case 12: _t->addVirtualDir(); break;
|
||||||
|
case 13: _t->addSourceFile(); break;
|
||||||
|
case 14: _t->removeSourceFile(); break;
|
||||||
|
case 15: _t->addIncludeDir(); break;
|
||||||
|
case 16: _t->removeIncludeDir(); break;
|
||||||
|
case 17: _t->addLibrary(); break;
|
||||||
|
case 18: _t->removeLibrary(); break;
|
||||||
|
case 19: _t->addDefine(); break;
|
||||||
|
case 20: _t->removeDefine(); break;
|
||||||
|
case 21: _t->addCompilerOption(); break;
|
||||||
|
case 22: _t->removeCompilerOption(); break;
|
||||||
|
case 23: _t->browseCompilerPath(); break;
|
||||||
|
case 24: _t->browseAssemblerPath(); break;
|
||||||
|
case 25: _t->browseLinkerPath(); break;
|
||||||
|
default: ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QT_INIT_METAOBJECT const QMetaObject MainWindow::staticMetaObject = { {
|
||||||
|
QMetaObject::SuperData::link<QMainWindow::staticMetaObject>(),
|
||||||
|
qt_meta_stringdata_MainWindow.data,
|
||||||
|
qt_meta_data_MainWindow,
|
||||||
|
qt_static_metacall,
|
||||||
|
nullptr,
|
||||||
|
nullptr
|
||||||
|
} };
|
||||||
|
|
||||||
|
|
||||||
|
const QMetaObject *MainWindow::metaObject() const
|
||||||
|
{
|
||||||
|
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
void *MainWindow::qt_metacast(const char *_clname)
|
||||||
|
{
|
||||||
|
if (!_clname) return nullptr;
|
||||||
|
if (!strcmp(_clname, qt_meta_stringdata_MainWindow.stringdata0))
|
||||||
|
return static_cast<void*>(this);
|
||||||
|
return QMainWindow::qt_metacast(_clname);
|
||||||
|
}
|
||||||
|
|
||||||
|
int MainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
|
||||||
|
{
|
||||||
|
_id = QMainWindow::qt_metacall(_c, _id, _a);
|
||||||
|
if (_id < 0)
|
||||||
|
return _id;
|
||||||
|
if (_c == QMetaObject::InvokeMetaMethod) {
|
||||||
|
if (_id < 26)
|
||||||
|
qt_static_metacall(this, _c, _id, _a);
|
||||||
|
_id -= 26;
|
||||||
|
} else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
|
||||||
|
if (_id < 26)
|
||||||
|
*reinterpret_cast<int*>(_a[0]) = -1;
|
||||||
|
_id -= 26;
|
||||||
|
}
|
||||||
|
return _id;
|
||||||
|
}
|
||||||
|
QT_WARNING_POP
|
||||||
|
QT_END_MOC_NAMESPACE
|
||||||
BIN
moc_mainwindow.o
Normal file
BIN
moc_mainwindow.o
Normal file
Binary file not shown.
434
moc_predefs.h
Normal file
434
moc_predefs.h
Normal file
@@ -0,0 +1,434 @@
|
|||||||
|
#define __DBL_MIN_EXP__ (-1021)
|
||||||
|
#define __UINT_LEAST16_MAX__ 0xffff
|
||||||
|
#define __FLT16_HAS_QUIET_NAN__ 1
|
||||||
|
#define __ATOMIC_ACQUIRE 2
|
||||||
|
#define __FLT128_MAX_10_EXP__ 4932
|
||||||
|
#define __FLT_MIN__ 1.17549435082228750796873653722224568e-38F
|
||||||
|
#define __GCC_IEC_559_COMPLEX 2
|
||||||
|
#define __UINT_LEAST8_TYPE__ unsigned char
|
||||||
|
#define __SIZEOF_FLOAT80__ 16
|
||||||
|
#define __BFLT16_DENORM_MIN__ 9.18354961579912115600575419704879436e-41BF16
|
||||||
|
#define __INTMAX_C(c) c ## L
|
||||||
|
#define __CHAR_BIT__ 8
|
||||||
|
#define __UINT8_MAX__ 0xff
|
||||||
|
#define __SCHAR_WIDTH__ 8
|
||||||
|
#define __WINT_MAX__ 0xffffffffU
|
||||||
|
#define __FLT32_MIN_EXP__ (-125)
|
||||||
|
#define __cpp_static_assert 200410L
|
||||||
|
#define __BFLT16_MIN_10_EXP__ (-37)
|
||||||
|
#define __ORDER_LITTLE_ENDIAN__ 1234
|
||||||
|
#define __WCHAR_MAX__ 0x7fffffff
|
||||||
|
#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 1
|
||||||
|
#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1
|
||||||
|
#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 1
|
||||||
|
#define __GCC_ATOMIC_CHAR_LOCK_FREE 2
|
||||||
|
#define __GCC_IEC_559 2
|
||||||
|
#define __FLT32X_DECIMAL_DIG__ 17
|
||||||
|
#define __FLT_EVAL_METHOD__ 0
|
||||||
|
#define __cpp_binary_literals 201304L
|
||||||
|
#define __FLT64_DECIMAL_DIG__ 17
|
||||||
|
#define __GCC_ATOMIC_CHAR32_T_LOCK_FREE 2
|
||||||
|
#define __cpp_variadic_templates 200704L
|
||||||
|
#define __UINT_FAST64_MAX__ 0xffffffffffffffffUL
|
||||||
|
#define __SIG_ATOMIC_TYPE__ int
|
||||||
|
#define __DBL_MIN_10_EXP__ (-307)
|
||||||
|
#define __FINITE_MATH_ONLY__ 0
|
||||||
|
#define __FLT32X_MAX_EXP__ 1024
|
||||||
|
#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1
|
||||||
|
#define __FLT32_HAS_DENORM__ 1
|
||||||
|
#define __UINT_FAST8_MAX__ 0xff
|
||||||
|
#define __cpp_rvalue_reference 200610L
|
||||||
|
#define __FLT32_MAX_10_EXP__ 38
|
||||||
|
#define __DEC64_MAX_EXP__ 385
|
||||||
|
#define __INT8_C(c) c
|
||||||
|
#define __LDBL_HAS_INFINITY__ 1
|
||||||
|
#define __INT_LEAST8_WIDTH__ 8
|
||||||
|
#define __UINT_LEAST64_MAX__ 0xffffffffffffffffUL
|
||||||
|
#define __INT_LEAST8_MAX__ 0x7f
|
||||||
|
#define __cpp_attributes 200809L
|
||||||
|
#define __SHRT_MAX__ 0x7fff
|
||||||
|
#define __LDBL_MAX__ 1.18973149535723176502126385303097021e+4932L
|
||||||
|
#define __FLT64X_MAX_10_EXP__ 4932
|
||||||
|
#define __BFLT16_MAX_10_EXP__ 38
|
||||||
|
#define __BFLT16_MAX_EXP__ 128
|
||||||
|
#define __LDBL_IS_IEC_60559__ 1
|
||||||
|
#define __FLT64X_HAS_QUIET_NAN__ 1
|
||||||
|
#define __UINT_LEAST8_MAX__ 0xff
|
||||||
|
#define __GCC_ATOMIC_BOOL_LOCK_FREE 2
|
||||||
|
#define __FLT128_DENORM_MIN__ 6.47517511943802511092443895822764655e-4966F128
|
||||||
|
#define __UINTMAX_TYPE__ long unsigned int
|
||||||
|
#define __cpp_nsdmi 200809L
|
||||||
|
#define __BFLT16_DECIMAL_DIG__ 4
|
||||||
|
#define __linux 1
|
||||||
|
#define __DEC32_EPSILON__ 1E-6DF
|
||||||
|
#define __FLT_EVAL_METHOD_TS_18661_3__ 0
|
||||||
|
#define __OPTIMIZE__ 1
|
||||||
|
#define __UINT32_MAX__ 0xffffffffU
|
||||||
|
#define __GXX_EXPERIMENTAL_CXX0X__ 1
|
||||||
|
#define __DBL_DENORM_MIN__ double(4.94065645841246544176568792868221372e-324L)
|
||||||
|
#define __FLT128_MIN_EXP__ (-16381)
|
||||||
|
#define __WINT_MIN__ 0U
|
||||||
|
#define __FLT128_MIN_10_EXP__ (-4931)
|
||||||
|
#define __FLT32X_IS_IEC_60559__ 1
|
||||||
|
#define __INT_LEAST16_WIDTH__ 16
|
||||||
|
#define __SCHAR_MAX__ 0x7f
|
||||||
|
#define __FLT128_MANT_DIG__ 113
|
||||||
|
#define __WCHAR_MIN__ (-__WCHAR_MAX__ - 1)
|
||||||
|
#define __INT64_C(c) c ## L
|
||||||
|
#define __GCC_ATOMIC_POINTER_LOCK_FREE 2
|
||||||
|
#define __ATOMIC_SEQ_CST 5
|
||||||
|
#define __unix 1
|
||||||
|
#define __INT_LEAST64_MAX__ 0x7fffffffffffffffL
|
||||||
|
#define __FLT32X_MANT_DIG__ 53
|
||||||
|
#define __GCC_ATOMIC_CHAR16_T_LOCK_FREE 2
|
||||||
|
#define __FLT64X_EPSILON__ 1.08420217248550443400745280086994171e-19F64x
|
||||||
|
#define __STDC_HOSTED__ 1
|
||||||
|
#define __DEC64_MIN_EXP__ (-382)
|
||||||
|
#define __DBL_DIG__ 15
|
||||||
|
#define __FLT_EPSILON__ 1.19209289550781250000000000000000000e-7F
|
||||||
|
#define __GXX_WEAK__ 1
|
||||||
|
#define __SHRT_WIDTH__ 16
|
||||||
|
#define __FLT32_IS_IEC_60559__ 1
|
||||||
|
#define __LDBL_MIN__ 3.36210314311209350626267781732175260e-4932L
|
||||||
|
#define __DBL_IS_IEC_60559__ 1
|
||||||
|
#define __DEC32_MAX__ 9.999999E96DF
|
||||||
|
#define __cpp_threadsafe_static_init 200806L
|
||||||
|
#define __FLT64X_DENORM_MIN__ 3.64519953188247460252840593361941982e-4951F64x
|
||||||
|
#define __FLT32X_HAS_INFINITY__ 1
|
||||||
|
#define __unix__ 1
|
||||||
|
#define __INT_WIDTH__ 32
|
||||||
|
#define __STDC_IEC_559__ 1
|
||||||
|
#define __STDC_ISO_10646__ 201706L
|
||||||
|
#define __DECIMAL_DIG__ 21
|
||||||
|
#define __STDC_IEC_559_COMPLEX__ 1
|
||||||
|
#define __FLT64_EPSILON__ 2.22044604925031308084726333618164062e-16F64
|
||||||
|
#define __gnu_linux__ 1
|
||||||
|
#define __INT16_MAX__ 0x7fff
|
||||||
|
#define __FLT64_MIN_EXP__ (-1021)
|
||||||
|
#define __FLT64X_MIN_10_EXP__ (-4931)
|
||||||
|
#define __LDBL_HAS_QUIET_NAN__ 1
|
||||||
|
#define __FLT16_MIN_EXP__ (-13)
|
||||||
|
#define __FLT64_MANT_DIG__ 53
|
||||||
|
#define __FLT64X_MANT_DIG__ 64
|
||||||
|
#define __BFLT16_DIG__ 2
|
||||||
|
#define __GNUC__ 14
|
||||||
|
#define __GXX_RTTI 1
|
||||||
|
#define __pie__ 2
|
||||||
|
#define __MMX__ 1
|
||||||
|
#define __FLT_HAS_DENORM__ 1
|
||||||
|
#define __SIZEOF_LONG_DOUBLE__ 16
|
||||||
|
#define __BIGGEST_ALIGNMENT__ 16
|
||||||
|
#define __STDC_UTF_16__ 1
|
||||||
|
#define __FLT64_MAX_10_EXP__ 308
|
||||||
|
#define __BFLT16_IS_IEC_60559__ 0
|
||||||
|
#define __FLT16_MAX_10_EXP__ 4
|
||||||
|
#define __cpp_delegating_constructors 200604L
|
||||||
|
#define __DBL_MAX__ double(1.79769313486231570814527423731704357e+308L)
|
||||||
|
#define __cpp_raw_strings 200710L
|
||||||
|
#define __INT_FAST32_MAX__ 0x7fffffffffffffffL
|
||||||
|
#define __DBL_HAS_INFINITY__ 1
|
||||||
|
#define __INT64_MAX__ 0x7fffffffffffffffL
|
||||||
|
#define __SIZEOF_FLOAT__ 4
|
||||||
|
#define __HAVE_SPECULATION_SAFE_VALUE 1
|
||||||
|
#define __DEC32_MIN_EXP__ (-94)
|
||||||
|
#define __INTPTR_WIDTH__ 64
|
||||||
|
#define __UINT_LEAST32_MAX__ 0xffffffffU
|
||||||
|
#define __FLT32X_HAS_DENORM__ 1
|
||||||
|
#define __INT_FAST16_TYPE__ long int
|
||||||
|
#define __MMX_WITH_SSE__ 1
|
||||||
|
#define __LDBL_HAS_DENORM__ 1
|
||||||
|
#define __SEG_GS 1
|
||||||
|
#define __BFLT16_EPSILON__ 7.81250000000000000000000000000000000e-3BF16
|
||||||
|
#define __cplusplus 201103L
|
||||||
|
#define __cpp_ref_qualifiers 200710L
|
||||||
|
#define __DEC32_MIN__ 1E-95DF
|
||||||
|
#define __DEPRECATED 1
|
||||||
|
#define __cpp_rvalue_references 200610L
|
||||||
|
#define __DBL_MAX_EXP__ 1024
|
||||||
|
#define __WCHAR_WIDTH__ 32
|
||||||
|
#define __FLT32_MAX__ 3.40282346638528859811704183484516925e+38F32
|
||||||
|
#define __DEC128_EPSILON__ 1E-33DL
|
||||||
|
#define __FLT16_DECIMAL_DIG__ 5
|
||||||
|
#define __SSE2_MATH__ 1
|
||||||
|
#define __ATOMIC_HLE_RELEASE 131072
|
||||||
|
#define __PTRDIFF_MAX__ 0x7fffffffffffffffL
|
||||||
|
#define __amd64 1
|
||||||
|
#define __ATOMIC_HLE_ACQUIRE 65536
|
||||||
|
#define __GNUG__ 14
|
||||||
|
#define __LONG_LONG_MAX__ 0x7fffffffffffffffLL
|
||||||
|
#define __SIZEOF_SIZE_T__ 8
|
||||||
|
#define __BFLT16_HAS_INFINITY__ 1
|
||||||
|
#define __FLT64X_MIN_EXP__ (-16381)
|
||||||
|
#define __SIZEOF_WINT_T__ 4
|
||||||
|
#define __FLT32X_DIG__ 15
|
||||||
|
#define __LONG_LONG_WIDTH__ 64
|
||||||
|
#define __cpp_initializer_lists 200806L
|
||||||
|
#define __FLT32_MAX_EXP__ 128
|
||||||
|
#define __cpp_hex_float 201603L
|
||||||
|
#define __GXX_ABI_VERSION 1019
|
||||||
|
#define __FLT_MIN_EXP__ (-125)
|
||||||
|
#define __GCC_HAVE_DWARF2_CFI_ASM 1
|
||||||
|
#define __x86_64 1
|
||||||
|
#define __cpp_lambdas 200907L
|
||||||
|
#define __INT_FAST64_TYPE__ long int
|
||||||
|
#define __BFLT16_MAX__ 3.38953138925153547590470800371487867e+38BF16
|
||||||
|
#define __FLT64_DENORM_MIN__ 4.94065645841246544176568792868221372e-324F64
|
||||||
|
#define __FLT16_DENORM_MIN__ 5.96046447753906250000000000000000000e-8F16
|
||||||
|
#define __FLT128_EPSILON__ 1.92592994438723585305597794258492732e-34F128
|
||||||
|
#define __FLT64X_NORM_MAX__ 1.18973149535723176502126385303097021e+4932F64x
|
||||||
|
#define __SIZEOF_POINTER__ 8
|
||||||
|
#define __SIZE_TYPE__ long unsigned int
|
||||||
|
#define __LP64__ 1
|
||||||
|
#define __DBL_HAS_QUIET_NAN__ 1
|
||||||
|
#define __FLT32X_EPSILON__ 2.22044604925031308084726333618164062e-16F32x
|
||||||
|
#define __LDBL_MAX_EXP__ 16384
|
||||||
|
#define __DECIMAL_BID_FORMAT__ 1
|
||||||
|
#define __FLT64_MIN_10_EXP__ (-307)
|
||||||
|
#define __FLT16_MIN_10_EXP__ (-4)
|
||||||
|
#define __FLT64X_DECIMAL_DIG__ 21
|
||||||
|
#define __DEC128_MIN__ 1E-6143DL
|
||||||
|
#define __REGISTER_PREFIX__
|
||||||
|
#define __UINT16_MAX__ 0xffff
|
||||||
|
#define __FLT128_HAS_INFINITY__ 1
|
||||||
|
#define __FLT32_MIN__ 1.17549435082228750796873653722224568e-38F32
|
||||||
|
#define __UINT8_TYPE__ unsigned char
|
||||||
|
#define __FLT_DIG__ 6
|
||||||
|
#define __DEC_EVAL_METHOD__ 2
|
||||||
|
#define __FLT_MANT_DIG__ 24
|
||||||
|
#define __LDBL_DECIMAL_DIG__ 21
|
||||||
|
#define __VERSION__ "14.2.0"
|
||||||
|
#define __UINT64_C(c) c ## UL
|
||||||
|
#define __cpp_unicode_characters 200704L
|
||||||
|
#define _STDC_PREDEF_H 1
|
||||||
|
#define __INT_LEAST32_MAX__ 0x7fffffff
|
||||||
|
#define __GCC_ATOMIC_INT_LOCK_FREE 2
|
||||||
|
#define __FLT128_MAX_EXP__ 16384
|
||||||
|
#define __FLT32_MANT_DIG__ 24
|
||||||
|
#define __FLOAT_WORD_ORDER__ __ORDER_LITTLE_ENDIAN__
|
||||||
|
#define __FLT32X_MIN_EXP__ (-1021)
|
||||||
|
#define __STDC_IEC_60559_COMPLEX__ 201404L
|
||||||
|
#define __BFLT16_MIN__ 1.17549435082228750796873653722224568e-38BF16
|
||||||
|
#define __FLT128_HAS_DENORM__ 1
|
||||||
|
#define __FLT32_DECIMAL_DIG__ 9
|
||||||
|
#define __FLT128_DIG__ 33
|
||||||
|
#define __INT32_C(c) c
|
||||||
|
#define __DEC64_EPSILON__ 1E-15DD
|
||||||
|
#define __ORDER_PDP_ENDIAN__ 3412
|
||||||
|
#define __DEC128_MIN_EXP__ (-6142)
|
||||||
|
#define __DEC128_MAX__ 9.999999999999999999999999999999999E6144DL
|
||||||
|
#define __INT_FAST32_TYPE__ long int
|
||||||
|
#define __UINT_LEAST16_TYPE__ short unsigned int
|
||||||
|
#define __DEC128_MAX_EXP__ 6145
|
||||||
|
#define unix 1
|
||||||
|
#define __DBL_HAS_DENORM__ 1
|
||||||
|
#define __cpp_rtti 199711L
|
||||||
|
#define __UINT64_MAX__ 0xffffffffffffffffUL
|
||||||
|
#define __FLT_IS_IEC_60559__ 1
|
||||||
|
#define __GNUC_WIDE_EXECUTION_CHARSET_NAME "UTF-32LE"
|
||||||
|
#define __FLT64X_DIG__ 18
|
||||||
|
#define __INT8_TYPE__ signed char
|
||||||
|
#define __ELF__ 1
|
||||||
|
#define __GCC_ASM_FLAG_OUTPUTS__ 1
|
||||||
|
#define __UINT32_TYPE__ unsigned int
|
||||||
|
#define __BFLT16_HAS_QUIET_NAN__ 1
|
||||||
|
#define __FLT_RADIX__ 2
|
||||||
|
#define __INT_LEAST16_TYPE__ short int
|
||||||
|
#define __LDBL_EPSILON__ 1.08420217248550443400745280086994171e-19L
|
||||||
|
#define __UINTMAX_C(c) c ## UL
|
||||||
|
#define __FLT16_DIG__ 3
|
||||||
|
#define __k8 1
|
||||||
|
#define __FLT32X_MIN__ 2.22507385850720138309023271733240406e-308F32x
|
||||||
|
#define __SIG_ATOMIC_MAX__ 0x7fffffff
|
||||||
|
#define __cpp_constexpr 200704L
|
||||||
|
#define __GCC_ATOMIC_WCHAR_T_LOCK_FREE 2
|
||||||
|
#define __USER_LABEL_PREFIX__
|
||||||
|
#define __STDC_IEC_60559_BFP__ 201404L
|
||||||
|
#define __SIZEOF_PTRDIFF_T__ 8
|
||||||
|
#define __FLT64X_HAS_INFINITY__ 1
|
||||||
|
#define __SIZEOF_LONG__ 8
|
||||||
|
#define __LDBL_DIG__ 18
|
||||||
|
#define __FLT64_IS_IEC_60559__ 1
|
||||||
|
#define __x86_64__ 1
|
||||||
|
#define __FLT16_IS_IEC_60559__ 1
|
||||||
|
#define __FLT16_MAX_EXP__ 16
|
||||||
|
#define __DEC32_SUBNORMAL_MIN__ 0.000001E-95DF
|
||||||
|
#define __INT_FAST16_MAX__ 0x7fffffffffffffffL
|
||||||
|
#define __GCC_CONSTRUCTIVE_SIZE 64
|
||||||
|
#define __FLT64_DIG__ 15
|
||||||
|
#define __UINT_FAST32_MAX__ 0xffffffffffffffffUL
|
||||||
|
#define __UINT_LEAST64_TYPE__ long unsigned int
|
||||||
|
#define __FLT16_EPSILON__ 9.76562500000000000000000000000000000e-4F16
|
||||||
|
#define __FLT_HAS_QUIET_NAN__ 1
|
||||||
|
#define __FLT_MAX_10_EXP__ 38
|
||||||
|
#define __FLT64X_HAS_DENORM__ 1
|
||||||
|
#define __DEC128_SUBNORMAL_MIN__ 0.000000000000000000000000000000001E-6143DL
|
||||||
|
#define __FLT_HAS_INFINITY__ 1
|
||||||
|
#define __GNUC_EXECUTION_CHARSET_NAME "UTF-8"
|
||||||
|
#define __cpp_unicode_literals 200710L
|
||||||
|
#define __UINT_FAST16_TYPE__ long unsigned int
|
||||||
|
#define __DEC64_MAX__ 9.999999999999999E384DD
|
||||||
|
#define __INT_FAST32_WIDTH__ 64
|
||||||
|
#define __CHAR16_TYPE__ short unsigned int
|
||||||
|
#define __PRAGMA_REDEFINE_EXTNAME 1
|
||||||
|
#define __SIZE_WIDTH__ 64
|
||||||
|
#define __SEG_FS 1
|
||||||
|
#define __INT_LEAST16_MAX__ 0x7fff
|
||||||
|
#define __FLT16_NORM_MAX__ 6.55040000000000000000000000000000000e+4F16
|
||||||
|
#define __DEC64_MANT_DIG__ 16
|
||||||
|
#define __FLT32_DENORM_MIN__ 1.40129846432481707092372958328991613e-45F32
|
||||||
|
#define __SIG_ATOMIC_WIDTH__ 32
|
||||||
|
#define __INT_LEAST64_TYPE__ long int
|
||||||
|
#define __INT16_TYPE__ short int
|
||||||
|
#define __INT_LEAST8_TYPE__ signed char
|
||||||
|
#define __FLT16_MAX__ 6.55040000000000000000000000000000000e+4F16
|
||||||
|
#define __FLT128_MIN__ 3.36210314311209350626267781732175260e-4932F128
|
||||||
|
#define __SIZEOF_INT__ 4
|
||||||
|
#define __DEC32_MAX_EXP__ 97
|
||||||
|
#define __INT_FAST8_MAX__ 0x7f
|
||||||
|
#define __FLT128_MAX__ 1.18973149535723176508575932662800702e+4932F128
|
||||||
|
#define __INTPTR_MAX__ 0x7fffffffffffffffL
|
||||||
|
#define linux 1
|
||||||
|
#define __FLT64_HAS_QUIET_NAN__ 1
|
||||||
|
#define __FLT32_MIN_10_EXP__ (-37)
|
||||||
|
#define __EXCEPTIONS 1
|
||||||
|
#define __UINT16_C(c) c
|
||||||
|
#define __PTRDIFF_WIDTH__ 64
|
||||||
|
#define __LDBL_MANT_DIG__ 64
|
||||||
|
#define __cpp_range_based_for 200907L
|
||||||
|
#define __INT_FAST16_WIDTH__ 64
|
||||||
|
#define __FLT64_HAS_INFINITY__ 1
|
||||||
|
#define __FLT64X_MAX__ 1.18973149535723176502126385303097021e+4932F64x
|
||||||
|
#define __FLT16_HAS_INFINITY__ 1
|
||||||
|
#define __SIG_ATOMIC_MIN__ (-__SIG_ATOMIC_MAX__ - 1)
|
||||||
|
#define __code_model_small__ 1
|
||||||
|
#define __GCC_ATOMIC_LONG_LOCK_FREE 2
|
||||||
|
#define __DEC32_MANT_DIG__ 7
|
||||||
|
#define __k8__ 1
|
||||||
|
#define __INTPTR_TYPE__ long int
|
||||||
|
#define __UINT16_TYPE__ short unsigned int
|
||||||
|
#define __WCHAR_TYPE__ int
|
||||||
|
#define __pic__ 2
|
||||||
|
#define __UINTPTR_MAX__ 0xffffffffffffffffUL
|
||||||
|
#define __INT_FAST64_WIDTH__ 64
|
||||||
|
#define __cpp_decltype 200707L
|
||||||
|
#define __INT_FAST64_MAX__ 0x7fffffffffffffffL
|
||||||
|
#define __GCC_ATOMIC_TEST_AND_SET_TRUEVAL 1
|
||||||
|
#define __FLT_NORM_MAX__ 3.40282346638528859811704183484516925e+38F
|
||||||
|
#define __FLT32_HAS_INFINITY__ 1
|
||||||
|
#define __FLT64X_MAX_EXP__ 16384
|
||||||
|
#define __UINT_FAST64_TYPE__ long unsigned int
|
||||||
|
#define __BFLT16_MIN_EXP__ (-125)
|
||||||
|
#define __INT_MAX__ 0x7fffffff
|
||||||
|
#define __linux__ 1
|
||||||
|
#define __INT64_TYPE__ long int
|
||||||
|
#define __FLT_MAX_EXP__ 128
|
||||||
|
#define __ORDER_BIG_ENDIAN__ 4321
|
||||||
|
#define __DBL_MANT_DIG__ 53
|
||||||
|
#define __cpp_inheriting_constructors 201511L
|
||||||
|
#define __SIZEOF_FLOAT128__ 16
|
||||||
|
#define __BFLT16_MANT_DIG__ 8
|
||||||
|
#define __DEC64_MIN__ 1E-383DD
|
||||||
|
#define __WINT_TYPE__ unsigned int
|
||||||
|
#define __UINT_LEAST32_TYPE__ unsigned int
|
||||||
|
#define __SIZEOF_SHORT__ 2
|
||||||
|
#define __FLT32_NORM_MAX__ 3.40282346638528859811704183484516925e+38F32
|
||||||
|
#define __SSE__ 1
|
||||||
|
#define __LDBL_MIN_EXP__ (-16381)
|
||||||
|
#define __FLT64_MAX__ 1.79769313486231570814527423731704357e+308F64
|
||||||
|
#define __amd64__ 1
|
||||||
|
#define __WINT_WIDTH__ 32
|
||||||
|
#define __INT_LEAST64_WIDTH__ 64
|
||||||
|
#define __FLT32X_MAX_10_EXP__ 308
|
||||||
|
#define __SIZEOF_INT128__ 16
|
||||||
|
#define __FLT16_MIN__ 6.10351562500000000000000000000000000e-5F16
|
||||||
|
#define __FLT64X_IS_IEC_60559__ 1
|
||||||
|
#define __LDBL_MAX_10_EXP__ 4932
|
||||||
|
#define __ATOMIC_RELAXED 0
|
||||||
|
#define __DBL_EPSILON__ double(2.22044604925031308084726333618164062e-16L)
|
||||||
|
#define __INT_LEAST32_TYPE__ int
|
||||||
|
#define _LP64 1
|
||||||
|
#define __UINT8_C(c) c
|
||||||
|
#define __FLT64_MAX_EXP__ 1024
|
||||||
|
#define __SIZEOF_WCHAR_T__ 4
|
||||||
|
#define __GNUC_PATCHLEVEL__ 0
|
||||||
|
#define __FLT128_NORM_MAX__ 1.18973149535723176508575932662800702e+4932F128
|
||||||
|
#define __FLT64_NORM_MAX__ 1.79769313486231570814527423731704357e+308F64
|
||||||
|
#define __FLT128_HAS_QUIET_NAN__ 1
|
||||||
|
#define __INTMAX_MAX__ 0x7fffffffffffffffL
|
||||||
|
#define __INT_FAST8_TYPE__ signed char
|
||||||
|
#define __FLT64X_MIN__ 3.36210314311209350626267781732175260e-4932F64x
|
||||||
|
#define __STDCPP_THREADS__ 1
|
||||||
|
#define __BFLT16_HAS_DENORM__ 1
|
||||||
|
#define __GNUC_STDC_INLINE__ 1
|
||||||
|
#define __FLT64_HAS_DENORM__ 1
|
||||||
|
#define __FLT32_EPSILON__ 1.19209289550781250000000000000000000e-7F32
|
||||||
|
#define __FLT16_HAS_DENORM__ 1
|
||||||
|
#define __DBL_DECIMAL_DIG__ 17
|
||||||
|
#define __STDC_UTF_32__ 1
|
||||||
|
#define __INT_FAST8_WIDTH__ 8
|
||||||
|
#define __FXSR__ 1
|
||||||
|
#define __FLT32X_MAX__ 1.79769313486231570814527423731704357e+308F32x
|
||||||
|
#define __DBL_NORM_MAX__ double(1.79769313486231570814527423731704357e+308L)
|
||||||
|
#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__
|
||||||
|
#define __GCC_DESTRUCTIVE_SIZE 64
|
||||||
|
#define __INTMAX_WIDTH__ 64
|
||||||
|
#define __cpp_runtime_arrays 198712L
|
||||||
|
#define __FLT32_DIG__ 6
|
||||||
|
#define __UINT64_TYPE__ long unsigned int
|
||||||
|
#define __UINT32_C(c) c ## U
|
||||||
|
#define __cpp_alias_templates 200704L
|
||||||
|
#define __FLT_DENORM_MIN__ 1.40129846432481707092372958328991613e-45F
|
||||||
|
#define __FLT128_IS_IEC_60559__ 1
|
||||||
|
#define __INT8_MAX__ 0x7f
|
||||||
|
#define __LONG_WIDTH__ 64
|
||||||
|
#define __DBL_MIN__ double(2.22507385850720138309023271733240406e-308L)
|
||||||
|
#define __PIC__ 2
|
||||||
|
#define __INT32_MAX__ 0x7fffffff
|
||||||
|
#define __UINT_FAST32_TYPE__ long unsigned int
|
||||||
|
#define __FLT16_MANT_DIG__ 11
|
||||||
|
#define __FLT32X_NORM_MAX__ 1.79769313486231570814527423731704357e+308F32x
|
||||||
|
#define __CHAR32_TYPE__ unsigned int
|
||||||
|
#define __FLT_MAX__ 3.40282346638528859811704183484516925e+38F
|
||||||
|
#define __SSE2__ 1
|
||||||
|
#define __BFLT16_NORM_MAX__ 3.38953138925153547590470800371487867e+38BF16
|
||||||
|
#define __INT32_TYPE__ int
|
||||||
|
#define __SIZEOF_DOUBLE__ 8
|
||||||
|
#define __cpp_exceptions 199711L
|
||||||
|
#define __FLT_MIN_10_EXP__ (-37)
|
||||||
|
#define __FLT64_MIN__ 2.22507385850720138309023271733240406e-308F64
|
||||||
|
#define __INT_LEAST32_WIDTH__ 32
|
||||||
|
#define __INTMAX_TYPE__ long int
|
||||||
|
#define __GLIBCXX_BITSIZE_INT_N_0 128
|
||||||
|
#define __FLT32X_HAS_QUIET_NAN__ 1
|
||||||
|
#define __ATOMIC_CONSUME 1
|
||||||
|
#define __GNUC_MINOR__ 2
|
||||||
|
#define __GLIBCXX_TYPE_INT_N_0 __int128
|
||||||
|
#define __UINTMAX_MAX__ 0xffffffffffffffffUL
|
||||||
|
#define __PIE__ 2
|
||||||
|
#define __FLT32X_DENORM_MIN__ 4.94065645841246544176568792868221372e-324F32x
|
||||||
|
#define __DBL_MAX_10_EXP__ 308
|
||||||
|
#define __LDBL_DENORM_MIN__ 3.64519953188247460252840593361941982e-4951L
|
||||||
|
#define __INT16_C(c) c
|
||||||
|
#define __STDC__ 1
|
||||||
|
#define __PTRDIFF_TYPE__ long int
|
||||||
|
#define __LONG_MAX__ 0x7fffffffffffffffL
|
||||||
|
#define __FLT32X_MIN_10_EXP__ (-307)
|
||||||
|
#define __UINTPTR_TYPE__ long unsigned int
|
||||||
|
#define __DEC64_SUBNORMAL_MIN__ 0.000000000000001E-383DD
|
||||||
|
#define __DEC128_MANT_DIG__ 34
|
||||||
|
#define __LDBL_MIN_10_EXP__ (-4931)
|
||||||
|
#define __SSE_MATH__ 1
|
||||||
|
#define __SIZEOF_LONG_LONG__ 8
|
||||||
|
#define __cpp_user_defined_literals 200809L
|
||||||
|
#define __FLT128_DECIMAL_DIG__ 36
|
||||||
|
#define __GCC_ATOMIC_LLONG_LOCK_FREE 2
|
||||||
|
#define __FLT32_HAS_QUIET_NAN__ 1
|
||||||
|
#define __FLT_DECIMAL_DIG__ 9
|
||||||
|
#define __UINT_FAST16_MAX__ 0xffffffffffffffffUL
|
||||||
|
#define __LDBL_NORM_MAX__ 1.18973149535723176502126385303097021e+4932L
|
||||||
|
#define __GCC_ATOMIC_SHORT_LOCK_FREE 2
|
||||||
|
#define __SIZE_MAX__ 0xffffffffffffffffUL
|
||||||
|
#define __UINT_FAST8_TYPE__ unsigned char
|
||||||
|
#define _GNU_SOURCE 1
|
||||||
|
#define __ATOMIC_ACQ_REL 4
|
||||||
|
#define __ATOMIC_RELEASE 3
|
||||||
134
moc_projectconfig.cpp
Normal file
134
moc_projectconfig.cpp
Normal file
@@ -0,0 +1,134 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
** Meta object code from reading C++ file 'projectconfig.h'
|
||||||
|
**
|
||||||
|
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.15.15)
|
||||||
|
**
|
||||||
|
** WARNING! All changes made in this file will be lost!
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
#include "src/projectconfig.h"
|
||||||
|
#include <QtCore/qbytearray.h>
|
||||||
|
#include <QtCore/qmetatype.h>
|
||||||
|
#if !defined(Q_MOC_OUTPUT_REVISION)
|
||||||
|
#error "The header file 'projectconfig.h' doesn't include <QObject>."
|
||||||
|
#elif Q_MOC_OUTPUT_REVISION != 67
|
||||||
|
#error "This file was generated using the moc from 5.15.15. It"
|
||||||
|
#error "cannot be used with the include files from this version of Qt."
|
||||||
|
#error "(The moc has changed too much.)"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
QT_BEGIN_MOC_NAMESPACE
|
||||||
|
QT_WARNING_PUSH
|
||||||
|
QT_WARNING_DISABLE_DEPRECATED
|
||||||
|
struct qt_meta_stringdata_ProjectConfig_t {
|
||||||
|
QByteArrayData data[3];
|
||||||
|
char stringdata0[29];
|
||||||
|
};
|
||||||
|
#define QT_MOC_LITERAL(idx, ofs, len) \
|
||||||
|
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
|
||||||
|
qptrdiff(offsetof(qt_meta_stringdata_ProjectConfig_t, stringdata0) + ofs \
|
||||||
|
- idx * sizeof(QByteArrayData)) \
|
||||||
|
)
|
||||||
|
static const qt_meta_stringdata_ProjectConfig_t qt_meta_stringdata_ProjectConfig = {
|
||||||
|
{
|
||||||
|
QT_MOC_LITERAL(0, 0, 13), // "ProjectConfig"
|
||||||
|
QT_MOC_LITERAL(1, 14, 13), // "configChanged"
|
||||||
|
QT_MOC_LITERAL(2, 28, 0) // ""
|
||||||
|
|
||||||
|
},
|
||||||
|
"ProjectConfig\0configChanged\0"
|
||||||
|
};
|
||||||
|
#undef QT_MOC_LITERAL
|
||||||
|
|
||||||
|
static const uint qt_meta_data_ProjectConfig[] = {
|
||||||
|
|
||||||
|
// content:
|
||||||
|
8, // revision
|
||||||
|
0, // classname
|
||||||
|
0, 0, // classinfo
|
||||||
|
1, 14, // methods
|
||||||
|
0, 0, // properties
|
||||||
|
0, 0, // enums/sets
|
||||||
|
0, 0, // constructors
|
||||||
|
0, // flags
|
||||||
|
1, // signalCount
|
||||||
|
|
||||||
|
// signals: name, argc, parameters, tag, flags
|
||||||
|
1, 0, 19, 2, 0x06 /* Public */,
|
||||||
|
|
||||||
|
// signals: parameters
|
||||||
|
QMetaType::Void,
|
||||||
|
|
||||||
|
0 // eod
|
||||||
|
};
|
||||||
|
|
||||||
|
void ProjectConfig::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
|
||||||
|
{
|
||||||
|
if (_c == QMetaObject::InvokeMetaMethod) {
|
||||||
|
auto *_t = static_cast<ProjectConfig *>(_o);
|
||||||
|
(void)_t;
|
||||||
|
switch (_id) {
|
||||||
|
case 0: _t->configChanged(); break;
|
||||||
|
default: ;
|
||||||
|
}
|
||||||
|
} else if (_c == QMetaObject::IndexOfMethod) {
|
||||||
|
int *result = reinterpret_cast<int *>(_a[0]);
|
||||||
|
{
|
||||||
|
using _t = void (ProjectConfig::*)();
|
||||||
|
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&ProjectConfig::configChanged)) {
|
||||||
|
*result = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
(void)_a;
|
||||||
|
}
|
||||||
|
|
||||||
|
QT_INIT_METAOBJECT const QMetaObject ProjectConfig::staticMetaObject = { {
|
||||||
|
QMetaObject::SuperData::link<QObject::staticMetaObject>(),
|
||||||
|
qt_meta_stringdata_ProjectConfig.data,
|
||||||
|
qt_meta_data_ProjectConfig,
|
||||||
|
qt_static_metacall,
|
||||||
|
nullptr,
|
||||||
|
nullptr
|
||||||
|
} };
|
||||||
|
|
||||||
|
|
||||||
|
const QMetaObject *ProjectConfig::metaObject() const
|
||||||
|
{
|
||||||
|
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
void *ProjectConfig::qt_metacast(const char *_clname)
|
||||||
|
{
|
||||||
|
if (!_clname) return nullptr;
|
||||||
|
if (!strcmp(_clname, qt_meta_stringdata_ProjectConfig.stringdata0))
|
||||||
|
return static_cast<void*>(this);
|
||||||
|
return QObject::qt_metacast(_clname);
|
||||||
|
}
|
||||||
|
|
||||||
|
int ProjectConfig::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
|
||||||
|
{
|
||||||
|
_id = QObject::qt_metacall(_c, _id, _a);
|
||||||
|
if (_id < 0)
|
||||||
|
return _id;
|
||||||
|
if (_c == QMetaObject::InvokeMetaMethod) {
|
||||||
|
if (_id < 1)
|
||||||
|
qt_static_metacall(this, _c, _id, _a);
|
||||||
|
_id -= 1;
|
||||||
|
} else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
|
||||||
|
if (_id < 1)
|
||||||
|
*reinterpret_cast<int*>(_a[0]) = -1;
|
||||||
|
_id -= 1;
|
||||||
|
}
|
||||||
|
return _id;
|
||||||
|
}
|
||||||
|
|
||||||
|
// SIGNAL 0
|
||||||
|
void ProjectConfig::configChanged()
|
||||||
|
{
|
||||||
|
QMetaObject::activate(this, &staticMetaObject, 0, nullptr);
|
||||||
|
}
|
||||||
|
QT_WARNING_POP
|
||||||
|
QT_END_MOC_NAMESPACE
|
||||||
BIN
moc_projectconfig.o
Normal file
BIN
moc_projectconfig.o
Normal file
Binary file not shown.
BIN
projectconfig.o
Normal file
BIN
projectconfig.o
Normal file
Binary file not shown.
293
src/cmakegenerator.cpp
Normal file
293
src/cmakegenerator.cpp
Normal file
@@ -0,0 +1,293 @@
|
|||||||
|
#include "cmakegenerator.h"
|
||||||
|
#include <QFile>
|
||||||
|
#include <QTextStream>
|
||||||
|
#include <QDir>
|
||||||
|
#include <QDateTime>
|
||||||
|
|
||||||
|
CMakeGenerator::CMakeGenerator(QObject *parent)
|
||||||
|
: QObject(parent)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CMakeGenerator::generate(const ProjectConfig *config, const QString &outputPath)
|
||||||
|
{
|
||||||
|
if (!config) {
|
||||||
|
emit errorOccurred("配置对象为空");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString content = generateContent(config);
|
||||||
|
|
||||||
|
QFileInfo fileInfo(outputPath);
|
||||||
|
QDir dir = fileInfo.absoluteDir();
|
||||||
|
if (!dir.exists()) {
|
||||||
|
dir.mkpath(".");
|
||||||
|
}
|
||||||
|
|
||||||
|
QFile file(outputPath);
|
||||||
|
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||||
|
emit errorOccurred("无法创建 CMakeLists.txt: " + file.errorString());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
QTextStream out(&file);
|
||||||
|
out.setCodec("UTF-8");
|
||||||
|
out << content;
|
||||||
|
file.close();
|
||||||
|
|
||||||
|
m_lastGeneratedPath = outputPath;
|
||||||
|
emit cmakeGenerated(outputPath);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString CMakeGenerator::getLastGeneratedPath() const
|
||||||
|
{
|
||||||
|
return m_lastGeneratedPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString CMakeGenerator::generateContent(const ProjectConfig *config)
|
||||||
|
{
|
||||||
|
QString content;
|
||||||
|
|
||||||
|
content += generateHeader(config);
|
||||||
|
content += "\n";
|
||||||
|
content += generateProjectConfig(config);
|
||||||
|
content += "\n";
|
||||||
|
content += generateSourceFiles(config);
|
||||||
|
content += "\n";
|
||||||
|
content += generateIncludeDirs(config);
|
||||||
|
content += "\n";
|
||||||
|
content += generateLibraries(config);
|
||||||
|
content += "\n";
|
||||||
|
content += generateDefines(config);
|
||||||
|
content += "\n";
|
||||||
|
content += generateCompilerOptions(config);
|
||||||
|
content += "\n";
|
||||||
|
content += generateBuildTargets(config);
|
||||||
|
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString CMakeGenerator::generateHeader(const ProjectConfig *config)
|
||||||
|
{
|
||||||
|
QString header;
|
||||||
|
header += "# ========================================\n";
|
||||||
|
header += "# CMakeLists.txt - VoiletCStudio 自动生成\n";
|
||||||
|
header += "# 工程名称:" + config->getProjectName() + "\n";
|
||||||
|
header += "# 生成时间:" + QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss") + "\n";
|
||||||
|
header += "# 跨平台支持:Windows (MinGW) / Linux (GCC) / macOS (Clang)\n";
|
||||||
|
header += "# ========================================\n\n";
|
||||||
|
|
||||||
|
header += "cmake_minimum_required(VERSION 3.10)\n\n";
|
||||||
|
|
||||||
|
return header;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString CMakeGenerator::generateProjectConfig(const ProjectConfig *config)
|
||||||
|
{
|
||||||
|
QString content;
|
||||||
|
|
||||||
|
QString projectName = config->getProjectName();
|
||||||
|
if (projectName.isEmpty()) {
|
||||||
|
projectName = "UntitledProject";
|
||||||
|
}
|
||||||
|
|
||||||
|
content += "# 项目名称\n";
|
||||||
|
content += "project(" + projectName + " C)\n\n";
|
||||||
|
|
||||||
|
content += "# C 标准\n";
|
||||||
|
content += "set(CMAKE_C_STANDARD 11)\n";
|
||||||
|
content += "set(CMAKE_C_STANDARD_REQUIRED ON)\n\n";
|
||||||
|
|
||||||
|
// 输出目录配置
|
||||||
|
QString outputDir = config->getOutputDir();
|
||||||
|
if (outputDir.isEmpty()) {
|
||||||
|
outputDir = "./build";
|
||||||
|
}
|
||||||
|
|
||||||
|
content += "# 输出目录配置\n";
|
||||||
|
content += "set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/" + outputDir + ")\n";
|
||||||
|
content += "set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/" + outputDir + ")\n";
|
||||||
|
content += "set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/" + outputDir + ")\n\n";
|
||||||
|
|
||||||
|
// 编译器配置
|
||||||
|
content += "# 编译器配置\n";
|
||||||
|
if (!config->getCompilerPath().isEmpty() && config->getCompilerPath() != "gcc") {
|
||||||
|
content += "set(CMAKE_C_COMPILER \"" + config->getCompilerPath() + "\")\n";
|
||||||
|
}
|
||||||
|
content += "\n";
|
||||||
|
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString CMakeGenerator::generateSourceFiles(const ProjectConfig *config)
|
||||||
|
{
|
||||||
|
QString content;
|
||||||
|
content += "# ========================================\n";
|
||||||
|
content += "# 源文件配置(虚拟目录结构)\n";
|
||||||
|
content += "# ========================================\n\n";
|
||||||
|
|
||||||
|
QMap<QString, VirtualDir> virtualDirs = config->getVirtualDirs();
|
||||||
|
|
||||||
|
if (virtualDirs.isEmpty()) {
|
||||||
|
content += "# 无源文件\n";
|
||||||
|
} else {
|
||||||
|
// 遍历虚拟目录
|
||||||
|
for (auto it = virtualDirs.begin(); it != virtualDirs.end(); ++it) {
|
||||||
|
content += "# 分组:" + it.key() + "\n";
|
||||||
|
QString safeName = it.key();
|
||||||
|
safeName.replace(" ", "_");
|
||||||
|
safeName.replace("/", "_");
|
||||||
|
content += "set(SRCS_" + safeName + "\n";
|
||||||
|
for (const QString &file : it->files) {
|
||||||
|
content += " " + file + "\n";
|
||||||
|
}
|
||||||
|
content += ")\n\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
// 合并所有源文件
|
||||||
|
content += "# 合并所有源文件\n";
|
||||||
|
content += "set(SOURCES\n";
|
||||||
|
for (auto it = virtualDirs.begin(); it != virtualDirs.end(); ++it) {
|
||||||
|
for (const QString &file : it->files) {
|
||||||
|
content += " " + file + "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
content += ")\n\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
content += "# 创建可执行文件\n";
|
||||||
|
QString outputName = config->getProjectName();
|
||||||
|
if (outputName.isEmpty()) {
|
||||||
|
outputName = "output";
|
||||||
|
}
|
||||||
|
|
||||||
|
content += "add_executable(" + outputName + " ${SOURCES})\n\n";
|
||||||
|
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString CMakeGenerator::generateIncludeDirs(const ProjectConfig *config)
|
||||||
|
{
|
||||||
|
QString content;
|
||||||
|
content += "# 包含目录\n";
|
||||||
|
|
||||||
|
QStringList includeDirs = config->getIncludeDirs();
|
||||||
|
if (includeDirs.isEmpty()) {
|
||||||
|
content += "# 无额外包含目录\n";
|
||||||
|
} else {
|
||||||
|
content += "target_include_directories(" + config->getProjectName() + " PRIVATE\n";
|
||||||
|
for (const QString &dir : includeDirs) {
|
||||||
|
content += " " + dir + "\n";
|
||||||
|
}
|
||||||
|
content += ")\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString CMakeGenerator::generateLibraries(const ProjectConfig *config)
|
||||||
|
{
|
||||||
|
QString content;
|
||||||
|
content += "# 链接库\n";
|
||||||
|
|
||||||
|
QStringList libraries = config->getLibraries();
|
||||||
|
if (libraries.isEmpty()) {
|
||||||
|
content += "# 无外部库文件\n";
|
||||||
|
} else {
|
||||||
|
content += "target_link_libraries(" + config->getProjectName() + " PRIVATE\n";
|
||||||
|
for (const QString &lib : libraries) {
|
||||||
|
content += " " + lib + "\n";
|
||||||
|
}
|
||||||
|
content += ")\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString CMakeGenerator::generateDefines(const ProjectConfig *config)
|
||||||
|
{
|
||||||
|
QString content;
|
||||||
|
content += "# 预编译宏定义\n";
|
||||||
|
|
||||||
|
QStringList defines = config->getDefines();
|
||||||
|
if (defines.isEmpty()) {
|
||||||
|
content += "# 无额外宏定义\n";
|
||||||
|
} else {
|
||||||
|
content += "target_compile_definitions(" + config->getProjectName() + " PRIVATE\n";
|
||||||
|
for (const QString &def : defines) {
|
||||||
|
content += " " + def + "\n";
|
||||||
|
}
|
||||||
|
content += ")\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString CMakeGenerator::generateCompilerOptions(const ProjectConfig *config)
|
||||||
|
{
|
||||||
|
QString content;
|
||||||
|
content += "# 自定义编译选项\n";
|
||||||
|
|
||||||
|
QStringList options = config->getCompilerOptions();
|
||||||
|
if (options.isEmpty()) {
|
||||||
|
content += "# 无自定义编译选项\n";
|
||||||
|
} else {
|
||||||
|
content += "target_compile_options(" + config->getProjectName() + " PRIVATE\n";
|
||||||
|
for (const QString &opt : options) {
|
||||||
|
content += " " + opt + "\n";
|
||||||
|
}
|
||||||
|
content += ")\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString CMakeGenerator::generateBuildTargets(const ProjectConfig *config)
|
||||||
|
{
|
||||||
|
QString content;
|
||||||
|
|
||||||
|
content += "# ========================================\n";
|
||||||
|
content += "# 构建类型配置\n";
|
||||||
|
content += "# ========================================\n\n";
|
||||||
|
|
||||||
|
content += "# 默认构建类型:Debug\n";
|
||||||
|
content += "if(NOT CMAKE_BUILD_TYPE)\n";
|
||||||
|
content += " set(CMAKE_BUILD_TYPE Debug CACHE STRING \"Build type\" FORCE)\n";
|
||||||
|
content += "endif()\n\n";
|
||||||
|
|
||||||
|
content += "# Debug 模式配置(自动添加 DEBUG 宏)\n";
|
||||||
|
content += "set(CMAKE_C_FLAGS_DEBUG \"-g -O0 -DDEBUG\" CACHE STRING \"Debug flags\" FORCE)\n\n";
|
||||||
|
|
||||||
|
content += "# Release 模式配置\n";
|
||||||
|
content += "set(CMAKE_C_FLAGS_RELEASE \"-O2 -DNDEBUG\" CACHE STRING \"Release flags\" FORCE)\n\n";
|
||||||
|
|
||||||
|
content += "# ========================================\n";
|
||||||
|
content += "# 自定义 Make 目标:make debug / make release\n";
|
||||||
|
content += "# ========================================\n\n";
|
||||||
|
|
||||||
|
content += "# make debug - 编译 Debug 版本(自动添加 DEBUG 宏)\n";
|
||||||
|
content += "add_custom_target(debug\n";
|
||||||
|
content += " COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Debug ${CMAKE_SOURCE_DIR}\n";
|
||||||
|
content += " COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --config Debug\n";
|
||||||
|
content += " COMMENT \"Building Debug version\"\n";
|
||||||
|
content += " VERBATIM\n";
|
||||||
|
content += ")\n\n";
|
||||||
|
|
||||||
|
content += "# make release - 编译 Release 版本\n";
|
||||||
|
content += "add_custom_target(release\n";
|
||||||
|
content += " COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Release ${CMAKE_SOURCE_DIR}\n";
|
||||||
|
content += " COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --config Release\n";
|
||||||
|
content += " COMMENT \"Building Release version\"\n";
|
||||||
|
content += " VERBATIM\n";
|
||||||
|
content += ")\n\n";
|
||||||
|
|
||||||
|
content += "# 使用说明:\n";
|
||||||
|
content += "# cmake -B build # 配置(默认 Debug)\n";
|
||||||
|
content += "# cmake --build build # 编译(使用当前 CMAKE_BUILD_TYPE)\n";
|
||||||
|
content += "# make debug # 编译 Debug 版本(自动添加 DEBUG 宏)\n";
|
||||||
|
content += "# make release # 编译 Release 版本\n";
|
||||||
|
|
||||||
|
return content;
|
||||||
|
}
|
||||||
39
src/cmakegenerator.h
Normal file
39
src/cmakegenerator.h
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
#ifndef CMAKEGENERATOR_H
|
||||||
|
#define CMAKEGENERATOR_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QString>
|
||||||
|
#include "projectconfig.h"
|
||||||
|
|
||||||
|
class CMakeGenerator : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit CMakeGenerator(QObject *parent = nullptr);
|
||||||
|
|
||||||
|
// 生成 CMakeLists.txt
|
||||||
|
bool generate(const ProjectConfig *config, const QString &outputPath);
|
||||||
|
|
||||||
|
// 获取最后生成的路径
|
||||||
|
QString getLastGeneratedPath() const;
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void cmakeGenerated(const QString &path);
|
||||||
|
void errorOccurred(const QString &error);
|
||||||
|
|
||||||
|
private:
|
||||||
|
QString generateContent(const ProjectConfig *config);
|
||||||
|
QString generateHeader(const ProjectConfig *config);
|
||||||
|
QString generateProjectConfig(const ProjectConfig *config);
|
||||||
|
QString generateSourceFiles(const ProjectConfig *config);
|
||||||
|
QString generateIncludeDirs(const ProjectConfig *config);
|
||||||
|
QString generateLibraries(const ProjectConfig *config);
|
||||||
|
QString generateDefines(const ProjectConfig *config);
|
||||||
|
QString generateCompilerOptions(const ProjectConfig *config);
|
||||||
|
QString generateBuildTargets(const ProjectConfig *config);
|
||||||
|
|
||||||
|
QString m_lastGeneratedPath;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CMAKEGENERATOR_H
|
||||||
21
src/main.cpp
Normal file
21
src/main.cpp
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
#include <QApplication>
|
||||||
|
#include <QStyleFactory>
|
||||||
|
#include "mainwindow.h"
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
|
// 设置应用程序信息
|
||||||
|
app.setApplicationName("VoiletCStudio");
|
||||||
|
app.setApplicationVersion("1.0");
|
||||||
|
app.setOrganizationName("LinuxAcme");
|
||||||
|
|
||||||
|
// 设置样式(使用系统原生样式)
|
||||||
|
app.setStyle(QStyleFactory::create("Fusion"));
|
||||||
|
|
||||||
|
MainWindow window;
|
||||||
|
window.show();
|
||||||
|
|
||||||
|
return app.exec();
|
||||||
|
}
|
||||||
855
src/mainwindow.cpp
Normal file
855
src/mainwindow.cpp
Normal file
@@ -0,0 +1,855 @@
|
|||||||
|
#include "mainwindow.h"
|
||||||
|
#include <QMenuBar>
|
||||||
|
#include <QMenu>
|
||||||
|
#include <QAction>
|
||||||
|
#include <QToolBar>
|
||||||
|
#include <QStatusBar>
|
||||||
|
#include <QFileDialog>
|
||||||
|
#include <QMessageBox>
|
||||||
|
#include <QVBoxLayout>
|
||||||
|
#include <QHBoxLayout>
|
||||||
|
#include <QGroupBox>
|
||||||
|
#include <QTreeWidget>
|
||||||
|
#include <QTreeWidgetItem>
|
||||||
|
#include <QInputDialog>
|
||||||
|
#include <QKeySequence>
|
||||||
|
#include <QSplitter>
|
||||||
|
#include <QProcess>
|
||||||
|
#include <QDir>
|
||||||
|
#include <QScrollBar>
|
||||||
|
#include <QDragEnterEvent>
|
||||||
|
#include <QDropEvent>
|
||||||
|
#include <QMimeData>
|
||||||
|
|
||||||
|
MainWindow::MainWindow(QWidget *parent)
|
||||||
|
: QMainWindow(parent)
|
||||||
|
, modified(false)
|
||||||
|
, showCMakeSuccessMsg(true)
|
||||||
|
{
|
||||||
|
config = new ProjectConfig(this);
|
||||||
|
cmakeGenerator = new CMakeGenerator(this);
|
||||||
|
|
||||||
|
setupUI();
|
||||||
|
setupConnections();
|
||||||
|
updateWindowTitle();
|
||||||
|
}
|
||||||
|
|
||||||
|
MainWindow::~MainWindow()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::setupUI()
|
||||||
|
{
|
||||||
|
setWindowTitle("VoiletCStudio - C 工程配置器");
|
||||||
|
resize(1400, 900);
|
||||||
|
|
||||||
|
// 创建操作按钮栏
|
||||||
|
QGroupBox *actionGroup = new QGroupBox("⚡ 快捷操作");
|
||||||
|
QHBoxLayout *actionLayout = new QHBoxLayout(actionGroup);
|
||||||
|
|
||||||
|
QPushButton *openBtn = new QPushButton("📂 打开工程");
|
||||||
|
openBtn->setMinimumHeight(35);
|
||||||
|
openBtn->setStyleSheet("QPushButton { background: #2196F3; color: white; font-weight: bold; }");
|
||||||
|
connect(openBtn, &QPushButton::clicked, this, &MainWindow::openProject);
|
||||||
|
actionLayout->addWidget(openBtn);
|
||||||
|
|
||||||
|
QPushButton *newBtn = new QPushButton("📄 新建工程");
|
||||||
|
newBtn->setMinimumHeight(35);
|
||||||
|
newBtn->setStyleSheet("QPushButton { background: #4CAF50; color: white; font-weight: bold; }");
|
||||||
|
connect(newBtn, &QPushButton::clicked, this, &MainWindow::newProject);
|
||||||
|
actionLayout->addWidget(newBtn);
|
||||||
|
|
||||||
|
saveButton = new QPushButton("💾 保存工程 (Ctrl+S)");
|
||||||
|
saveButton->setMinimumHeight(35);
|
||||||
|
saveButton->setStyleSheet("QPushButton { background: #FF9800; color: white; font-weight: bold; }");
|
||||||
|
connect(saveButton, &QPushButton::clicked, this, &MainWindow::saveProject);
|
||||||
|
actionLayout->addWidget(saveButton);
|
||||||
|
|
||||||
|
generateButton = new QPushButton("🔨 生成 CMake (Ctrl+G)");
|
||||||
|
generateButton->setMinimumHeight(35);
|
||||||
|
generateButton->setStyleSheet("QPushButton { background: #9C27B0; color: white; font-weight: bold; }");
|
||||||
|
connect(generateButton, &QPushButton::clicked, this, &MainWindow::generateCMake);
|
||||||
|
actionLayout->addWidget(generateButton);
|
||||||
|
|
||||||
|
QPushButton *debugBtn = new QPushButton("🐛 编译 Debug");
|
||||||
|
debugBtn->setMinimumHeight(35);
|
||||||
|
debugBtn->setStyleSheet("QPushButton { background: #00BCD4; color: white; font-weight: bold; }");
|
||||||
|
connect(debugBtn, &QPushButton::clicked, this, &MainWindow::compileDebug);
|
||||||
|
actionLayout->addWidget(debugBtn);
|
||||||
|
|
||||||
|
QPushButton *releaseBtn = new QPushButton("🚀 编译 Release");
|
||||||
|
releaseBtn->setMinimumHeight(35);
|
||||||
|
releaseBtn->setStyleSheet("QPushButton { background: #E91E63; color: white; font-weight: bold; }");
|
||||||
|
connect(releaseBtn, &QPushButton::clicked, this, &MainWindow::compileRelease);
|
||||||
|
actionLayout->addWidget(releaseBtn);
|
||||||
|
|
||||||
|
actionLayout->addStretch();
|
||||||
|
|
||||||
|
// 创建中心部件
|
||||||
|
QWidget *central = new QWidget(this);
|
||||||
|
setCentralWidget(central);
|
||||||
|
|
||||||
|
QVBoxLayout *mainLayout = new QVBoxLayout(central);
|
||||||
|
mainLayout->addWidget(actionGroup);
|
||||||
|
|
||||||
|
// 工程基本信息
|
||||||
|
QGroupBox *basicGroup = new QGroupBox("📁 工程基本信息");
|
||||||
|
QHBoxLayout *basicLayout = new QHBoxLayout(basicGroup);
|
||||||
|
|
||||||
|
basicLayout->addWidget(new QLabel("📁 工程名:"));
|
||||||
|
projectNameEdit = new QLineEdit();
|
||||||
|
projectNameEdit->setPlaceholderText("输入工程名称");
|
||||||
|
basicLayout->addWidget(projectNameEdit);
|
||||||
|
|
||||||
|
basicLayout->addStretch();
|
||||||
|
basicLayout->addWidget(new QLabel("📂 工程路径:同 JSON 配置文件所在目录"));
|
||||||
|
|
||||||
|
mainLayout->addWidget(basicGroup);
|
||||||
|
|
||||||
|
// 编译工具链
|
||||||
|
QGroupBox *toolchainGroup = new QGroupBox("🔧 编译工具链");
|
||||||
|
QHBoxLayout *toolchainLayout = new QHBoxLayout(toolchainGroup);
|
||||||
|
|
||||||
|
toolchainLayout->addWidget(new QLabel("编译器:"));
|
||||||
|
compilerPathEdit = new QLineEdit();
|
||||||
|
compilerPathEdit->setPlaceholderText("/usr/bin/gcc");
|
||||||
|
toolchainLayout->addWidget(compilerPathEdit);
|
||||||
|
|
||||||
|
QPushButton *compilerBtn = new QPushButton("浏览");
|
||||||
|
connect(compilerBtn, &QPushButton::clicked, this, &MainWindow::browseCompilerPath);
|
||||||
|
toolchainLayout->addWidget(compilerBtn);
|
||||||
|
|
||||||
|
toolchainLayout->addWidget(new QLabel("汇编器:"));
|
||||||
|
assemblerPathEdit = new QLineEdit();
|
||||||
|
assemblerPathEdit->setPlaceholderText("/usr/bin/gcc");
|
||||||
|
toolchainLayout->addWidget(assemblerPathEdit);
|
||||||
|
|
||||||
|
QPushButton *assemblerBtn = new QPushButton("浏览");
|
||||||
|
connect(assemblerBtn, &QPushButton::clicked, this, &MainWindow::browseAssemblerPath);
|
||||||
|
toolchainLayout->addWidget(assemblerBtn);
|
||||||
|
|
||||||
|
toolchainLayout->addWidget(new QLabel("链接器:"));
|
||||||
|
linkerPathEdit = new QLineEdit();
|
||||||
|
linkerPathEdit->setPlaceholderText("/usr/bin/gcc");
|
||||||
|
toolchainLayout->addWidget(linkerPathEdit);
|
||||||
|
|
||||||
|
QPushButton *linkerBtn = new QPushButton("浏览");
|
||||||
|
connect(linkerBtn, &QPushButton::clicked, this, &MainWindow::browseLinkerPath);
|
||||||
|
toolchainLayout->addWidget(linkerBtn);
|
||||||
|
|
||||||
|
mainLayout->addWidget(toolchainGroup);
|
||||||
|
|
||||||
|
// 主分割器 - 左右布局
|
||||||
|
QSplitter *mainSplitter = new QSplitter(Qt::Horizontal);
|
||||||
|
|
||||||
|
// 左侧 - 文件管理
|
||||||
|
QWidget *leftPanel = new QWidget();
|
||||||
|
QVBoxLayout *leftLayout = new QVBoxLayout(leftPanel);
|
||||||
|
leftLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
|
||||||
|
// 源文件(虚拟目录)
|
||||||
|
QGroupBox *sourceGroup = new QGroupBox("📄 源文件 (.c) - 虚拟目录");
|
||||||
|
QVBoxLayout *sourceLayout = new QVBoxLayout(sourceGroup);
|
||||||
|
|
||||||
|
QHBoxLayout *sourceBtnLayout = new QHBoxLayout();
|
||||||
|
QPushButton *addDirBtn = new QPushButton("➕ 目录");
|
||||||
|
connect(addDirBtn, &QPushButton::clicked, this, &MainWindow::addVirtualDir);
|
||||||
|
sourceBtnLayout->addWidget(addDirBtn);
|
||||||
|
|
||||||
|
QPushButton *addFileBtn = new QPushButton("➕ 文件");
|
||||||
|
connect(addFileBtn, &QPushButton::clicked, this, &MainWindow::addSourceFile);
|
||||||
|
sourceBtnLayout->addWidget(addFileBtn);
|
||||||
|
|
||||||
|
QPushButton *removeFileBtn = new QPushButton("➖ 移除");
|
||||||
|
connect(removeFileBtn, &QPushButton::clicked, this, &MainWindow::removeSourceFile);
|
||||||
|
sourceBtnLayout->addWidget(removeFileBtn);
|
||||||
|
sourceBtnLayout->addStretch();
|
||||||
|
|
||||||
|
sourceLayout->addLayout(sourceBtnLayout);
|
||||||
|
|
||||||
|
sourceTree = new QTreeWidget();
|
||||||
|
sourceTree->setHeaderLabels(QStringList() << "📁 源文件 (虚拟目录)");
|
||||||
|
sourceTree->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||||
|
sourceLayout->addWidget(sourceTree);
|
||||||
|
|
||||||
|
leftLayout->addWidget(sourceGroup);
|
||||||
|
|
||||||
|
// 包含目录
|
||||||
|
QGroupBox *includeGroup = new QGroupBox("📚 包含目录 (.h)");
|
||||||
|
QVBoxLayout *includeLayout = new QVBoxLayout(includeGroup);
|
||||||
|
|
||||||
|
QHBoxLayout *includeBtnLayout = new QHBoxLayout();
|
||||||
|
QPushButton *addIncludeBtn = new QPushButton("➕ 添加");
|
||||||
|
connect(addIncludeBtn, &QPushButton::clicked, this, &MainWindow::addIncludeDir);
|
||||||
|
includeBtnLayout->addWidget(addIncludeBtn);
|
||||||
|
|
||||||
|
QPushButton *removeIncludeBtn = new QPushButton("➖ 移除");
|
||||||
|
connect(removeIncludeBtn, &QPushButton::clicked, this, &MainWindow::removeIncludeDir);
|
||||||
|
includeBtnLayout->addWidget(removeIncludeBtn);
|
||||||
|
includeBtnLayout->addStretch();
|
||||||
|
|
||||||
|
includeLayout->addLayout(includeBtnLayout);
|
||||||
|
|
||||||
|
includeDirList = new QListWidget();
|
||||||
|
includeLayout->addWidget(includeDirList);
|
||||||
|
|
||||||
|
leftLayout->addWidget(includeGroup);
|
||||||
|
|
||||||
|
mainSplitter->addWidget(leftPanel);
|
||||||
|
|
||||||
|
// 右侧 - 编译配置
|
||||||
|
QWidget *rightPanel = new QWidget();
|
||||||
|
QVBoxLayout *rightLayout = new QVBoxLayout(rightPanel);
|
||||||
|
rightLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
|
||||||
|
// 库文件
|
||||||
|
QGroupBox *libGroup = new QGroupBox("📦 库文件 (.a/.so/.lib)");
|
||||||
|
QVBoxLayout *libLayout = new QVBoxLayout(libGroup);
|
||||||
|
|
||||||
|
QHBoxLayout *libBtnLayout = new QHBoxLayout();
|
||||||
|
QPushButton *addLibBtn = new QPushButton("➕ 添加");
|
||||||
|
connect(addLibBtn, &QPushButton::clicked, this, &MainWindow::addLibrary);
|
||||||
|
libBtnLayout->addWidget(addLibBtn);
|
||||||
|
|
||||||
|
QPushButton *removeLibBtn = new QPushButton("➖ 移除");
|
||||||
|
connect(removeLibBtn, &QPushButton::clicked, this, &MainWindow::removeLibrary);
|
||||||
|
libBtnLayout->addWidget(removeLibBtn);
|
||||||
|
libBtnLayout->addStretch();
|
||||||
|
|
||||||
|
libLayout->addLayout(libBtnLayout);
|
||||||
|
|
||||||
|
libraryList = new QListWidget();
|
||||||
|
libLayout->addWidget(libraryList);
|
||||||
|
|
||||||
|
rightLayout->addWidget(libGroup);
|
||||||
|
|
||||||
|
// 编译宏
|
||||||
|
QGroupBox *defineGroup = new QGroupBox("🏷️ 编译宏定义");
|
||||||
|
QVBoxLayout *defineLayout = new QVBoxLayout(defineGroup);
|
||||||
|
|
||||||
|
QHBoxLayout *defineBtnLayout = new QHBoxLayout();
|
||||||
|
QPushButton *addDefineBtn = new QPushButton("➕ 添加");
|
||||||
|
connect(addDefineBtn, &QPushButton::clicked, this, &MainWindow::addDefine);
|
||||||
|
defineBtnLayout->addWidget(addDefineBtn);
|
||||||
|
|
||||||
|
QPushButton *removeDefineBtn = new QPushButton("➖ 移除");
|
||||||
|
connect(removeDefineBtn, &QPushButton::clicked, this, &MainWindow::removeDefine);
|
||||||
|
defineBtnLayout->addWidget(removeDefineBtn);
|
||||||
|
defineBtnLayout->addStretch();
|
||||||
|
|
||||||
|
defineLayout->addLayout(defineBtnLayout);
|
||||||
|
|
||||||
|
defineList = new QListWidget();
|
||||||
|
defineLayout->addWidget(defineList);
|
||||||
|
|
||||||
|
rightLayout->addWidget(defineGroup);
|
||||||
|
|
||||||
|
// 编译选项
|
||||||
|
QGroupBox *optionGroup = new QGroupBox("⚙️ 自定义编译选项");
|
||||||
|
QVBoxLayout *optionLayout = new QVBoxLayout(optionGroup);
|
||||||
|
|
||||||
|
QHBoxLayout *optionBtnLayout = new QHBoxLayout();
|
||||||
|
QPushButton *addOptionBtn = new QPushButton("➕ 添加");
|
||||||
|
connect(addOptionBtn, &QPushButton::clicked, this, &MainWindow::addCompilerOption);
|
||||||
|
optionBtnLayout->addWidget(addOptionBtn);
|
||||||
|
|
||||||
|
QPushButton *removeOptionBtn = new QPushButton("➖ 移除");
|
||||||
|
connect(removeOptionBtn, &QPushButton::clicked, this, &MainWindow::removeCompilerOption);
|
||||||
|
optionBtnLayout->addWidget(removeOptionBtn);
|
||||||
|
optionBtnLayout->addStretch();
|
||||||
|
|
||||||
|
optionLayout->addLayout(optionBtnLayout);
|
||||||
|
|
||||||
|
optionList = new QListWidget();
|
||||||
|
optionLayout->addWidget(optionList);
|
||||||
|
|
||||||
|
rightLayout->addWidget(optionGroup);
|
||||||
|
|
||||||
|
mainSplitter->addWidget(rightPanel);
|
||||||
|
mainSplitter->setStretchFactor(0, 1);
|
||||||
|
mainSplitter->setStretchFactor(1, 1);
|
||||||
|
|
||||||
|
mainLayout->addWidget(mainSplitter);
|
||||||
|
|
||||||
|
// 状态栏
|
||||||
|
statusBar()->showMessage("就绪");
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::setupConnections()
|
||||||
|
{
|
||||||
|
connect(projectNameEdit, &QLineEdit::textChanged, this, &MainWindow::onProjectNameChanged);
|
||||||
|
connect(compilerPathEdit, &QLineEdit::textChanged, this, &MainWindow::onCompilerPathChanged);
|
||||||
|
connect(assemblerPathEdit, &QLineEdit::textChanged, this, &MainWindow::onAssemblerPathChanged);
|
||||||
|
connect(linkerPathEdit, &QLineEdit::textChanged, this, &MainWindow::onLinkerPathChanged);
|
||||||
|
|
||||||
|
connect(config, &ProjectConfig::configChanged, [this]() {
|
||||||
|
modified = true;
|
||||||
|
updateWindowTitle();
|
||||||
|
});
|
||||||
|
|
||||||
|
connect(cmakeGenerator, &CMakeGenerator::cmakeGenerated, [this](const QString &path) {
|
||||||
|
if (showCMakeSuccessMsg) {
|
||||||
|
statusBar()->showMessage("CMake 生成成功:" + path, 3000);
|
||||||
|
QMessageBox::information(this, "✅ CMake 生成成功",
|
||||||
|
"CMakeLists.txt 已生成!\n\n"
|
||||||
|
"📁 位置:" + path + "\n\n"
|
||||||
|
"🔨 编译方式:\n"
|
||||||
|
" cd build\n"
|
||||||
|
" make debug # 编译 Debug 版本\n"
|
||||||
|
" make release # 编译 Release 版本");
|
||||||
|
}
|
||||||
|
showCMakeSuccessMsg = true; // 重置为 true,下次生成时还会弹窗
|
||||||
|
});
|
||||||
|
|
||||||
|
connect(cmakeGenerator, &CMakeGenerator::errorOccurred, [this](const QString &error) {
|
||||||
|
statusBar()->showMessage("错误:" + error, 5000);
|
||||||
|
QMessageBox::critical(this, "错误", error);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::updateWindowTitle()
|
||||||
|
{
|
||||||
|
QString title = "VoiletCStudio - " + config->getProjectName();
|
||||||
|
if (modified) {
|
||||||
|
title += " [*]";
|
||||||
|
}
|
||||||
|
if (!currentFilePath.isEmpty()) {
|
||||||
|
title += " - " + currentFilePath;
|
||||||
|
}
|
||||||
|
setWindowTitle(title);
|
||||||
|
setWindowModified(modified);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MainWindow::maybeSave()
|
||||||
|
{
|
||||||
|
if (!modified) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
QMessageBox::StandardButton ret = QMessageBox::warning(this, "VoiletCStudio",
|
||||||
|
"工程已修改,是否保存?",
|
||||||
|
QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
|
||||||
|
|
||||||
|
if (ret == QMessageBox::Save) {
|
||||||
|
return saveProject();
|
||||||
|
} else if (ret == QMessageBox::Cancel) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::dragEnterEvent(QDragEnterEvent *event)
|
||||||
|
{
|
||||||
|
if (event->mimeData()->hasUrls()) {
|
||||||
|
QList<QUrl> urls = event->mimeData()->urls();
|
||||||
|
if (!urls.isEmpty()) {
|
||||||
|
QString file = urls.first().toLocalFile();
|
||||||
|
if (file.endsWith(".json", Qt::CaseInsensitive)) {
|
||||||
|
event->acceptProposedAction();
|
||||||
|
statusBar()->showMessage("📂 释放鼠标打开工程:" + file, 3000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::dropEvent(QDropEvent *event)
|
||||||
|
{
|
||||||
|
if (event->mimeData()->hasUrls()) {
|
||||||
|
QList<QUrl> urls = event->mimeData()->urls();
|
||||||
|
if (!urls.isEmpty()) {
|
||||||
|
QString file = urls.first().toLocalFile();
|
||||||
|
if (file.endsWith(".json", Qt::CaseInsensitive)) {
|
||||||
|
if (!maybeSave()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (config->loadConfig(file)) {
|
||||||
|
currentFilePath = file;
|
||||||
|
modified = false;
|
||||||
|
|
||||||
|
projectNameEdit->setText(config->getProjectName());
|
||||||
|
compilerPathEdit->setText(config->getCompilerPath());
|
||||||
|
|
||||||
|
sourceTree->clear();
|
||||||
|
QMap<QString, VirtualDir> dirs = config->getVirtualDirs();
|
||||||
|
for (auto it = dirs.begin(); it != dirs.end(); ++it) {
|
||||||
|
QTreeWidgetItem *dirItem = new QTreeWidgetItem(sourceTree);
|
||||||
|
dirItem->setText(0, "📁 " + it.key());
|
||||||
|
for (const QString &f : it->files) {
|
||||||
|
QTreeWidgetItem *fileItem = new QTreeWidgetItem(dirItem);
|
||||||
|
fileItem->setText(0, "📄 " + QFileInfo(f).fileName());
|
||||||
|
fileItem->setToolTip(0, f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
includeDirList->clear();
|
||||||
|
includeDirList->addItems(config->getIncludeDirs());
|
||||||
|
|
||||||
|
libraryList->clear();
|
||||||
|
libraryList->addItems(config->getLibraries());
|
||||||
|
|
||||||
|
defineList->clear();
|
||||||
|
defineList->addItems(config->getDefines());
|
||||||
|
|
||||||
|
optionList->clear();
|
||||||
|
optionList->addItems(config->getCompilerOptions());
|
||||||
|
|
||||||
|
updateWindowTitle();
|
||||||
|
statusBar()->showMessage("✅ 工程已加载:" + file, 5000);
|
||||||
|
QMessageBox::information(this, "成功", "工程加载成功!\n" + file);
|
||||||
|
} else {
|
||||||
|
QMessageBox::critical(this, "错误", "无法加载工程文件:" + file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::newProject()
|
||||||
|
{
|
||||||
|
if (!maybeSave()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
config = new ProjectConfig(this);
|
||||||
|
currentFilePath.clear();
|
||||||
|
modified = false;
|
||||||
|
|
||||||
|
projectNameEdit->clear();
|
||||||
|
compilerPathEdit->clear();
|
||||||
|
assemblerPathEdit->clear();
|
||||||
|
linkerPathEdit->clear();
|
||||||
|
sourceTree->clear();
|
||||||
|
includeDirList->clear();
|
||||||
|
libraryList->clear();
|
||||||
|
defineList->clear();
|
||||||
|
optionList->clear();
|
||||||
|
|
||||||
|
updateWindowTitle();
|
||||||
|
statusBar()->showMessage("已创建新工程", 3000);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::openProject()
|
||||||
|
{
|
||||||
|
if (!maybeSave()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString filePath = QFileDialog::getOpenFileName(this, "打开工程", "",
|
||||||
|
"JSON 配置文件 (*.json);;所有文件 (*)");
|
||||||
|
|
||||||
|
if (filePath.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (config->loadConfig(filePath)) {
|
||||||
|
currentFilePath = filePath;
|
||||||
|
modified = false;
|
||||||
|
|
||||||
|
projectNameEdit->setText(config->getProjectName());
|
||||||
|
compilerPathEdit->setText(config->getCompilerPath());
|
||||||
|
assemblerPathEdit->setText(config->getAssemblerPath());
|
||||||
|
linkerPathEdit->setText(config->getLinkerPath());
|
||||||
|
|
||||||
|
sourceTree->clear();
|
||||||
|
QMap<QString, VirtualDir> dirs = config->getVirtualDirs();
|
||||||
|
for (auto it = dirs.begin(); it != dirs.end(); ++it) {
|
||||||
|
QTreeWidgetItem *dirItem = new QTreeWidgetItem(sourceTree);
|
||||||
|
dirItem->setText(0, it.key());
|
||||||
|
for (const QString &file : it->files) {
|
||||||
|
QTreeWidgetItem *fileItem = new QTreeWidgetItem(dirItem);
|
||||||
|
fileItem->setText(0, file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
includeDirList->clear();
|
||||||
|
includeDirList->addItems(config->getIncludeDirs());
|
||||||
|
|
||||||
|
libraryList->clear();
|
||||||
|
libraryList->addItems(config->getLibraries());
|
||||||
|
|
||||||
|
defineList->clear();
|
||||||
|
defineList->addItems(config->getDefines());
|
||||||
|
|
||||||
|
optionList->clear();
|
||||||
|
optionList->addItems(config->getCompilerOptions());
|
||||||
|
|
||||||
|
updateWindowTitle();
|
||||||
|
statusBar()->showMessage("工程已加载:" + filePath, 3000);
|
||||||
|
} else {
|
||||||
|
QMessageBox::critical(this, "错误", "无法加载工程文件:" + filePath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MainWindow::saveProject()
|
||||||
|
{
|
||||||
|
if (currentFilePath.isEmpty()) {
|
||||||
|
return saveProjectAs();
|
||||||
|
}
|
||||||
|
|
||||||
|
config->setProjectName(projectNameEdit->text());
|
||||||
|
config->setCompilerPath(compilerPathEdit->text());
|
||||||
|
config->setAssemblerPath(assemblerPathEdit->text());
|
||||||
|
config->setLinkerPath(linkerPathEdit->text());
|
||||||
|
|
||||||
|
if (config->saveConfig(currentFilePath)) {
|
||||||
|
modified = false;
|
||||||
|
updateWindowTitle();
|
||||||
|
statusBar()->showMessage("工程已保存:" + currentFilePath, 3000);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
QMessageBox::critical(this, "错误", "无法保存工程文件");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MainWindow::saveProjectAs()
|
||||||
|
{
|
||||||
|
QString filePath = QFileDialog::getSaveFileName(this, "保存工程", "",
|
||||||
|
"JSON 配置文件 (*.json);;所有文件 (*)");
|
||||||
|
|
||||||
|
if (filePath.isEmpty()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
currentFilePath = filePath;
|
||||||
|
return saveProject();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::generateCMake()
|
||||||
|
{
|
||||||
|
// 先保存工程
|
||||||
|
if (!saveProject()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取工程目录(JSON 配置文件所在目录)
|
||||||
|
QString projectDir = QFileInfo(currentFilePath).absolutePath();
|
||||||
|
QString buildDir = projectDir + "/build";
|
||||||
|
QString cmakePath = projectDir + "/CMakeLists.txt";
|
||||||
|
|
||||||
|
// 删除旧的 build 目录
|
||||||
|
QDir buildPath(buildDir);
|
||||||
|
if (buildPath.exists()) {
|
||||||
|
buildPath.removeRecursively();
|
||||||
|
statusBar()->showMessage("已删除旧 build 目录", 2000);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 重新创建 build 目录
|
||||||
|
buildPath.mkpath(buildDir);
|
||||||
|
|
||||||
|
// 生成 CMake 文件
|
||||||
|
if (cmakeGenerator->generate(config, cmakePath)) {
|
||||||
|
statusBar()->showMessage("CMake 已生成,正在编译...", 2000);
|
||||||
|
|
||||||
|
// 在 build 目录执行 cmake
|
||||||
|
QProcess process;
|
||||||
|
process.setWorkingDirectory(buildDir);
|
||||||
|
process.start("cmake", QStringList() << "..");
|
||||||
|
process.waitForFinished(10000);
|
||||||
|
|
||||||
|
QString output = process.readAllStandardOutput();
|
||||||
|
QString error = process.readAllStandardError();
|
||||||
|
|
||||||
|
if (process.exitCode() == 0) {
|
||||||
|
statusBar()->showMessage("CMake 配置成功!", 3000);
|
||||||
|
// 不弹窗了,编译按钮会直接打开编译窗口
|
||||||
|
} else {
|
||||||
|
statusBar()->showMessage("CMake 配置失败", 3000);
|
||||||
|
QMessageBox::warning(this, "警告",
|
||||||
|
"CMake 配置完成但有警告:\n" + error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void MainWindow::onProjectNameChanged(const QString &text)
|
||||||
|
{
|
||||||
|
config->setProjectName(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::onCompilerPathChanged()
|
||||||
|
{
|
||||||
|
config->setCompilerPath(compilerPathEdit->text());
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::onAssemblerPathChanged()
|
||||||
|
{
|
||||||
|
config->setAssemblerPath(assemblerPathEdit->text());
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::onLinkerPathChanged()
|
||||||
|
{
|
||||||
|
config->setLinkerPath(linkerPathEdit->text());
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::addVirtualDir()
|
||||||
|
{
|
||||||
|
bool ok;
|
||||||
|
QString dirName = QInputDialog::getText(this, "添加虚拟目录",
|
||||||
|
"目录名称:", QLineEdit::Normal, "", &ok);
|
||||||
|
|
||||||
|
if (ok && !dirName.isEmpty()) {
|
||||||
|
config->addVirtualDir(dirName);
|
||||||
|
|
||||||
|
QTreeWidgetItem *item = new QTreeWidgetItem(sourceTree);
|
||||||
|
item->setText(0, dirName);
|
||||||
|
sourceTree->expandAll();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::addSourceFile()
|
||||||
|
{
|
||||||
|
QTreeWidgetItem *currentItem = sourceTree->currentItem();
|
||||||
|
if (!currentItem) {
|
||||||
|
QMessageBox::warning(this, "警告", "请先选择虚拟目录");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString dirName = currentItem->text(0);
|
||||||
|
|
||||||
|
QStringList files = QFileDialog::getOpenFileNames(this, "选择源文件", "",
|
||||||
|
"C 源文件 (*.c);;所有文件 (*)");
|
||||||
|
|
||||||
|
for (const QString &file : files) {
|
||||||
|
config->addSourceFile(dirName, file);
|
||||||
|
|
||||||
|
QTreeWidgetItem *fileItem = new QTreeWidgetItem(currentItem);
|
||||||
|
fileItem->setText(0, file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::removeSourceFile()
|
||||||
|
{
|
||||||
|
QTreeWidgetItem *currentItem = sourceTree->currentItem();
|
||||||
|
if (!currentItem) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString dirName = currentItem->parent() ? currentItem->parent()->text(0) : currentItem->text(0);
|
||||||
|
QString fileName = currentItem->text(0);
|
||||||
|
|
||||||
|
if (currentItem->parent()) {
|
||||||
|
config->removeSourceFile(dirName, fileName);
|
||||||
|
delete currentItem;
|
||||||
|
} else {
|
||||||
|
config->clearVirtualDirs();
|
||||||
|
delete currentItem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::addIncludeDir()
|
||||||
|
{
|
||||||
|
QString dir = QFileDialog::getExistingDirectory(this, "选择包含目录");
|
||||||
|
if (!dir.isEmpty()) {
|
||||||
|
config->addIncludeDir(dir);
|
||||||
|
includeDirList->addItem(dir);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::removeIncludeDir()
|
||||||
|
{
|
||||||
|
int row = includeDirList->currentRow();
|
||||||
|
if (row >= 0) {
|
||||||
|
QString dir = includeDirList->takeItem(row)->text();
|
||||||
|
config->removeIncludeDir(dir);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::addLibrary()
|
||||||
|
{
|
||||||
|
QStringList files = QFileDialog::getOpenFileNames(this, "选择库文件", "",
|
||||||
|
"库文件 (*.a *.so *.lib *.dll);;所有文件 (*)");
|
||||||
|
|
||||||
|
for (const QString &file : files) {
|
||||||
|
config->addLibrary(file);
|
||||||
|
libraryList->addItem(file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::removeLibrary()
|
||||||
|
{
|
||||||
|
int row = libraryList->currentRow();
|
||||||
|
if (row >= 0) {
|
||||||
|
QString lib = libraryList->takeItem(row)->text();
|
||||||
|
config->removeLibrary(lib);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::addDefine()
|
||||||
|
{
|
||||||
|
bool ok;
|
||||||
|
QString macro = QInputDialog::getText(this, "添加编译宏",
|
||||||
|
"宏定义 (例如 DEBUG):", QLineEdit::Normal, "", &ok);
|
||||||
|
|
||||||
|
if (ok && !macro.isEmpty()) {
|
||||||
|
config->addDefine(macro);
|
||||||
|
defineList->addItem(macro);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::removeDefine()
|
||||||
|
{
|
||||||
|
int row = defineList->currentRow();
|
||||||
|
if (row >= 0) {
|
||||||
|
QString macro = defineList->takeItem(row)->text();
|
||||||
|
config->removeDefine(macro);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::addCompilerOption()
|
||||||
|
{
|
||||||
|
bool ok;
|
||||||
|
QString option = QInputDialog::getText(this, "添加编译选项",
|
||||||
|
"编译选项 (例如 -Wall):", QLineEdit::Normal, "", &ok);
|
||||||
|
|
||||||
|
if (ok && !option.isEmpty()) {
|
||||||
|
config->addCompilerOption(option);
|
||||||
|
optionList->addItem(option);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::removeCompilerOption()
|
||||||
|
{
|
||||||
|
int row = optionList->currentRow();
|
||||||
|
if (row >= 0) {
|
||||||
|
QString option = optionList->takeItem(row)->text();
|
||||||
|
config->removeCompilerOption(option);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::browseCompilerPath()
|
||||||
|
{
|
||||||
|
QString path = QFileDialog::getOpenFileName(this, "选择编译器", "",
|
||||||
|
"可执行文件 (*)");
|
||||||
|
if (!path.isEmpty()) {
|
||||||
|
compilerPathEdit->setText(path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::browseAssemblerPath()
|
||||||
|
{
|
||||||
|
QString path = QFileDialog::getOpenFileName(this, "选择汇编器", "",
|
||||||
|
"可执行文件 (*)");
|
||||||
|
if (!path.isEmpty()) {
|
||||||
|
assemblerPathEdit->setText(path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::browseLinkerPath()
|
||||||
|
{
|
||||||
|
QString path = QFileDialog::getOpenFileName(this, "选择链接器", "",
|
||||||
|
"可执行文件 (*)");
|
||||||
|
if (!path.isEmpty()) {
|
||||||
|
linkerPathEdit->setText(path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::compileDebug()
|
||||||
|
{
|
||||||
|
showCMakeSuccessMsg = false; // 编译时不弹 CMake 成功窗
|
||||||
|
compileProject("Debug");
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::compileRelease()
|
||||||
|
{
|
||||||
|
showCMakeSuccessMsg = false; // 编译时不弹 CMake 成功窗
|
||||||
|
compileProject("Release");
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::compileProject(const QString &buildType)
|
||||||
|
{
|
||||||
|
// 先保存工程
|
||||||
|
if (!saveProject()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (currentFilePath.isEmpty()) {
|
||||||
|
QMessageBox::warning(this, "警告", "请先保存工程!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString projectDir = QFileInfo(currentFilePath).absolutePath();
|
||||||
|
QString buildDir = projectDir + "/build";
|
||||||
|
|
||||||
|
// 删除旧的 build 目录
|
||||||
|
QDir buildPath(buildDir);
|
||||||
|
if (buildPath.exists()) {
|
||||||
|
buildPath.removeRecursively();
|
||||||
|
}
|
||||||
|
buildPath.mkpath(buildDir);
|
||||||
|
|
||||||
|
// 生成 CMake
|
||||||
|
QString cmakePath = projectDir + "/CMakeLists.txt";
|
||||||
|
if (!cmakeGenerator->generate(config, cmakePath)) {
|
||||||
|
QMessageBox::critical(this, "错误", "生成 CMake 失败!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建编译信息对话框
|
||||||
|
QDialog *compileDialog = new QDialog(this);
|
||||||
|
compileDialog->setWindowTitle("编译 " + buildType);
|
||||||
|
compileDialog->resize(800, 600);
|
||||||
|
|
||||||
|
QVBoxLayout *dialogLayout = new QVBoxLayout(compileDialog);
|
||||||
|
|
||||||
|
QLabel *titleLabel = new QLabel("🔨 编译 " + buildType + " 中...");
|
||||||
|
titleLabel->setStyleSheet("font-size: 18px; font-weight: bold; color: #333;");
|
||||||
|
dialogLayout->addWidget(titleLabel);
|
||||||
|
|
||||||
|
QTextEdit *outputEdit = new QTextEdit();
|
||||||
|
outputEdit->setReadOnly(true);
|
||||||
|
outputEdit->setFont(QFont("Consolas", 10));
|
||||||
|
outputEdit->setStyleSheet("background: #1e1e1e; color: #d4d4d4;");
|
||||||
|
dialogLayout->addWidget(outputEdit);
|
||||||
|
|
||||||
|
QPushButton *closeBtn = new QPushButton("❌ 关闭");
|
||||||
|
closeBtn->setMinimumHeight(35);
|
||||||
|
closeBtn->setStyleSheet("QPushButton { background: #f44336; color: white; font-weight: bold; font-size: 14px; }");
|
||||||
|
dialogLayout->addWidget(closeBtn);
|
||||||
|
|
||||||
|
compileDialog->show();
|
||||||
|
|
||||||
|
// 执行 cmake
|
||||||
|
outputEdit->append("📋 正在配置 CMake...\n");
|
||||||
|
QProcess cmakeProcess;
|
||||||
|
cmakeProcess.setWorkingDirectory(buildDir);
|
||||||
|
cmakeProcess.start("cmake", QStringList() << "-DCMAKE_BUILD_TYPE=" + buildType << "..");
|
||||||
|
cmakeProcess.waitForFinished(30000);
|
||||||
|
|
||||||
|
outputEdit->append(cmakeProcess.readAllStandardOutput());
|
||||||
|
QString cmakeError = cmakeProcess.readAllStandardError();
|
||||||
|
if (!cmakeError.isEmpty()) {
|
||||||
|
outputEdit->append("⚠️ CMake 警告/错误:\n" + cmakeError);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 执行 make
|
||||||
|
outputEdit->append("\n🔨 正在编译 " + buildType + "...\n");
|
||||||
|
QProcess makeProcess;
|
||||||
|
makeProcess.setWorkingDirectory(buildDir);
|
||||||
|
makeProcess.start("make", QStringList() << buildType.toLower());
|
||||||
|
|
||||||
|
// 实时输出
|
||||||
|
connect(&makeProcess, &QProcess::readyReadStandardOutput, [&outputEdit, &makeProcess]() {
|
||||||
|
outputEdit->append(makeProcess.readAllStandardOutput());
|
||||||
|
outputEdit->verticalScrollBar()->setValue(outputEdit->verticalScrollBar()->maximum());
|
||||||
|
});
|
||||||
|
|
||||||
|
connect(&makeProcess, &QProcess::readyReadStandardError, [&outputEdit, &makeProcess]() {
|
||||||
|
outputEdit->append(makeProcess.readAllStandardError());
|
||||||
|
outputEdit->verticalScrollBar()->setValue(outputEdit->verticalScrollBar()->maximum());
|
||||||
|
});
|
||||||
|
|
||||||
|
makeProcess.waitForFinished(300000); // 5 分钟超时
|
||||||
|
|
||||||
|
if (makeProcess.exitCode() == 0) {
|
||||||
|
outputEdit->append("\n✅ 编译成功!");
|
||||||
|
titleLabel->setText("✅ 编译 " + buildType + " 成功!");
|
||||||
|
titleLabel->setStyleSheet("font-size: 18px; font-weight: bold; color: #4CAF50;");
|
||||||
|
} else {
|
||||||
|
outputEdit->append("\n❌ 编译失败!错误代码:" + QString::number(makeProcess.exitCode()));
|
||||||
|
titleLabel->setText("❌ 编译 " + buildType + " 失败!");
|
||||||
|
titleLabel->setStyleSheet("font-size: 18px; font-weight: bold; color: #f44336;");
|
||||||
|
}
|
||||||
|
|
||||||
|
connect(closeBtn, &QPushButton::clicked, compileDialog, &QDialog::accept);
|
||||||
|
}
|
||||||
|
|
||||||
104
src/mainwindow.h
Normal file
104
src/mainwindow.h
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
#ifndef MAINWINDOW_H
|
||||||
|
#define MAINWINDOW_H
|
||||||
|
|
||||||
|
#include <QMainWindow>
|
||||||
|
#include <QLineEdit>
|
||||||
|
#include <QTextEdit>
|
||||||
|
#include <QPushButton>
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QListWidget>
|
||||||
|
#include <QTreeWidget>
|
||||||
|
#include <QTabWidget>
|
||||||
|
#include "projectconfig.h"
|
||||||
|
#include "cmakegenerator.h"
|
||||||
|
|
||||||
|
class MainWindow : public QMainWindow
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
MainWindow(QWidget *parent = nullptr);
|
||||||
|
~MainWindow();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
// 文件操作
|
||||||
|
void newProject();
|
||||||
|
void openProject();
|
||||||
|
bool saveProject();
|
||||||
|
bool saveProjectAs();
|
||||||
|
|
||||||
|
// 生成 CMake
|
||||||
|
void generateCMake();
|
||||||
|
|
||||||
|
// 编译
|
||||||
|
void compileDebug();
|
||||||
|
void compileRelease();
|
||||||
|
void compileProject(const QString &buildType);
|
||||||
|
|
||||||
|
// UI 更新
|
||||||
|
void onProjectNameChanged(const QString &text);
|
||||||
|
void onCompilerPathChanged();
|
||||||
|
void onAssemblerPathChanged();
|
||||||
|
void onLinkerPathChanged();
|
||||||
|
|
||||||
|
// 虚拟目录操作
|
||||||
|
void addVirtualDir();
|
||||||
|
void addSourceFile();
|
||||||
|
void removeSourceFile();
|
||||||
|
|
||||||
|
// 包含目录操作
|
||||||
|
void addIncludeDir();
|
||||||
|
void removeIncludeDir();
|
||||||
|
|
||||||
|
// 库文件操作
|
||||||
|
void addLibrary();
|
||||||
|
void removeLibrary();
|
||||||
|
|
||||||
|
// 编译宏操作
|
||||||
|
void addDefine();
|
||||||
|
void removeDefine();
|
||||||
|
|
||||||
|
// 编译选项操作
|
||||||
|
void addCompilerOption();
|
||||||
|
void removeCompilerOption();
|
||||||
|
|
||||||
|
// 浏览文件
|
||||||
|
void browseCompilerPath();
|
||||||
|
void browseAssemblerPath();
|
||||||
|
void browseLinkerPath();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void dragEnterEvent(QDragEnterEvent *event) override;
|
||||||
|
void dropEvent(QDropEvent *event) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void setupUI();
|
||||||
|
void setupConnections();
|
||||||
|
void updateWindowTitle();
|
||||||
|
bool maybeSave();
|
||||||
|
|
||||||
|
// 组件
|
||||||
|
QLineEdit *projectNameEdit;
|
||||||
|
QLineEdit *compilerPathEdit;
|
||||||
|
QLineEdit *assemblerPathEdit;
|
||||||
|
QLineEdit *linkerPathEdit;
|
||||||
|
|
||||||
|
QTreeWidget *sourceTree; // 虚拟目录树
|
||||||
|
QListWidget *includeDirList; // 包含目录列表
|
||||||
|
QListWidget *libraryList; // 库文件列表
|
||||||
|
QListWidget *defineList; // 编译宏列表
|
||||||
|
QListWidget *optionList; // 编译选项列表
|
||||||
|
|
||||||
|
QPushButton *saveButton;
|
||||||
|
QPushButton *generateButton;
|
||||||
|
|
||||||
|
// 配置和生成器
|
||||||
|
ProjectConfig *config;
|
||||||
|
CMakeGenerator *cmakeGenerator;
|
||||||
|
|
||||||
|
QString currentFilePath;
|
||||||
|
bool modified;
|
||||||
|
bool showCMakeSuccessMsg; // 控制是否显示 CMake 成功弹窗
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // MAINWINDOW_H
|
||||||
351
src/projectconfig.cpp
Normal file
351
src/projectconfig.cpp
Normal file
@@ -0,0 +1,351 @@
|
|||||||
|
#include "projectconfig.h"
|
||||||
|
#include <QFile>
|
||||||
|
#include <QJsonDocument>
|
||||||
|
#include <QJsonObject>
|
||||||
|
#include <QJsonArray>
|
||||||
|
#include <QDir>
|
||||||
|
|
||||||
|
ProjectConfig::ProjectConfig(QObject *parent)
|
||||||
|
: QObject(parent)
|
||||||
|
{
|
||||||
|
m_projectName = "Untitled";
|
||||||
|
m_projectPath = "";
|
||||||
|
m_compilerPath = "gcc";
|
||||||
|
m_assemblerPath = "gcc";
|
||||||
|
m_linkerPath = "gcc";
|
||||||
|
m_outputDir = "./build";
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ProjectConfig::loadConfig(const QString &filePath)
|
||||||
|
{
|
||||||
|
QFile file(filePath);
|
||||||
|
if (!file.open(QIODevice::ReadOnly)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
QJsonDocument doc = QJsonDocument::fromJson(file.readAll());
|
||||||
|
file.close();
|
||||||
|
|
||||||
|
if (doc.isNull()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
fromJson(doc.object());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ProjectConfig::saveConfig(const QString &filePath)
|
||||||
|
{
|
||||||
|
QFile file(filePath);
|
||||||
|
if (!file.open(QIODevice::WriteOnly)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
QJsonDocument doc(toJson());
|
||||||
|
file.write(doc.toJson());
|
||||||
|
file.close();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
QJsonObject ProjectConfig::toJson() const
|
||||||
|
{
|
||||||
|
QJsonObject json;
|
||||||
|
|
||||||
|
// 基本信息
|
||||||
|
json["projectName"] = m_projectName;
|
||||||
|
json["projectPath"] = m_projectPath;
|
||||||
|
json["outputDir"] = m_outputDir;
|
||||||
|
|
||||||
|
// 工具链
|
||||||
|
json["compilerPath"] = m_compilerPath;
|
||||||
|
json["assemblerPath"] = m_assemblerPath;
|
||||||
|
json["linkerPath"] = m_linkerPath;
|
||||||
|
|
||||||
|
// 虚拟目录
|
||||||
|
QJsonObject virtualDirs;
|
||||||
|
for (auto it = m_virtualDirs.begin(); it != m_virtualDirs.end(); ++it) {
|
||||||
|
QJsonObject dirObj;
|
||||||
|
dirObj["name"] = it->name;
|
||||||
|
QJsonArray files;
|
||||||
|
for (const QString &f : it->files) {
|
||||||
|
files.append(f);
|
||||||
|
}
|
||||||
|
dirObj["files"] = files;
|
||||||
|
virtualDirs[it.key()] = dirObj;
|
||||||
|
}
|
||||||
|
json["virtualDirs"] = virtualDirs;
|
||||||
|
|
||||||
|
// 包含目录
|
||||||
|
QJsonArray includeDirs;
|
||||||
|
for (const QString &dir : m_includeDirs) {
|
||||||
|
includeDirs.append(dir);
|
||||||
|
}
|
||||||
|
json["includeDirs"] = includeDirs;
|
||||||
|
|
||||||
|
// 库文件
|
||||||
|
QJsonArray libraries;
|
||||||
|
for (const QString &lib : m_libraries) {
|
||||||
|
libraries.append(lib);
|
||||||
|
}
|
||||||
|
json["libraries"] = libraries;
|
||||||
|
|
||||||
|
// 编译宏
|
||||||
|
QJsonArray defines;
|
||||||
|
for (const QString &def : m_defines) {
|
||||||
|
defines.append(def);
|
||||||
|
}
|
||||||
|
json["defines"] = defines;
|
||||||
|
|
||||||
|
// 编译选项
|
||||||
|
QJsonArray options;
|
||||||
|
for (const QString &opt : m_compilerOptions) {
|
||||||
|
options.append(opt);
|
||||||
|
}
|
||||||
|
json["compilerOptions"] = options;
|
||||||
|
|
||||||
|
return json;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProjectConfig::fromJson(const QJsonObject &json)
|
||||||
|
{
|
||||||
|
m_projectName = json["projectName"].toString();
|
||||||
|
m_projectPath = json["projectPath"].toString();
|
||||||
|
m_outputDir = json["outputDir"].toString();
|
||||||
|
m_compilerPath = json["compilerPath"].toString();
|
||||||
|
m_assemblerPath = json["assemblerPath"].toString();
|
||||||
|
m_linkerPath = json["linkerPath"].toString();
|
||||||
|
|
||||||
|
// 虚拟目录
|
||||||
|
m_virtualDirs.clear();
|
||||||
|
QJsonObject virtualDirs = json["virtualDirs"].toObject();
|
||||||
|
for (auto it = virtualDirs.begin(); it != virtualDirs.end(); ++it) {
|
||||||
|
VirtualDir dir;
|
||||||
|
dir.name = it->toObject()["name"].toString();
|
||||||
|
QJsonArray files = it->toObject()["files"].toArray();
|
||||||
|
for (const QJsonValue &f : files) {
|
||||||
|
dir.files.append(f.toString());
|
||||||
|
}
|
||||||
|
m_virtualDirs[it.key()] = dir;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 包含目录
|
||||||
|
m_includeDirs.clear();
|
||||||
|
QJsonArray includeDirs = json["includeDirs"].toArray();
|
||||||
|
for (const QJsonValue &dir : includeDirs) {
|
||||||
|
m_includeDirs.append(dir.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 库文件
|
||||||
|
m_libraries.clear();
|
||||||
|
QJsonArray libraries = json["libraries"].toArray();
|
||||||
|
for (const QJsonValue &lib : libraries) {
|
||||||
|
m_libraries.append(lib.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 编译宏
|
||||||
|
m_defines.clear();
|
||||||
|
QJsonArray defines = json["defines"].toArray();
|
||||||
|
for (const QJsonValue &def : defines) {
|
||||||
|
m_defines.append(def.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 编译选项
|
||||||
|
m_compilerOptions.clear();
|
||||||
|
QJsonArray options = json["compilerOptions"].toArray();
|
||||||
|
for (const QJsonValue &opt : options) {
|
||||||
|
m_compilerOptions.append(opt.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
emit configChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Getter/Setter 实现
|
||||||
|
void ProjectConfig::setProjectName(const QString &name) {
|
||||||
|
if (m_projectName != name) {
|
||||||
|
m_projectName = name;
|
||||||
|
emit configChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ProjectConfig::getProjectName() const {
|
||||||
|
return m_projectName;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProjectConfig::setProjectPath(const QString &path) {
|
||||||
|
if (m_projectPath != path) {
|
||||||
|
m_projectPath = path;
|
||||||
|
emit configChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ProjectConfig::getProjectPath() const {
|
||||||
|
return m_projectPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProjectConfig::setCompilerPath(const QString &path) {
|
||||||
|
if (m_compilerPath != path) {
|
||||||
|
m_compilerPath = path;
|
||||||
|
emit configChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ProjectConfig::getCompilerPath() const {
|
||||||
|
return m_compilerPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProjectConfig::setAssemblerPath(const QString &path) {
|
||||||
|
if (m_assemblerPath != path) {
|
||||||
|
m_assemblerPath = path;
|
||||||
|
emit configChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ProjectConfig::getAssemblerPath() const {
|
||||||
|
return m_assemblerPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProjectConfig::setLinkerPath(const QString &path) {
|
||||||
|
if (m_linkerPath != path) {
|
||||||
|
m_linkerPath = path;
|
||||||
|
emit configChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ProjectConfig::getLinkerPath() const {
|
||||||
|
return m_linkerPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProjectConfig::setOutputDir(const QString &dir) {
|
||||||
|
if (m_outputDir != dir) {
|
||||||
|
m_outputDir = dir;
|
||||||
|
emit configChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ProjectConfig::getOutputDir() const {
|
||||||
|
return m_outputDir;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 虚拟目录操作
|
||||||
|
void ProjectConfig::addVirtualDir(const QString &dirName) {
|
||||||
|
if (!m_virtualDirs.contains(dirName)) {
|
||||||
|
VirtualDir dir;
|
||||||
|
dir.name = dirName;
|
||||||
|
m_virtualDirs[dirName] = dir;
|
||||||
|
emit configChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProjectConfig::addSourceFile(const QString &dirName, const QString &filePath) {
|
||||||
|
if (m_virtualDirs.contains(dirName)) {
|
||||||
|
if (!m_virtualDirs[dirName].files.contains(filePath)) {
|
||||||
|
m_virtualDirs[dirName].files.append(filePath);
|
||||||
|
emit configChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProjectConfig::removeSourceFile(const QString &dirName, const QString &filePath) {
|
||||||
|
if (m_virtualDirs.contains(dirName)) {
|
||||||
|
m_virtualDirs[dirName].files.removeAll(filePath);
|
||||||
|
emit configChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QMap<QString, VirtualDir> ProjectConfig::getVirtualDirs() const {
|
||||||
|
return m_virtualDirs;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProjectConfig::clearVirtualDirs() {
|
||||||
|
m_virtualDirs.clear();
|
||||||
|
emit configChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 包含目录操作
|
||||||
|
void ProjectConfig::addIncludeDir(const QString &dir) {
|
||||||
|
if (!m_includeDirs.contains(dir)) {
|
||||||
|
m_includeDirs.append(dir);
|
||||||
|
emit configChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProjectConfig::removeIncludeDir(const QString &dir) {
|
||||||
|
m_includeDirs.removeAll(dir);
|
||||||
|
emit configChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList ProjectConfig::getIncludeDirs() const {
|
||||||
|
return m_includeDirs;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProjectConfig::clearIncludeDirs() {
|
||||||
|
m_includeDirs.clear();
|
||||||
|
emit configChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 库文件操作
|
||||||
|
void ProjectConfig::addLibrary(const QString &libPath) {
|
||||||
|
if (!m_libraries.contains(libPath)) {
|
||||||
|
m_libraries.append(libPath);
|
||||||
|
emit configChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProjectConfig::removeLibrary(const QString &libPath) {
|
||||||
|
m_libraries.removeAll(libPath);
|
||||||
|
emit configChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList ProjectConfig::getLibraries() const {
|
||||||
|
return m_libraries;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProjectConfig::clearLibraries() {
|
||||||
|
m_libraries.clear();
|
||||||
|
emit configChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 编译宏操作
|
||||||
|
void ProjectConfig::addDefine(const QString ¯o) {
|
||||||
|
if (!m_defines.contains(macro)) {
|
||||||
|
m_defines.append(macro);
|
||||||
|
emit configChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProjectConfig::removeDefine(const QString ¯o) {
|
||||||
|
m_defines.removeAll(macro);
|
||||||
|
emit configChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList ProjectConfig::getDefines() const {
|
||||||
|
return m_defines;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProjectConfig::clearDefines() {
|
||||||
|
m_defines.clear();
|
||||||
|
emit configChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 编译选项操作
|
||||||
|
void ProjectConfig::addCompilerOption(const QString &option) {
|
||||||
|
if (!m_compilerOptions.contains(option)) {
|
||||||
|
m_compilerOptions.append(option);
|
||||||
|
emit configChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProjectConfig::removeCompilerOption(const QString &option) {
|
||||||
|
m_compilerOptions.removeAll(option);
|
||||||
|
emit configChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList ProjectConfig::getCompilerOptions() const {
|
||||||
|
return m_compilerOptions;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProjectConfig::clearCompilerOptions() {
|
||||||
|
m_compilerOptions.clear();
|
||||||
|
emit configChanged();
|
||||||
|
}
|
||||||
101
src/projectconfig.h
Normal file
101
src/projectconfig.h
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
#ifndef PROJECTCONFIG_H
|
||||||
|
#define PROJECTCONFIG_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QString>
|
||||||
|
#include <QStringList>
|
||||||
|
#include <QMap>
|
||||||
|
#include <QJsonObject>
|
||||||
|
|
||||||
|
// 虚拟目录结构
|
||||||
|
struct VirtualDir {
|
||||||
|
QString name;
|
||||||
|
QStringList files; // .c 文件列表
|
||||||
|
};
|
||||||
|
|
||||||
|
class ProjectConfig : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit ProjectConfig(QObject *parent = nullptr);
|
||||||
|
|
||||||
|
// 加载/保存配置
|
||||||
|
bool loadConfig(const QString &filePath);
|
||||||
|
bool saveConfig(const QString &filePath);
|
||||||
|
|
||||||
|
// 工程基本信息
|
||||||
|
void setProjectName(const QString &name);
|
||||||
|
QString getProjectName() const;
|
||||||
|
|
||||||
|
void setProjectPath(const QString &path);
|
||||||
|
QString getProjectPath() const;
|
||||||
|
|
||||||
|
// 编译工具链
|
||||||
|
void setCompilerPath(const QString &path);
|
||||||
|
QString getCompilerPath() const;
|
||||||
|
|
||||||
|
void setAssemblerPath(const QString &path);
|
||||||
|
QString getAssemblerPath() const;
|
||||||
|
|
||||||
|
void setLinkerPath(const QString &path);
|
||||||
|
QString getLinkerPath() const;
|
||||||
|
|
||||||
|
// 输出目录
|
||||||
|
void setOutputDir(const QString &dir);
|
||||||
|
QString getOutputDir() const;
|
||||||
|
|
||||||
|
// 虚拟目录(.c 文件)
|
||||||
|
void addVirtualDir(const QString &dirName);
|
||||||
|
void addSourceFile(const QString &dirName, const QString &filePath);
|
||||||
|
void removeSourceFile(const QString &dirName, const QString &filePath);
|
||||||
|
QMap<QString, VirtualDir> getVirtualDirs() const;
|
||||||
|
void clearVirtualDirs();
|
||||||
|
|
||||||
|
// 包含目录(.h 文件)
|
||||||
|
void addIncludeDir(const QString &dir);
|
||||||
|
void removeIncludeDir(const QString &dir);
|
||||||
|
QStringList getIncludeDirs() const;
|
||||||
|
void clearIncludeDirs();
|
||||||
|
|
||||||
|
// 库文件
|
||||||
|
void addLibrary(const QString &libPath);
|
||||||
|
void removeLibrary(const QString &libPath);
|
||||||
|
QStringList getLibraries() const;
|
||||||
|
void clearLibraries();
|
||||||
|
|
||||||
|
// 编译宏
|
||||||
|
void addDefine(const QString ¯o);
|
||||||
|
void removeDefine(const QString ¯o);
|
||||||
|
QStringList getDefines() const;
|
||||||
|
void clearDefines();
|
||||||
|
|
||||||
|
// 自定义编译选项
|
||||||
|
void addCompilerOption(const QString &option);
|
||||||
|
void removeCompilerOption(const QString &option);
|
||||||
|
QStringList getCompilerOptions() const;
|
||||||
|
void clearCompilerOptions();
|
||||||
|
|
||||||
|
// 转换为 JSON
|
||||||
|
QJsonObject toJson() const;
|
||||||
|
void fromJson(const QJsonObject &json);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void configChanged();
|
||||||
|
|
||||||
|
private:
|
||||||
|
QString m_projectName;
|
||||||
|
QString m_projectPath;
|
||||||
|
QString m_compilerPath;
|
||||||
|
QString m_assemblerPath;
|
||||||
|
QString m_linkerPath;
|
||||||
|
QString m_outputDir;
|
||||||
|
|
||||||
|
QMap<QString, VirtualDir> m_virtualDirs; // 虚拟目录
|
||||||
|
QStringList m_includeDirs; // 包含目录
|
||||||
|
QStringList m_libraries; // 库文件
|
||||||
|
QStringList m_defines; // 编译宏
|
||||||
|
QStringList m_compilerOptions; // 自定义编译选项
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // PROJECTCONFIG_H
|
||||||
Reference in New Issue
Block a user