Last active
February 26, 2018 13:02
-
-
Save lixingcong/a6fddb5fc851c43cc215d465da1e0ee7 to your computer and use it in GitHub Desktop.
QT下的qmake的Makefile模板
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# C++ objects and libs | |
*.slo | |
*.lo | |
*.o | |
*.a | |
*.la | |
*.lai | |
*.so | |
*.dll | |
*.dylib | |
# Qt-es | |
object_script.*.Release | |
object_script.*.Debug | |
*_plugin_import.cpp | |
/.qmake.cache | |
/.qmake.stash | |
*.pro.user | |
*.pro.user.* | |
*.qbs.user | |
*.qbs.user.* | |
*.moc | |
moc_*.cpp | |
moc_*.h | |
qrc_*.cpp | |
ui_*.h | |
*.qmlc | |
*.jsc | |
*build-* | |
# Qt unit tests | |
target_wrapper.* | |
# QtCreator | |
*.autosave | |
# QtCreator Qml | |
*.qmlproject.user | |
*.qmlproject.user.* | |
# QtCreator CMake | |
CMakeLists.txt.user* | |
# my build dir | |
build/* | |
!build/.noempty | |
*.mk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PROJECT_NAME=qt-demo | |
QTMAKE_MK=$(PROJECT_NAME)-qtmake.mk | |
PROJECT_FILE=$(PROJECT_NAME).pro | |
all: $(QTMAKE_MK) | |
$(MAKE) -f $^ | |
$(QTMAKE_MK): $(PROJECT_FILE) | |
qmake -r -o $@ $^ | |
.PHONY: clean | |
clean: $(QTMAKE_MK) | |
$(MAKE) -f $^ clean | |
rm -rf $^ | |
.PHONY: install | |
install: $(QTMAKE_MK) | |
$(MAKE) -f $^ install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
QT += core gui | |
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets | |
TARGET = qt-demo | |
TEMPLATE = app | |
# You must create the dir 'build' first | |
DESTDIR=build | |
OBJECTS_DIR=build | |
MOC_DIR=build | |
UI_DIR=build | |
SOURCES += main.cpp\ | |
mainwindow.cpp\ | |
subdir/People.cpp | |
HEADERS += mainwindow.h\ | |
subdir/People.h | |
FORMS += mainwindow.ui |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
添加至Eclipse工程:
关键点:
不同平台有不同设置:
对于Linux,仅需在Bash中执行一次make,观察make之后的g++的inlude目录,逐一添加到Eclipse的Include Paths中
对于Windows,比较复杂:
F:\Program Files\Git\usr\bin