#! /bin/tcsh -ef

#
# qt_setup
#
# Setup QT for apps using the QT package included with Freesurfer
#
# Original Author: Nick Schmansky
# CVS Revision Info:
#    $Author: krish $
#    $Date: 2011/03/11 23:21:08 $
#    $Revision: 1.1 $
#
# Copyright © 2011 The General Hospital Corporation (Boston, MA) "MGH"
#
# Terms and conditions for use, reproduction, distribution and contribution
# are found in the 'FreeSurfer Software License Agreement' contained
# in the file 'LICENSE' found in the FreeSurfer distribution, and here:
#
# https://surfer.nmr.mgh.harvard.edu/fswiki/FreeSurferSoftwareLicense
#
# Reporting: freesurfer@nmr.mgh.harvard.edu
#
#

### --  use NMR Center QT package -- ####

if ( $?FREESURFER_HOME && ! $?MY_QT_HOME ) then
  if ( -e $FREESURFER_HOME/lib/qt ) then
    set FS_QT_HOME=$FREESURFER_HOME/lib/qt
  else if ( -e /usr/pubsw/packages/qt/current ) then
    set FS_QT_HOME=/usr/pubsw/packages/qt/current
  endif
else if ( $?MY_QT_HOME ) then
  set FS_QT_HOME=$MY_QT_HOME
else if ( -e /usr/pubsw/packages/qt/current ) then
  set FS_QT_HOME=/usr/pubsw/packages/qt/current
endif

if ( $?FS_QT_HOME ) then

  if ( -e $FS_QT_HOME/bin ) then
    setenv PATH "$FS_QT_HOME/bin":"$PATH"
  endif

  if ( -e $FS_QT_HOME/lib ) then

    setenv QTLIBPATH $FS_QT_HOME/lib
    if ( -e $FS_QT_HOME/lib/qt ) then
      setenv QTLIBPATH $FS_QT_HOME/lib/
    endif

    if(! $?LD_LIBRARY_PATH ) then
      setenv LD_LIBRARY_PATH $QTLIBPATH
    else
      setenv LD_LIBRARY_PATH "$QTLIBPATH":"$LD_LIBRARY_PATH"
    endif
    if(! $?DYLD_LIBRARY_PATH ) then
      setenv DYLD_LIBRARY_PATH $QTLIBPATH
    else
      setenv DYLD_LIBRARY_PATH "$QTLIBPATH":"$DYLD_LIBRARY_PATH"
    endif

  endif

  # default: assume platform has QT libs installed somewhere
endif
