# This file contains the commands to build driver applications using the common set of plugins
# The variable PROD_NAME must be defined, and is used to optionally add NDFileMagick to $(PROD_NAME)Include.dbd

$(PROD_NAME)_DBD += commonDriverSupport.dbd
ifeq ($(USE_GRAPHICSMAGICK), YES)
$(PROD_NAME)_DBD += NDFileMagick.dbd
endif

LIB_LIBS                += ADBase netCDF
PROD_LIBS               += NDPlugin ADBase netCDF
LIB_LIBS                += calc busy sscan autosave
PROD_LIBS               += calc busy sscan autosave
LIB_LIBS                += asyn
PROD_LIBS               += asyn
LIB_LIBS                += $(EPICS_BASE_IOC_LIBS)
PROD_LIBS               += $(EPICS_BASE_IOC_LIBS)

# The following libraries are only needed for GraphicsMagick
ifeq ($(USE_GRAPHICSMAGICK), YES)
# Darwin gives a circular reference if this line is used
ifneq (darwin-x86, $(findstring darwin-x86, $(T_A)))
LIB_LIBS                += NDFileMagick
endif
PROD_LIBS               += NDFileMagick

LIB_LIBS_WIN32          += CORE_RL_Magick++_ CORE_RL_wand_ CORE_RL_magick_ 
PROD_LIBS_WIN32         += CORE_RL_Magick++_ CORE_RL_wand_ CORE_RL_magick_ 
LIB_LIBS_WIN32          += CORE_RL_coders_ CORE_RL_filters_
PROD_LIBS_WIN32         += CORE_RL_coders_ CORE_RL_filters_
LIB_LIBS_WIN32          += CORE_RL_bzlib_ CORE_RL_jbig_ CORE_RL_jp2_ CORE_RL_jpeg_ CORE_RL_lcms_
PROD_LIBS_WIN32         += CORE_RL_bzlib_ CORE_RL_jbig_ CORE_RL_jp2_ CORE_RL_jpeg_ CORE_RL_lcms_
LIB_LIBS_WIN32          += CORE_RL_libxml_ CORE_RL_png_ CORE_RL_tiff_ CORE_RL_ttf_ CORE_RL_wmf_
PROD_LIBS_WIN32         += CORE_RL_libxml_ CORE_RL_png_ CORE_RL_tiff_ CORE_RL_ttf_ CORE_RL_wmf_
LIB_LIBS_WIN32          += CORE_RL_xlib_ CORE_RL_zlib_
PROD_LIBS_WIN32         += CORE_RL_xlib_ CORE_RL_zlib_

LIB_LIBS_cygwin32       += libGraphicsMagick++ libGraphicsMagickWand libGraphicsMagick
PROD_LIBS_cygwin32      += libGraphicsMagick++ libGraphicsMagickWand libGraphicsMagick
LIB_LIBS_cygwin32       += liblcms libpng14 libbz2 libfreetype
PROD_LIBS_cygwin32      += liblcms libpng14 libbz2 libfreetype

# To use versions of these libraries supplied with areaDetector use this line
LIB_LIBS_Linux          += GraphicsMagick++ GraphicsMagickWand GraphicsMagick
PROD_LIBS_Linux         += GraphicsMagick++ GraphicsMagickWand GraphicsMagick
# To use system versions of these libraries use this line
#LIB_SYS_LIBS_Linux     += GraphicsMagick++ GraphicsMagickWand GraphicsMagick
#PROD_SYS_LIBS_Linux    += GraphicsMagick++ GraphicsMagickWand GraphicsMagick
LIB_SYS_LIBS_Linux      += gomp X11 xml2 png12 bz2 Xext freetype 
PROD_SYS_LIBS_Linux     += gomp X11 xml2 png12 bz2 Xext freetype 

