diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a53cc1c --- /dev/null +++ b/.gitignore @@ -0,0 +1,13 @@ +# Build artifacts +*.o +moc_*.cpp +moc_predefs.h +Makefile +VoiletCStudio +.qmake.stash + +# IDE +.vscode/ +.idea/ +*.user +*.pro.user diff --git a/Makefile b/Makefile deleted file mode 100644 index efc0a95..0000000 --- a/Makefile +++ /dev/null @@ -1,444 +0,0 @@ -############################################################################# -# 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: - diff --git a/README.md b/README.md index 775add4..c75561f 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ Qt5 跨平台 C 工程配置器,自动生成 CMakeLists.txt +> 版本:v1.1 · 2026-04-28 + --- ## 🚀 功能特性 @@ -9,13 +11,15 @@ Qt5 跨平台 C 工程配置器,自动生成 CMakeLists.txt ### 1. 工程配置管理 - ✅ JSON 格式配置文件 - ✅ 新建/打开/保存工程 +- ✅ 拖拽 JSON 文件打开 - ✅ Ctrl+S 快速保存 ### 2. 编译工具链配置 - ✅ 编译器路径选择 - ✅ 汇编器路径选择 - ✅ 链接器路径选择 -- ✅ 支持 MinGW/GCC/Clang +- ✅ 支持 MinGW / GCC / Clang +- ✅ Windows 下自动识别 MinGW 工具链 ### 3. 文件管理 - ✅ 虚拟目录(类似 MDK) @@ -26,55 +30,64 @@ Qt5 跨平台 C 工程配置器,自动生成 CMakeLists.txt ### 4. 编译配置 - ✅ 编译宏定义 - ✅ 自定义编译选项 -- ✅ Debug/Release 模式 +- ✅ Debug / Release 模式 ### 5. CMake 生成 - ✅ 自动生成 CMakeLists.txt -- ✅ 支持 make debug/release -- ✅ 跨平台兼容 +- ✅ 编译器路径在 `project()` 之前设置,避免默认回退到 NMake +- ✅ Windows 下自动指定 `-G "MinGW Makefiles"` 生成器 +- ✅ 内置一键编译(Debug / Release) --- ## 📋 使用方法 -### 编译 +### 编译 VoiletCStudio + +**Linux:** ```bash cd VoiletCStudio qmake make ``` +**Windows (MSYS2/MinGW):** +```bash +cd VoiletCStudio +qmake +mingw32-make +``` + ### 运行 ```bash -./VoiletCStudio +./VoiletCStudio # Linux +VoiletCStudio.exe # Windows ``` ### 使用流程 -1. 新建工程 -2. 配置编译器路径 -3. 添加虚拟目录和源文件 +1. 新建工程 → 输入工程名 +2. 配置编译器路径(Windows 选 `gcc.exe`) +3. 添加虚拟目录和 .c 源文件 4. 添加包含目录和库文件 5. 添加编译宏和选项 6. 保存工程(JSON) -7. 生成 CMakeLists.txt -8. 使用 CMake 编译 +7. 点击「生成 CMake」→ 自动生成 CMakeLists.txt +8. 点击「编译 Debug / Release」→ 一键编译 --- ## 🛠️ CMake 使用 ```bash -# 配置 +# Linux / macOS cmake -B build +make debug # 编译 Debug +make release # 编译 Release -# 编译 Debug -make debug - -# 编译 Release -make release - -# 或直接使用 -cmake --build build --config Debug +# Windows (MinGW) +cmake -G "MinGW Makefiles" -B build +mingw32-make debug +mingw32-make release ``` --- @@ -84,24 +97,31 @@ cmake --build build --config Debug ``` VoiletCStudio/ ├── src/ -│ ├── main.cpp # 主程序入口 -│ ├── mainwindow.cpp/h # 主窗口 -│ ├── projectconfig.cpp/h # 配置管理 +│ ├── main.cpp # 主程序入口 +│ ├── mainwindow.cpp/h # 主窗口(含编译流程) +│ ├── projectconfig.cpp/h # 配置管理 │ └── cmakegenerator.cpp/h # CMake 生成 -├── resources/ # 资源文件 -├── VoiletCStudio.pro # Qt 项目文件 -└── README.md # 说明文档 +├── VoiletCStudio.pro # Qt 项目文件 +├── README.md # 说明文档 +└── 需求规格说明书.md # 详细需求文档 ``` --- ## 💻 跨平台支持 -| 平台 | 编译器 | 状态 | -|------|--------|------| -| Windows | MinGW | ✅ | -| Linux | GCC | ✅ | -| macOS | Clang | ✅ | +| 平台 | 编译器 | 生成器 | 状态 | +|------|--------|--------|------| +| Windows | MinGW (MSYS2) | MinGW Makefiles | ✅ | +| Windows | MSVC | NMake | ⚠️ 未测试 | +| Linux | GCC | Unix Makefiles | ✅ | +| macOS | Clang | Unix Makefiles | ✅ | + +### Windows 特别注意 +- 必须安装 **MSYS2** 并安装 `mingw-w64-gcc`、`mingw-w64-cmake` +- 编译器路径示例:`C:/msys2/mingw64/bin/gcc.exe` +- CMake 生成时程序自动使用 `-G "MinGW Makefiles"` +- 构建时使用 `mingw32-make` 而非 `make` --- @@ -111,7 +131,10 @@ VoiletCStudio/ { "projectName": "MyProject", "projectPath": "/path/to/project", + "outputDir": "./build", "compilerPath": "/usr/bin/gcc", + "assemblerPath": "/usr/bin/gcc", + "linkerPath": "/usr/bin/gcc", "virtualDirs": { "App": { "name": "App", @@ -127,11 +150,24 @@ VoiletCStudio/ --- +## 🔧 技术要点 + +### 编译器设置顺序 +CMakeLists.txt 中 `CMAKE_C_COMPILER` **必须在 `project()` 之前设置**,否则 CMake 会在 `project()` 时自动检测编译器并可能回退到不存在的 NMake。 + +### Windows 生成器 +程序通过 `#ifdef Q_OS_WIN32` 编译期检测平台,在 Windows 上自动: +- CMake 添加 `-G "MinGW Makefiles"` 参数 +- 构建时使用 `mingw32-make` 替代 `make` +- 自动从编译器路径推导 `CMAKE_MAKE_PROGRAM` + +--- + ## 🎯 特色 - **类 MDK 虚拟目录**:像 Keil MDK 一样管理源文件 - **一键生成 CMake**:自动生成完整的 CMakeLists.txt -- **跨平台**:Windows/Linux/macOS 全支持 +- **真正跨平台**:Windows (MinGW) / Linux / macOS 全支持,自动化平台适配 - **轻量级**:纯 Qt5 实现,无额外依赖 --- @@ -143,4 +179,4 @@ MIT License --- **作者:虾哥** -**日期:2026-04-09** +**日期:2026-04-09 · 更新:2026-04-28** diff --git a/VoiletCStudio b/VoiletCStudio deleted file mode 100755 index abbcc2d..0000000 Binary files a/VoiletCStudio and /dev/null differ diff --git a/cmakegenerator.o b/cmakegenerator.o deleted file mode 100644 index 80308d8..0000000 Binary files a/cmakegenerator.o and /dev/null differ diff --git a/main.o b/main.o deleted file mode 100644 index adfbb7b..0000000 Binary files a/main.o and /dev/null differ diff --git a/mainwindow.o b/mainwindow.o deleted file mode 100644 index 1661d04..0000000 Binary files a/mainwindow.o and /dev/null differ diff --git a/moc_cmakegenerator.cpp b/moc_cmakegenerator.cpp deleted file mode 100644 index 2ca96f0..0000000 --- a/moc_cmakegenerator.cpp +++ /dev/null @@ -1,155 +0,0 @@ -/**************************************************************************** -** 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 -#include "src/cmakegenerator.h" -#include -#include -#if !defined(Q_MOC_OUTPUT_REVISION) -#error "The header file 'cmakegenerator.h' doesn't include ." -#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(_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(_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(), - 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(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(_a[0]) = -1; - _id -= 2; - } - return _id; -} - -// SIGNAL 0 -void CMakeGenerator::cmakeGenerated(const QString & _t1) -{ - void *_a[] = { nullptr, const_cast(reinterpret_cast(std::addressof(_t1))) }; - QMetaObject::activate(this, &staticMetaObject, 0, _a); -} - -// SIGNAL 1 -void CMakeGenerator::errorOccurred(const QString & _t1) -{ - void *_a[] = { nullptr, const_cast(reinterpret_cast(std::addressof(_t1))) }; - QMetaObject::activate(this, &staticMetaObject, 1, _a); -} -QT_WARNING_POP -QT_END_MOC_NAMESPACE diff --git a/moc_cmakegenerator.o b/moc_cmakegenerator.o deleted file mode 100644 index 8751526..0000000 Binary files a/moc_cmakegenerator.o and /dev/null differ diff --git a/moc_mainwindow.cpp b/moc_mainwindow.cpp deleted file mode 100644 index bd20d24..0000000 --- a/moc_mainwindow.cpp +++ /dev/null @@ -1,233 +0,0 @@ -/**************************************************************************** -** 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 -#include "src/mainwindow.h" -#include -#include -#if !defined(Q_MOC_OUTPUT_REVISION) -#error "The header file 'mainwindow.h' doesn't include ." -#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(_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(), - 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(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(_a[0]) = -1; - _id -= 26; - } - return _id; -} -QT_WARNING_POP -QT_END_MOC_NAMESPACE diff --git a/moc_mainwindow.o b/moc_mainwindow.o deleted file mode 100644 index cf86445..0000000 Binary files a/moc_mainwindow.o and /dev/null differ diff --git a/moc_projectconfig.cpp b/moc_projectconfig.cpp deleted file mode 100644 index 92417a2..0000000 --- a/moc_projectconfig.cpp +++ /dev/null @@ -1,134 +0,0 @@ -/**************************************************************************** -** 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 -#include "src/projectconfig.h" -#include -#include -#if !defined(Q_MOC_OUTPUT_REVISION) -#error "The header file 'projectconfig.h' doesn't include ." -#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(_o); - (void)_t; - switch (_id) { - case 0: _t->configChanged(); break; - default: ; - } - } else if (_c == QMetaObject::IndexOfMethod) { - int *result = reinterpret_cast(_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(), - 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(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(_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 diff --git a/moc_projectconfig.o b/moc_projectconfig.o deleted file mode 100644 index 056060b..0000000 Binary files a/moc_projectconfig.o and /dev/null differ diff --git a/projectconfig.o b/projectconfig.o deleted file mode 100644 index a8eda6b..0000000 Binary files a/projectconfig.o and /dev/null differ diff --git a/src/cmakegenerator.cpp b/src/cmakegenerator.cpp index fe07111..7e7bd6e 100644 --- a/src/cmakegenerator.cpp +++ b/src/cmakegenerator.cpp @@ -1,5 +1,6 @@ #include "cmakegenerator.h" #include +#include #include #include #include @@ -93,7 +94,36 @@ QString CMakeGenerator::generateProjectConfig(const ProjectConfig *config) projectName = "UntitledProject"; } - content += "# 项目名称\n"; + // ===== 编译器必须在 project() 之前设置,否则 CMake 会默认用 NMake ===== + content += "# ========================================\n"; + content += "# 编译器配置(必须在 project() 之前)\n"; + content += "# ========================================\n\n"; + + QString compilerPath = config->getCompilerPath(); + QString assemblerPath = config->getAssemblerPath(); + QString linkerPath = config->getLinkerPath(); + + if (!compilerPath.isEmpty() && compilerPath != "gcc") { + content += "set(CMAKE_C_COMPILER \"" + compilerPath + "\")\n"; + + // 如果编译器是 MinGW 路径,自动推导 make 程序目录 + // 例如:C:/msys2/mingw64/bin/gcc.exe → C:/msys2/mingw64/bin/mingw32-make.exe + if (compilerPath.contains("mingw", Qt::CaseInsensitive)) { + QString makeDir = QFileInfo(compilerPath).path(); // path() 正确保留绝对路径的盘符 + content += "set(CMAKE_MAKE_PROGRAM \"" + makeDir + "/mingw32-make.exe\")\n"; + } + } + + if (!assemblerPath.isEmpty() && assemblerPath != "gcc") { + content += "set(CMAKE_ASM_COMPILER \"" + assemblerPath + "\")\n"; + } + + if (!linkerPath.isEmpty() && linkerPath != "gcc" && linkerPath != compilerPath) { + content += "set(CMAKE_C_LINK_EXECUTABLE \"" + linkerPath + " -o \")\n"; + } + content += "\n"; + + content += "# 项目名称(编译器已设置,不再尝试检测)\n"; content += "project(" + projectName + " C)\n\n"; content += "# C 标准\n"; @@ -111,13 +141,6 @@ QString CMakeGenerator::generateProjectConfig(const ProjectConfig *config) 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; } @@ -244,7 +267,7 @@ QString CMakeGenerator::generateCompilerOptions(const ProjectConfig *config) return content; } -QString CMakeGenerator::generateBuildTargets(const ProjectConfig *config) +QString CMakeGenerator::generateBuildTargets(const ProjectConfig * /*config*/) { QString content; diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 46a3607..60f0b5c 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -49,37 +49,37 @@ void MainWindow::setupUI() QPushButton *openBtn = new QPushButton("📂 打开工程"); openBtn->setMinimumHeight(35); - openBtn->setStyleSheet("QPushButton { background: #2196F3; color: white; font-weight: bold; }"); + openBtn->setStyleSheet("QPushButton { background: #1565C0; color: white; font-weight: bold; border: none; border-radius: 4px; padding: 6px 16px; }"); 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; }"); + newBtn->setStyleSheet("QPushButton { background: #2E7D32; color: white; font-weight: bold; border: none; border-radius: 4px; padding: 6px 16px; }"); 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; }"); + saveButton->setStyleSheet("QPushButton { background: #E65100; color: white; font-weight: bold; border: none; border-radius: 4px; padding: 6px 16px; }"); 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; }"); + generateButton->setStyleSheet("QPushButton { background: #6A1B9A; color: white; font-weight: bold; border: none; border-radius: 4px; padding: 6px 16px; }"); 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; }"); + debugBtn->setStyleSheet("QPushButton { background: #00838F; color: white; font-weight: bold; border: none; border-radius: 4px; padding: 6px 16px; }"); 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; }"); + releaseBtn->setStyleSheet("QPushButton { background: #AD1457; color: white; font-weight: bold; border: none; border-radius: 4px; padding: 6px 16px; }"); connect(releaseBtn, &QPushButton::clicked, this, &MainWindow::compileRelease); actionLayout->addWidget(releaseBtn); @@ -553,7 +553,15 @@ void MainWindow::generateCMake() // 在 build 目录执行 cmake QProcess process; process.setWorkingDirectory(buildDir); - process.start("cmake", QStringList() << ".."); + + // 跨平台:Windows 必须指定 MinGW Makefiles 生成器 + QStringList cmakeArgs; +#ifdef Q_OS_WIN32 + cmakeArgs << "-G" << "MinGW Makefiles" << ".."; +#else + cmakeArgs << ".."; +#endif + process.start("cmake", cmakeArgs); process.waitForFinished(10000); QString output = process.readAllStandardOutput(); @@ -820,7 +828,7 @@ void MainWindow::compileProject(const QString &buildType) QPushButton *closeBtn = new QPushButton("❌ 关闭"); closeBtn->setMinimumHeight(35); - closeBtn->setStyleSheet("QPushButton { background: #f44336; color: white; font-weight: bold; font-size: 14px; }"); + closeBtn->setStyleSheet("QPushButton { background: #C62828; color: white; font-weight: bold; font-size: 14px; border: none; border-radius: 4px; padding: 6px 16px; }"); dialogLayout->addWidget(closeBtn); compileDialog->show(); @@ -829,7 +837,15 @@ void MainWindow::compileProject(const QString &buildType) outputEdit->append("📋 正在配置 CMake...\n"); QProcess cmakeProcess; cmakeProcess.setWorkingDirectory(buildDir); - cmakeProcess.start("cmake", QStringList() << "-DCMAKE_BUILD_TYPE=" + buildType << ".."); + + // 跨平台:Windows 必须指定 MinGW Makefiles 生成器 + QStringList cmakeArgs; +#ifdef Q_OS_WIN32 + cmakeArgs << "-G" << "MinGW Makefiles" << "-DCMAKE_BUILD_TYPE=" + buildType << ".."; +#else + cmakeArgs << "-DCMAKE_BUILD_TYPE=" + buildType << ".."; +#endif + cmakeProcess.start("cmake", cmakeArgs); cmakeProcess.waitForFinished(30000); outputEdit->append(cmakeProcess.readAllStandardOutput()); @@ -838,11 +854,17 @@ void MainWindow::compileProject(const QString &buildType) outputEdit->append("⚠️ CMake 警告/错误:\n" + cmakeError); } - // 执行 make + // 执行构建(跨平台:Windows 用 mingw32-make,Linux/macOS 用 make) outputEdit->append("\n🔨 正在编译 " + buildType + "...\n"); QProcess makeProcess; makeProcess.setWorkingDirectory(buildDir); - makeProcess.start("make", QStringList() << buildType.toLower()); + +#ifdef Q_OS_WIN32 + QString makeCmd = "mingw32-make"; +#else + QString makeCmd = "make"; +#endif + makeProcess.start(makeCmd, QStringList() << buildType.toLower()); // 实时输出 connect(&makeProcess, &QProcess::readyReadStandardOutput, [&outputEdit, &makeProcess]() { diff --git a/需求规格说明书.md b/需求规格说明书.md index 13fe80e..20d2bfb 100644 --- a/需求规格说明书.md +++ b/需求规格说明书.md @@ -1,8 +1,9 @@ # VoiletCStudio 需求规格说明书 -**版本号:** v1.0 +**版本号:** v1.1 **项目名称:** 紫罗兰 C 工程配置器(VoiletCStudio) **开发日期:** 2026-04-09 +**最后更新:** 2026-04-28 **作者:** 虾哥 --- @@ -525,6 +526,7 @@ add_custom_target(release | 版本 | 日期 | 更新内容 | |------|------|---------| | v1.0 | 2026-04-09 | 初始版本,完整功能发布 | +| v1.1 | 2026-04-28 | 修复 Windows 跨平台兼容性:CMAKE_C_COMPILER 设置提前到 project() 之前;自动添加 MinGW Makefiles 生成器;mingw32-make 替代 make;按钮高对比度配色优化 | ---