2012-11-24

Eclipse + QMake - general purpose building system

Eclipse CDT: great C++ IDE
QMake: simple but powerful make-based build system

QMake does not work only for Qt toolkit, it could be used for other projects.

How I set up CDT + QMake:

  1. get CDT and Qt
  2. configure CDT to what you like (e.g. showing line number, etc.)
  3. add 2 external tools running at project location, one runs qmake -project, and another does qmake -spec macx-g++
    1. qmake -project is used to scan the folders, and pick out what will be c++ compile. It will generate a .pro file
    2. qmake alone (or with -spec) will read the .pro file and generate the actual Makefile.
  4. make a qmake.conf file to be included in the .pro file (with a line of include(qmake.conf)). This is to separate special settings from the .pro file, which would get erased when qmake -project is run.
  5. Sample qmake.conf

    CONFIG -= qt
    CONFIG += release
    TARGET = test2
    DESTDIR = build
    MOC_DIR = build
    RCC_DIR = build
    OBJECTS_DIR = build
    INCLUDEPATH += /my/own/include
    #LIBS += -L/usr/local/lib -L/opt/local/lib -lglfw -lGLEW -lglut -lGLU -lGL
    QMAKE_CXXFLAGS += -F/System/Library/Frameworks
    QMAKE_LFLAGS += -F/System/Library/Frameworks
    LIBS += -framework GLUT -framework OpenGL
    

No comments: