Qmake 多文件编译 在项目中的使用

来源:互联网 发布:砸金蛋程序源码 编辑:程序博客网 时间:2024/05/22 17:24

毕设在linux下进行,无界面版本已经ok,然后选择了QT作为GUI开发工具。

因为编译QT需要qmake,所以顺便学了qmake的简单使用,把原项目的makefile改为qmake。

 写qmake比纯手写makefile简单不少,提高效率。注意下路径、LIBS、INCLUDEPATH等内容就行了。

1.原makefile:

  

  CFLAGS = -I ../../include/    HEADPATH =../../include/    MYSQL=-L /usr/include/mysql    helloworld: init.o sqlToCache.o dataCache.o process.o detect_acvl.o g++  -o helloworld  init.o sqlToCache.o dataCache.o process.o detect_acvl.o -lpthread -L/usr/lib/mysql -lmysqlclient -lz    init.o: init.cpp $(HEADPATH)sniffer_sqlToCache.h $(HEADPATH)decoder_dataCache.h $(HEADPATH)preprocessor_process.h $(HEADPATH)detect_acvl.hg++ -c $(CFLAGS) init.cpp -lpthread    sqlToCache.o: ../Sniffer/sqlToCache.cpp $(HEADPATH)decoder_dataCache.hg++ -c  $(CFLAGS) -I/usr/include/mysql -L/usr/lib/mysql -lmysqlclient -lz $(mysql_config --cflags) ../Sniffer/sqlToCache.cpp $(mysql_config --libs) -lpthread     dataCache.o: ../Decoder/dataCache.cpp $(HEADPATH)decoder_dataCache.hg++ -c $(CFLAGS) ../Decoder/dataCache.cpp    process.o: ../Preprocessor/process.cpp $(HEADPATH)preprocessor_process.h $(HEADPATH)detect_acvl.hg++ -c $(CFLAGS) ../Preprocessor/process.cpp    detect_acvl.o: ../DetectionEngine/detect_acvl.cpp $(HEADPATH)detect_acvl.hg++ -c $(CFLAGS) -I/usr/include/mysql -L/usr/lib/mysql -lmysqlclient  -lz  $(mysql_config --cflags) ../DetectionEngine/detect_acvl.cpp $(mysql_config --libs)     clean :rm *.o


2.改为qmake,IDS.pro中需要改写的内容:

####################################################################### Automatically generated by qmake (2.01a) ?? 3? 19 19:00:42 2014######################################################################TEMPLATE = appLIBS += -L/usr/lib/mysql -lmysqlclient -lzTARGET = DEPENDPATH += . \              include \              src/Decoder \              src/DetectionEngine \              src/init \              src/Preprocessor \              src/Sniffer \INCLUDEPATH += . include \              /usr/include/mysql \# InputHEADERS += include/decoder_dataCache.h \           include/detect_acvl.h \           include/preprocessor_process.h \           include/sniffer_sqlToCache.hSOURCES += src/Decoder/dataCache.cpp \           src/DetectionEngine/detect_acvl.cpp \           src/init/init.cpp \           src/Preprocessor/process.cpp \           src/Sniffer/sqlToCache.cpp \



0 0
原创粉丝点击