0029055: Visualization, Image_AlienPixMap - fallback using Wincodec
[occt.git] / adm / templates / env.sh
CommitLineData
910970ab 1#!/bin/bash
2
3# go to the script directory
4aScriptPath=${BASH_SOURCE%/*}; if [ -d "${aScriptPath}" ]; then cd "$aScriptPath"; fi; aScriptPath="$PWD";
5
910970ab 6# Reset values
e31a8e52 7export CASROOT="__CASROOT__"
910970ab 8export CASDEB=""
c7d774c5 9export TARGET="";
910970ab 10export HAVE_TBB="false";
11export HAVE_OPENCL="false";
12export HAVE_FREEIMAGE="false";
e22105a9 13export HAVE_FFMPEG="false";
910970ab 14export HAVE_GL2PS="false";
15export HAVE_VTK="false";
1ce0716b 16export HAVE_GLES2="false";
e22105a9 17export HAVE_ZLIB="false";
18export HAVE_LIBLZMA="false";
910970ab 19export MACOSX_USE_GLX="false";
20export CSF_OPT_INC=""
21export CSF_OPT_LIB32=""
22export CSF_OPT_LIB64=""
23export CSF_OPT_BIN32=""
24export CSF_OPT_BIN64=""
25
26# ----- Set local settings -----
e31a8e52 27if [ "${CASROOT}" != "" ] && [ -e "${CASROOT}/custom.sh" ]; then source "${CASROOT}/custom.sh"; fi
910970ab 28if [ -e "${aScriptPath}/custom.sh" ]; then source "${aScriptPath}/custom.sh"; fi
29
e31a8e52 30if [ "${CASROOT}" != "" ] && [ -d "${aScriptPath}/${CASROOT}" ]; then
31 export CASROOT="${aScriptPath}/${CASROOT}"
32fi
33if [ "${CASROOT}" == "" ]; then
34 export CASROOT="${aScriptPath}"
35fi
36
910970ab 37# Read script arguments
38shopt -s nocasematch
c7d774c5 39for i in $*
40do
41 if [ "$i" == "d" ] || [ "$i" == "debug" ]; then
42 export CASDEB="d"
316d77d9 43 elif [ "$i" == "i" ] || [ "$i" == "relwithdeb" ]; then
44 export CASDEB="i"
c7d774c5 45 elif [ "$i" == "cbp" ]; then
46 export TARGET="cbp";
47 elif [ "$i" == "xcd" ] || [ "$i" == "xcode" ]; then
48 export TARGET="xcd";
49 fi
50done
910970ab 51shopt -u nocasematch
52
53# ----- Setup Environment Variables -----
54anArch=`uname -m`
55if [ "$anArch" != "x86_64" ] && [ "$anArch" != "ia64" ]; then
56 export ARCH="32";
57else
58 export ARCH="64";
59fi
60
61aSystem=`uname -s`
62if [ "$aSystem" == "Darwin" ]; then
63 export WOKSTATION="mac";
64 export ARCH="64";
65else
66 export WOKSTATION="lin";
67fi
68
69export CASBIN=""
70if [ "${TARGET}" == "cbp" ]; then
71 export CASBIN="${WOKSTATION}/cbp"
72elif [ "${TARGET}" == "xcd" ]; then
73 export CASBIN="adm/mac/xcd/build"
74fi
75
76export CSF_OPT_INC="${CSF_OPT_INC}:${CASROOT}/inc"
77
78if [ "${TARGET}" == "cbp" ]; then
79 export CSF_OPT_LIB32D="${CSF_OPT_LIB32}:${CASROOT}/${CASBIN}/libd"
80 export CSF_OPT_LIB64D="${CSF_OPT_LIB64}:${CASROOT}/${CASBIN}/libd"
81 export CSF_OPT_LIB32="${CSF_OPT_LIB32}:${CASROOT}/${CASBIN}/lib"
82 export CSF_OPT_LIB64="${CSF_OPT_LIB64}:${CASROOT}/${CASBIN}/lib"
316d77d9 83 export CSF_OPT_LIB32I="${CSF_OPT_LIB32}:${CASROOT}/${CASBIN}/libi"
84 export CSF_OPT_LIB64I="${CSF_OPT_LIB64}:${CASROOT}/${CASBIN}/libi"
910970ab 85elif [ "${TARGET}" == "xcd" ]; then
86 export CSF_OPT_LIB32D="${CSF_OPT_LIB32}:${CASROOT}/${CASBIN}/Debug"
87 export CSF_OPT_LIB64D="${CSF_OPT_LIB64}:${CASROOT}/${CASBIN}/Debug"
88 export CSF_OPT_LIB32="${CSF_OPT_LIB32}:${CASROOT}/${CASBIN}/Release"
89 export CSF_OPT_LIB64="${CSF_OPT_LIB64}:${CASROOT}/${CASBIN}/Release"
316d77d9 90 export CSF_OPT_LIB32I="${CSF_OPT_LIB32}:${CASROOT}/${CASBIN}/RelWithDebInfo"
91 export CSF_OPT_LIB64I="${CSF_OPT_LIB64}:${CASROOT}/${CASBIN}/RelWithDebInfo"
910970ab 92fi
93
94export CSF_OPT_CMPL=""
95
96# Optiona 3rd-parties should be enabled by HAVE macros
e22105a9 97if [ "$HAVE_TBB" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_TBB"; fi
98if [ "$HAVE_OPENCL" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_OPENCL"; fi
99if [ "$HAVE_FREEIMAGE" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_FREEIMAGE"; fi
100if [ "$HAVE_FFMPEG" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_FFMPEG"; fi
101if [ "$HAVE_GL2PS" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_GL2PS"; fi
102if [ "$HAVE_GLES2" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_GLES2"; fi
103if [ "$HAVE_VTK" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_VTK"; fi
104if [ "$HAVE_ZLIB" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_ZLIB"; fi
105if [ "$HAVE_LIBLZMA" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_LIBLZMA"; fi
910970ab 106# Option to compile OCCT with X11 libs on Mac OS X
e22105a9 107if [ "$MACOSX_USE_GLX" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DMACOSX_USE_GLX"; fi
910970ab 108
109# To split string into array
110aDelimBack=$IFS
111IFS=":"
112
113# 3rd-parties additional include paths
114set -- "$CSF_OPT_INC"
115declare -a aPartiesIncs=($*)
116for anItem in ${aPartiesIncs[*]}
117do
118 export CSF_OPT_CMPL="${CSF_OPT_CMPL} -I${anItem}";
119done
120
121# Append 3rd-parties to LD_LIBRARY_PATH
122if [ "$ARCH" == "32" ]; then
123 set -- "$CSF_OPT_LIB32"
124 declare -a aPartiesLibs=($*)
125 set -- "$CSF_OPT_LIB32D"
126 declare -a aPartiesLibsDeb=($*)
316d77d9 127 set -- "$CSF_OPT_LIB32I"
128 declare -a aPartiesLibsRelWithDebInfo=($*)
910970ab 129else
130 set -- "$CSF_OPT_LIB64"
131 declare -a aPartiesLibs=($*)
132 set -- "$CSF_OPT_LIB64D"
133 declare -a aPartiesLibsDeb=($*)
316d77d9 134 set -- "$CSF_OPT_LIB64I"
135 declare -a aPartiesLibsRelWithDebInfo=($*)
910970ab 136fi
137
138# Turn back value
139IFS=$aDelimBack
140
141OPT_LINKER_OPTIONS_DEB=""
142for anItem in ${aPartiesLibsDeb[*]}
143do
144 OPT_LINKER_OPTIONS_DEB="${OPT_LINKER_OPTIONS_DEB} -L${anItem}"
145done
146
316d77d9 147OPT_LINKER_OPTIONS_REL_WITH_DEB_INFO=""
148for anItem in ${aPartiesLibsRelWithDebInfo[*]}
149do
150 OPT_LINKER_OPTIONS_REL_WITH_DEB_INFO="${OPT_LINKER_OPTIONS_REL_WITH_DEB_INFO} -L${anItem}"
151done
152
910970ab 153OPT_LINKER_OPTIONS=""
154for anItem in ${aPartiesLibs[*]}
155do
156 if [ "${LD_LIBRARY_PATH}" == "" ]; then
157 export LD_LIBRARY_PATH="${anItem}"
158 else
159 export LD_LIBRARY_PATH="${anItem}:${LD_LIBRARY_PATH}"
160 fi
161 OPT_LINKER_OPTIONS="${OPT_LINKER_OPTIONS} -L${anItem}"
162done
163
164if [ "$ARCH" == "64" ]; then
165 export CSF_OPT_LNK64="$OPT_LINKER_OPTIONS"
166 export CSF_OPT_LNK64D="$OPT_LINKER_OPTIONS_DEB"
316d77d9 167 export CSF_OPT_LNK64I="$OPT_LINKER_OPTIONS_REL_WITH_DEB_INFO"
910970ab 168else
169 export CSF_OPT_LNK32="$OPT_LINKER_OPTIONS"
170 export CSF_OPT_LNK32D="$OPT_LINKER_OPTIONS_DEB"
316d77d9 171 export CSF_OPT_LNK32I="$OPT_LINKER_OPTIONS_REL_WITH_DEB_INFO"
910970ab 172fi
173
4b3541c6 174# ----- Default paths to sub-folders (can be different in install env) -----
175export CSF_OCCTIncludePath="${CSF_OCCTIncludePath:-$CASROOT/inc}"
176export CSF_OCCTResourcePath="${CSF_OCCTResourcePath:-$CASROOT/src}"
177export CSF_OCCTSamplesPath="${CSF_OCCTSamplesPath:-$CASROOT/samples}"
178export CSF_OCCTDataPath="${CSF_OCCTDataPath:-$CASROOT/data}"
179export CSF_OCCTTestsPath="${CSF_OCCTTestsPath:-$CASROOT/tests}"
910970ab 180
910970ab 181if [ "${TARGET}" == "xcd" ]; then
4b3541c6 182 if [ "${CASDEB}" == "d" ]; then
183 export CSF_OCCTBinPath="${CSF_OCCTBinPath:-$CASROOT/$CASBIN/Debug}"
184 else
185 export CSF_OCCTBinPath="${CSF_OCCTBinPath:-$CASROOT/$CASBIN/Release}"
186 fi
187 export CSF_OCCTLibPath="${CSF_OCCTLibPath:-$CSF_OCCTBinPath}"
188else
189 export CSF_OCCTBinPath="${CSF_OCCTBinPath:-$CASROOT/$CASBIN/bin$CASDEB}"
190 export CSF_OCCTLibPath="${CSF_OCCTLibPath:-$CASROOT/$CASBIN/lib$CASDEB}"
910970ab 191fi
192
4b3541c6 193export PATH="${CSF_OCCTBinPath}:${PATH}"
194export LD_LIBRARY_PATH="${CSF_OCCTLibPath}:${LD_LIBRARY_PATH}"
910970ab 195if [ "$WOKSTATION" == "mac" ]; then
196 export DYLD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${DYLD_LIBRARY_PATH}"
197fi
198
199# Set envoronment variables used by OCCT
200export CSF_LANGUAGE="us"
201export MMGT_CLEAR="1"
910970ab 202export CSF_SHMessage="${CASROOT}/src/SHMessage"
203export CSF_MDTVTexturesDirectory="${CASROOT}/src/Textures"
204export CSF_ShadersDirectory="${CASROOT}/src/Shaders"
205export CSF_XSMessage="${CASROOT}/src/XSMessage"
206export CSF_TObjMessage="${CASROOT}/src/TObj"
207export CSF_StandardDefaults="${CASROOT}/src/StdResource"
208export CSF_PluginDefaults="${CASROOT}/src/StdResource"
209export CSF_XCAFDefaults="${CASROOT}/src/StdResource"
210export CSF_TObjDefaults="${CASROOT}/src/StdResource"
211export CSF_StandardLiteDefaults="${CASROOT}/src/StdResource"
910970ab 212export CSF_IGESDefaults="${CASROOT}/src/XSTEPResource"
213export CSF_STEPDefaults="${CASROOT}/src/XSTEPResource"
214export CSF_XmlOcafResource="${CASROOT}/src/XmlOcafResource"
215export CSF_MIGRATION_TYPES="${CASROOT}/src/StdResource/MigrationSheet.txt"
216
217# Draw Harness special stuff
218if [ -e "${CASROOT}/src/DrawResources" ]; then
219 export DRAWHOME="${CASROOT}/src/DrawResources"
220 export CSF_DrawPluginDefaults="${DRAWHOME}"
221fi