# To use versions of these libraries supplied with areaDetector use this line
LIB_LIBS_Darwin         += GraphicsMagick++ GraphicsMagickWand GraphicsMagick
PROD_LIBS_Darwin        += GraphicsMagick++ GraphicsMagickWand GraphicsMagick
# To use system versions of these libraries use this line
#LIB_SYS_LIBS_Darwin    += GraphicsMagick++ GraphicsMagickWand GraphicsMagick
#PROD_SYS_LIBS_Darwin   += GraphicsMagick++ GraphicsMagickWand GraphicsMagick
# To use versions of these libraries supplied with areaDetector use this line
LIB_SYS_LIBS_Darwin     += png xml2 bz2
PROD_SYS_LIBS_Darwin    += png xml2 bz2
else
# I don't understand why we need to set this when not using GraphicsMagick, but we do
USR_LDFLAGS_WIN32       += /NODEFAULTLIB:MSVCRT.lib
LIB_LIBS_WIN32          += tiff jpeg
PROD_LIBS_WIN32         += tiff jpeg
endif
ifeq (win32-x86-debug, $(findstring win32-x86-debug, $(T_A)))
USR_LDFLAGS_WIN32       += /NODEFAULTLIB:LIBCMT.lib
endif

LIB_LIBS_WIN32          += PvAPI
PROD_LIBS_WIN32         += PvAPI
LIB_LIBS_WIN32          += NeXus hdf5 libszip zlib
PROD_LIBS_WIN32         += NeXus hdf5 libszip zlib
LIB_SYS_LIBS_WIN32      += Gdi32 Oleaut32 
PROD_SYS_LIBS_WIN32     += Gdi32 Oleaut32

LIB_LIBS_cygwin32       += NeXus libhdf5 libsz
PROD_LIBS_cygwin32      += NeXus libhdf5 libsz
LIB_LIBS_cygwin32       += libtiff libjpeg libjbig libz libxml2.dll
PROD_LIBS_cygwin32      += libtiff libjpeg libjbig libz libxml2.dll
LIB_SYS_LIBS_cygwin32   += $(CYGWIN_RPC_LIB)
PROD_SYS_LIBS_cygwin32  += $(CYGWIN_RPC_LIB)
LIB_SYS_LIBS_cygwin32   += Gdi32
PROD_SYS_LIBS_cygwin32  += Gdi32

LIB_LIBS_Linux          += PvAPI
PROD_LIBS_Linux         += PvAPI
# To use versions of these libraries supplied with areaDetector use this line
LIB_LIBS_Linux          += NeXus hdf5 sz
PROD_LIBS_Linux         += NeXus hdf5 sz
# To use system versions of these libraries use this line
#LIB_SYS_LIBS_Linux     += NeXus hdf5 sz
#PROD_SYS_LIBS_Linux    += NeXus hdf5 sz
# To use versions of these libraries supplied with areaDetector use this line
LIB_LIBS_Linux          += tiff jpeg z
PROD_LIBS_Linux         += tiff jpeg z
# To use system versions of these libraries use this line
#LIB_SYS_LIBS_Linux     += tiff jpeg z
#PROD_SYS_LIBS_Linux    += tiff jpeg z

LIB_LIBS_solaris         += NeXus hdf5
PROD_LIBS_solaris        += NeXus hdf5
LIB_SYS_LIBS_solaris     += tiff jpeg z
PROD_SYS_LIBS_solaris    += tiff jpeg z

USR_LDFLAGS_Darwin      += -framework CoreFoundation
LIB_LIBS_Darwin         += PvAPI
PROD_LIBS_Darwin        += PvAPI
LIB_LIBS_Darwin         += NeXus hdf5 sz
PROD_LIBS_Darwin        += NeXus hdf5 sz
# To use system versions of these libraries use this line
#LIB_SYS_LIBS_Darwin    += NeXus hdf5 sz
#PROD_SYS_LIBS_Darwin   += NeXus hdf5 sz
# To use versions of these libraries supplied with areaDetector use this line
LIB_LIBS_Darwin         += tiff jpeg 
PROD_LIBS_Darwin        += tiff jpeg
# To use system versions of these libraries use this line
#LIB_SYS_LIBS_Darwin    += tiff jpeg z
#PROD_SYS_LIBS_Darwin   += tiff jpeg z

