0024884: expand the list of short compiler names in CMake meta-project
[occt.git] / adm / templates / env.sh.in
index 8db7672..4915aca 100644 (file)
-echo off
+#!/bin/bash
 
 aScriptPath=${BASH_SOURCE%/*}; if [ -d "${aScriptPath}" ]; then cd "$aScriptPath"; fi; aScriptPath="$PWD";
 
-FREETYPE_DIR="@3RDPARTY_FREETYPE_DLL_DIR@"
-GL2PS_DIR="@3RDPARTY_GL2PS_DLL_DIR@"
+if [ "${CASROOT}" == "" ]; then
+  export CASROOT="${aScriptPath}"
+fi
+
+# Read script arguments
+shopt -s nocasematch
+export CASDEB="@BUILD_SUFFIX@";
+if [[ "$1" == "debug" ]]; then export CASDEB="d"; fi
+if [[ "$1" == "d" ]]; then export CASDEB="d"; fi
+shopt -u nocasematch
+
+export COMPILER="@COMPILER@"
+
+# ----- Set path to 3rd party and OCCT libraries -----
+anArch=`uname -m`
+if [ "$anArch" != "x86_64" ] && [ "$anArch" != "ia64" ]; then
+  export ARCH="32";
+else
+  export ARCH="64";
+fi
 
-TBB_DIR="@3RDPARTY_TBB_DLL_DIR@"
-FREEIMAGE_DIR="@3RDPARTY_FREEIMAGE_DLL_DIR@"
+aSystem=`uname -s`
+if [ "$aSystem" == "Darwin" ]; then
+  export WOKSTATION="mac";
+  export ARCH="64";
+else
+  export WOKSTATION="lin";
+fi
 
-TCL_DIR="@3RDPARTY_TCL_DLL_DIR@"
+# ----- Set local settings -----
+if [ -e "${aScriptPath}/custom.sh" ]; then 
+  source "${aScriptPath}/custom.sh" "${COMPILER}" "${WOKSTATION}${ARCH}" "${CASDEB}"
+fi
 
-aLibPath="$aScriptPath/lib"
+THRDPARTY_PATH=""
 if [ "$TCL_DIR" != "" ]; then
-  aLibPath="${TCL_DIR}:${aLibPath}"
+  THRDPARTY_PATH="${TCL_DIR}:${THRDPARTY_PATH}"
 fi
-if [ "$TBB_DIR" != "" ]; then
-  aLibPath="${TBB_DIR}:${aLibPath}"
+
+if [ "$FREETYPE_DIR" != "" ]; then
+  THRDPARTY_PATH="${FREETYPE_DIR}:${THRDPARTY_PATH}"
 fi
+
 if [ "$FREEIMAGE_DIR" != "" ]; then
-  aLibPath="${FREEIMAGE_DIR}:${aLibPath}"
+  THRDPARTY_PATH="${FREEIMAGE_DIR}:${THRDPARTY_PATH}"
 fi
+
 if [ "$GL2PS_DIR" != "" ]; then
-  aLibPath="${GL2PS_DIR}:${aLibPath}"
-fi
-if [ "$FREETYPE_DIR" != "" ]; then
-  aLibPath="${FREETYPE_DIR}:${aLibPath}"
+  THRDPARTY_PATH="${GL2PS_DIR}:${THRDPARTY_PATH}"
 fi
 
-# ----- Set path to 3rd party and OCCT libraries -----
-aSystem=`uname -s`
-if [ "$aSystem" == "Darwin" ]; then
-  export WOKSTATION="mac";
-  if [ "$DYLD_LIBRARY_PATH" != "" ]; then
-    export DYLD_LIBRARY_PATH="${aLibPath}:${DYLD_LIBRARY_PATH}"
-  else
-    export DYLD_LIBRARY_PATH="${aLibPath}"
-  fi
-else
-  export WOKSTATION="lin";
-  if [ "$LD_LIBRARY_PATH" != "" ]; then
-    export LD_LIBRARY_PATH="${aLibPath}:${LD_LIBRARY_PATH}"
-  else
-    export LD_LIBRARY_PATH="${aLibPath}"
-  fi
+if [ "$TBB_DIR" != "" ]; then
+  THRDPARTY_PATH="${TBB_DIR}:${THRDPARTY_PATH}"
 fi
 
-# ----- Set path to OCCT executables -----
-PATH="${PATH}:$aScriptPath/bin"
+BIN_PATH="${WOKSTATION}${ARCH}/${COMPILER}/bin${CASDEB}"
+LIBS_PATH="${WOKSTATION}${ARCH}/${COMPILER}/lib${CASDEB}"
 
-# ----- Setup Environment Variables -----
-anArch=`uname -m`
-if [ "$anArch" != "x86_64" ] && [ "$anArch" != "ia64" ]; then
-  export ARCH="32";
+export PATH="${CASROOT}/${BIN_PATH}:${PATH}"
+
+if [ "$LD_LIBRARY_PATH" != "" ]; then
+  export LD_LIBRARY_PATH="${CASROOT}/${LIBS_PATH}:${THRDPARTY_PATH}:${LD_LIBRARY_PATH}"
 else
-  export ARCH="64";
+  export LD_LIBRARY_PATH="${CASROOT}/${LIBS_PATH}:${THRDPARTY_PATH}"
 fi
-if [ "$aSystem" == "Darwin" ]; then
-  export ARCH="64";
+
+if [ "$WOKSTATION" == "mac" ]; then
+  if [ "$DYLD_LIBRARY_PATH" != "" ]; then
+    export DYLD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${DYLD_LIBRARY_PATH}"
+  else
+    export DYLD_LIBRARY_PATH="${LD_LIBRARY_PATH}"
+  fi
 fi
 
 # ----- Set envoronment variables used by OCCT -----
 export CSF_LANGUAGE=us
 export MMGT_CLEAR=1
 export CSF_EXCEPTION_PROMPT=1
-export CSF_SHMessage="${aScriptPath}/res/SHMessage"
-export CSF_MDTVTexturesDirectory="${aScriptPath}/res/Textures"
-export CSF_ShadersDirectory="${aScriptPath}/res/Shaders"
-export CSF_XSMessage="SCRIPTROOT/res/XSMessage"
-export CSF_TObjMessage="SCRIPTROOT/res/TObj"
-export CSF_StandardDefaults="${aScriptPath}/res/StdResource"
-export CSF_PluginDefaults="${aScriptPath}/res/StdResource"
-export CSF_XCAFDefaults="${aScriptPath}/res/StdResource"
-export CSF_TObjDefaults="${aScriptPath}/res/StdResource"
-export CSF_StandardLiteDefaults="${aScriptPath}/res/StdResource"
-if [ "$WOKSTATION" == "mac" ]; then
-  export CSF_GraphicShr="libTKOpenGl.dylib"
-else
-  export CSF_GraphicShr="libTKOpenGl.so"
-fi
-export CSF_UnitsLexicon="${aScriptPath}/res/UnitsAPI/Lexi_Expr.dat"
-export CSF_UnitsDefinition="${aScriptPath}/res/UnitsAPI/Units.dat"
-export CSF_IGESDefaults="${aScriptPath}/res/XSTEPResource"
-export CSF_STEPDefaults="${aScriptPath}/res/XSTEPResource"
-export CSF_XmlOcafResource="${aScriptPath}/res/XmlOcafResource"
-export CSF_MIGRATION_TYPES="${aScriptPath}/res/StdResource/MigrationSheet.txt"
+export CSF_SHMessage="${CASROOT}/src/SHMessage"
+export CSF_MDTVTexturesDirectory="${CASROOT}/src/Textures"
+export CSF_ShadersDirectory="${CASROOT}/src/Shaders"
+export CSF_XSMessage="${CASROOT}/src/XSMessage"
+export CSF_TObjMessage="${CASROOT}/src/TObj"
+export CSF_StandardDefaults="${CASROOT}/src/StdResource"
+export CSF_PluginDefaults="${CASROOT}/src/StdResource"
+export CSF_XCAFDefaults="${CASROOT}/src/StdResource"
+export CSF_TObjDefaults="${CASROOT}/src/StdResource"
+export CSF_StandardLiteDefaults="${CASROOT}/src/StdResource"
+export CSF_UnitsLexicon="${CASROOT}/src/UnitsAPI/Lexi_Expr.dat"
+export CSF_UnitsDefinition="${CASROOT}/src/UnitsAPI/Units.dat"
+export CSF_IGESDefaults="${CASROOT}/src/XSTEPResource"
+export CSF_STEPDefaults="${CASROOT}/src/XSTEPResource"
+export CSF_XmlOcafResource="${CASROOT}/src/XmlOcafResource"
+export CSF_MIGRATION_TYPES="${CASROOT}/src/StdResource/MigrationSheet.txt"
 
 # Draw Harness special stuff
-if [ -e "${aScriptPath}/res/DrawResources" ]; then
-  export DRAWHOME="${aScriptPath}/res/DrawResources"
-  export CSF_DrawPluginDefaults="${aScriptPath}/res/DrawResources"
-    
-  if [ -e "${aScriptPath}/res/DrawResources/DrawDefault" ]; then
-    export DRAWDEFAULT="${aScriptPath}/res/DrawResources/DrawDefault"
+if [ -e "${CASROOT}/src/DrawResources" ]; then
+  export DRAWHOME="${CASROOT}/src/DrawResources"
+  export CSF_DrawPluginDefaults="${CASROOT}/src/DrawResources"
+
+  if [ -e "${CASROOT}/src/DrawResources/DrawDefault" ]; then
+    export DRAWDEFAULT="${CASROOT}/src/DrawResources/DrawDefault"
   fi
 fi
 
-if [ -e "${aScriptPath}/res/DrawResourcesProducts" ]; then
-  export CSF_DrawPluginProductsDefaults="${aScriptPath}/res/DrawResourcesProducts"
-fi
\ No newline at end of file
+if [ -e "${CASROOT}/src/DrawResourcesProducts" ]; then
+  export CSF_DrawPluginProductsDefaults="${CASROOT}/src/DrawResourcesProducts"
+fi
+