Skip to content

Instantly share code, notes, and snippets.

@DougBeney
Last active February 13, 2018 16:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DougBeney/81a4eb9467388e2dac7262aefc0dedd8 to your computer and use it in GitHub Desktop.
Save DougBeney/81a4eb9467388e2dac7262aefc0dedd8 to your computer and use it in GitHub Desktop.
QT Makefile without QMake or QT Creator
#########################################
# Welcome! #
# This file is intended for Mac OS X, #
# but can work on any other operating #
# systems if you change QT_INSTALL_PATH #
# -Created by @DougBeney #
#########################################
# In the first two lines, I define the source (.cpp) file and the desired output file to be created (./hello)
SOURCE = hello.cpp
OUTPUT = hello
# This variable is used as a quick reference to the QT install path. This is my custom install directory on Mac OS X.
QT_INSTALL_PATH = /usr/local/qt/5.9.1/clang_64
# This is where you would provide the proper includes depending on your project's needs
INCLUDES = -I$(QT_INSTALL_PATH)/lib/QtWidgets.framework/Headers
#This is the RPATH. To be honest, I am not completely sure of what it does, but it is neccesary.
RPATH = -Wl,-rpath,$(QT_INSTALL_PATH)/lib
#Here is where you link your frameworks
FRAMEWORKS = -F$(QT_INSTALL_PATH)/lib -framework QtCore -framework QtWidgets
# The main action that happens when you type "make"
all:
# We run the g++ command and make sure we use c++11 with the second argument. Then after that, we simply plugin in our previous variables.
g++ -std=c++11 $(SOURCE) $(INCLUDES) $(FRAMEWORKS) $(RPATH) -o $(OUTPUT)
@Roman600
Copy link

Hi. Where is moc invocation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment