# This is example of login script, required for compilation 
# of complete Go4 and user analyses under CYGWIN environment
#
# First ensure that all software components: CYGWIN, Microsoft VisualC, ROOT and Qt are installed.
#
# Qt package should be compiled with VisualC - like qt-win-opensource-4.8.2-vs2012.exe. 
# Do not try to install MinGW version - it uses unsuitable compiler version.
# Install Qt into the path without spaces.
#
# To be able use VisualC from cygwin, one should call
#  vcvarsall.bat file from the Cygwin.bat. 
#  Insert following line into Cygwin.bat before bash:
#     call E:\Soft\VC2012\VC\vcvarsall.bat"
#
#  One also must ensure that link.exe from VisualC is used. 
#  Problem description and several solutions can be found here:
#     https://developer.mozilla.org/en/Windows_build_prerequisites_using_cygwin#Fix_cygwin_path
#  Simplest solution - just delete or rename link.exe from cygwin;
#  preferable - change sequence of $PATH. 
#
#                                          
# Adjust windows paths for ROOT, Qt and Go4


if [[ "x$BASH_SOURCE" != "x" ]]; then 
   MAIN_DIR=`dirname $BASH_SOURCE`
else
   MAIN_DIR=`dirname $0`
fi

# one could set MAIN_DIR directely
# MAIN_DIR=/cygdrive/c/Soft

export GO4_OS=Win32

export GO4SYS=$MAIN_DIR/go4
export ROOTSYS=$MAIN_DIR/root

export LD_LIBRARY_PATH=$ROOTSYS/lib:$GO4SYS/lib:$LD_LIBRARY_PATH
export PATH=$ROOTSYS/bin:$GO4SYS/bin:$PATH

ROOT_DIR=`cygpath -w $ROOTSYS`
GO4_DIR=`cygpath -w $GO4SYS`

export LIB="$ROOT_DIR\lib;$GO4_DIR\lib;$LIB"

echo "Configure go4 environment"
echo "   ROOTSYS = $ROOTSYS"
echo "   GO4SYS = $GO4SYS"

# specify actual location of qt5 here
QTDIR=/cygdrive/c/Qt/5.2.16/msvc2017

if [ -d $QTDIR ]; then
  echo "   QTDIR = $QTDIR"
  export QTDIR
  export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$QTDIR/lib
  export PATH=$PATH:$QTDIR/bin
  export QMAKESPEC=win32-msvc
  QT_PATH=`cygpath $QTDIR`
  export LIB="$LIB;$QT_PATH\lib;"
fi

