Created
September 18, 2014 21:58
-
-
Save jmacey/d130a42cf7c6c28aa9b4 to your computer and use it in GitHub Desktop.
Basic Qt Project
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
# This specifies the exe name | |
TARGET=SimpleNGL | |
# where to put the .o files | |
OBJECTS_DIR=obj | |
# core Qt Libs to use add more here if needed. | |
QT+=gui opengl core | |
# as I want to support 4.8 and 5 this will set a flag for some of the mac stuff | |
# mainly in the types.h file for the setMacVisual which is native in Qt5 | |
isEqual(QT_MAJOR_VERSION, 5) { | |
cache() | |
DEFINES +=QT5BUILD | |
} | |
# where to put moc auto generated files | |
MOC_DIR=moc | |
# on a mac we don't create a .app bundle file ( for ease of multiplatform use) | |
CONFIG-=app_bundle | |
# Auto include all .cpp files in the src directory (can specifiy individually if required) | |
SOURCES+= src/*.cpp | |
# same for the .h files | |
HEADERS+= include/*.h | |
# and add the include dir into the search path for Qt and make | |
INCLUDEPATH +=./include | |
# where our exe is going to live (root of project) | |
DESTDIR=./ | |
# add the glsl shader files | |
OTHER_FILES+= shaders/*.glsl | |
# were are going to default to a console app | |
CONFIG += console | |
# note each command you add needs a ; as it will be run as a single line | |
# first check if we are shadow building or not easiest way is to check out against current | |
!equals(PWD, $${OUT_PWD}){ | |
copydata.commands = echo "creating destination dirs" ; | |
# now make a dir | |
copydata.commands += mkdir -p $$OUT_PWD/shaders ; | |
copydata.commands += echo "copying files" ; | |
# then copy the files | |
copydata.commands += $(COPY_DIR) $$PWD/shaders/* $$OUT_PWD/shaders/ ; | |
# now make sure the first target is built before copy | |
first.depends = $(first) copydata | |
export(first.depends) | |
export(copydata.commands) | |
# now add it as an extra target | |
QMAKE_EXTRA_TARGETS += first copydata | |
} | |
# use this to suppress some warning from boost | |
QMAKE_CXXFLAGS_WARN_ON += "-Wno-unused-parameter" | |
# basic compiler flags (not all appropriate for all platforms) | |
QMAKE_CXXFLAGS+= -msse -msse2 -msse3 | |
macx:QMAKE_CXXFLAGS+= -arch x86_64 | |
macx:INCLUDEPATH+=/usr/local/include/ | |
linux-g++:QMAKE_CXXFLAGS += -march=native | |
linux-g++-64:QMAKE_CXXFLAGS += -march=native | |
# define the _DEBUG flag for the graphics lib | |
DEFINES +=NGL_DEBUG | |
unix:LIBS += -L/usr/local/lib | |
# add the ngl lib | |
unix:LIBS += -L/$(HOME)/NGL/lib -l NGL | |
# now if we are under unix and not on a Mac (i.e. linux) | |
linux-*{ | |
linux-*:QMAKE_CXXFLAGS += -march=native | |
DEFINES += LINUX | |
} | |
DEPENDPATH+=include | |
# if we are on a mac define DARWIN | |
macx:DEFINES += DARWIN | |
# this is where to look for includes | |
INCLUDEPATH += $$(HOME)/NGL/include/ | |
win32: { | |
PRE_TARGETDEPS+=C:/NGL/lib/NGL.lib | |
INCLUDEPATH+=-I c:/boost | |
DEFINES+=GL42 | |
DEFINES += WIN32 | |
DEFINES+=_WIN32 | |
DEFINES+=_USE_MATH_DEFINES | |
LIBS += -LC:/NGL/lib/ -lNGL | |
DEFINES+=NO_DLL | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment