### tree at runtime by the runtime loader... because whatever library depends upon
### libelf.so.1 does not include a RPATH/RUNPATH
LIBS += -lsqlite3 -lqwt $$GRPC_LIBS -lpgsbox -lcpgplot -lpgplot -lwcs -lcfitsio -llapack -lgsl -lgslcblas -lblas -lgfortran -lelf -lrt
QMAKE_CXXFLAGS += -DCASATOOLS -DCASA6 -DCASADATA=\\\"/home/casa/data/trunk\\\"
MAC_THIRD_PARTY_PATH = "/opt/local"
MAC_THIRD_PARTY_PATH = "/opt/casa/02"
message("Found /opt/casa/02")
MAC_THIRD_PARTY_PATH = "/opt/casa/03"
message("Found /opt/casa/03")
include ( $$[QT_INSTALL_DATA]/mkspecs/features/qwt.prf )
INCLUDEPATH += $$GRPC_INCLUDE
INCLUDEPATH += $$MAC_THIRD_PARTY_PATH/include
LIBDIR_LIST = $$MAC_THIRD_PARTY_PATH/lib $$MAC_THIRD_PARTY_PATH/lib/gcc5
LIBS += -lsqlite3 $$GRPC_LIBS -lpgsbox_nox -lcpgplot_nox -lpgplot_nox -lwcs -lcfitsio -llapack -lblas -lgsl -lgfortran
#QMAKE_CXXFLAGS += -g -O0 -fsanitize=address -fno-omit-frame-pointer -DCASATOOLS -DCASA6
QMAKE_CXXFLAGS += -DCASATOOLS -DCASA6
OBJECTS_DIR = build/lib.$$QMAKE_HOST.version/objs
RCC_DIR = build/lib.$$QMAKE_HOST.version/rcc
UI_DIR = build/include.$$QMAKE_HOST.version/ui
CONFIG += object_parallel_to_source
QMAKE_CXXFLAGS += -std=c++11 -DUseCasacoreNamespace -DNO_CRASH_REPORTER -DAIPS_LINUX -DCASA6
QT += xml widgets printsupport
# add your own with quoting gyrations to make sure $ORIGIN gets to the command line unexpanded
QMAKE_LFLAGS += "-Wl,-rpath,\'\$$ORIGIN/../lib\'"
DESTDIR = build/bin.$$QMAKE_HOST.version/casaviewer.app/usr/bin
QMAKE_POST_LINK = scripts/create-app --no-data name=viewer exe=$$DESTDIR/$$TARGET app=$$APP lib=$$DESTDIR/../lib tgt=$$lower($$QMAKE_HOST.os) plugins=$$[QT_INSTALL_PLUGINS] $$GRPC_PATH $$RPATH_LIBS
APP_EXE = build/bin.$$QMAKE_HOST.version/$${TARGET}-x86_64.AppImage
# clang++ required for address sanitizer to work
# suppress the default RPATH if you wish
# add your own with quoting gyrations to make sure $ORIGIN gets to the command line unexpanded
#QMAKE_LFLAGS += "-fsanitize=address -fno-omit-frame-pointer -Wl,-rpath,\'@loader_path/../Frameworks\'"
QMAKE_LFLAGS += "-Wl,-rpath,\'@loader_path/../Frameworks\'"
DESTDIR = build/bin.$$QMAKE_HOST.version
APP = $$DESTDIR/$${TARGET}.app
QMAKE_POST_LINK = scripts/create-app --no-data name=viewer exe=$$DESTDIR/$${TARGET}.app/Contents/MacOS/$$TARGET app=$$APP lib=$$DESTDIR/$${TARGET}.app/Contents/Frameworks tgt=$$lower($$QMAKE_HOST.os) plugins=$$[QT_INSTALL_PLUGINS] $$GRPC_PATH $$MAC_THIRD_PARTY_PATH/lib $$RPATH_LIBS
fortran.name = Generate .o file for ${QMAKE_FILE_BASE}.f
fortran.input = FORTRAN_SOURCE # variable containing our input files