Ubuntu环境全自动配置FastCAE运行环境脚本

Ubuntu环境全自动配置FastCAE运行环境脚本

在工作中发现好多同学对FastCAE在Linux环境下的配置不熟悉,特定将整个过程写成脚本,对FastCAE及其依赖库进行了全自动编译安装。脚本是在Ubuntu18.04.6环境下测试的。需要在redhat系列环境使用的只需要把其中的apt命令改成yum,并把后面的包名改成对应的名字即可。如果有任何问题可以加QQ群671925863交流。

脚本代码及相关源码包可以在百度网盘下载。

链接: https://pan.baidu.com/s/1Lr1S8SHFs2a5k5M8itUoDg 提取码: q72t 

#/bin/bash

echo -e "\033[36m/************************************************\n \033[0m"
echo -e "\033[36m*** Automatic installation script for FastCAE ***\n \033[0m"
echo -e "\033[36m*** FastCAE Version: 2.5.0+(20220219)         ***\n \033[0m"
echo -e "\033[36m*** http://www.fastcae.com/                   ***\n \033[0m"
echo -e "\033[36m************************************************/ \033[0m"

usage ()
{
  cat <<EOF
Usage: 
  $0 [-p FastCAEPath] [-v VTKVersion]
Description: 
  -p FastCAEPath    path to store the FastCAE source code
  -v VTKVersion     version of vtk to use, only can be 6(OpenGL version >= 2.2) or 9(OpenGL version >= 3.2)

  --help            print this message
EOF
  exit 1
}


if [ $# -ge 1 ]; then
	if [ $1 = "--help" ]; then
		usage
	fi
fi


versionLessThan ()
{
	test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)" != "$1";
}

type glxinfo > /dev/null 2>&1 || sudo apt install mesa-utils -y;

if [ $? -ne 0 ]; then
	echo "Failed to install command 'glxinfo', may be has no connection with internet!"
	exit 1
fi

OPENGL=$(glxinfo | grep "OpenGL version");

OPENGLVERSION=${OPENGL:23:3};

ISVTK6="NO";

SUCCESS=0
FAIL=1
WORKDIR=$(pwd)
TEMPDIR=${WORKDIR}/temp
PACKAGEDIR=${WORKDIR}/package

FASTCAESOURCEINSTALLDIR=${WORKDIR}/FastCAE



while getopts ":pv:" OPTNAME
do
	case "${OPTNAME}" in
    	"v")
			if [ ${OPTARG} -eq 6 ]; then
				ISVTK6="YES"
			elif [ ${OPTARG} -eq 9 ]; then
				ISVTK6="NO"
			else
				echo "Invalid parameter value for -v"
				exit 1
			fi
      		;;
      	"p")
			if [ -d ${OPTARG} ]; then
				FASTCAESOURCEINSTALLDIR=${OPTARG}
			else
				echo "Invalid parameter value for -p"
				exit 1
			fi	
			;;
	    "?")
	    	echo "UnKnown Option ${OPTARG}"
	    	exit 1
	    	;;
	    ":")
	    	echo "No argument value for option ${OPTARG}"
	    	exit 1
	    	;;
	    "*")
	    	echo "UnKnow error while processing options"
	    	exit 1
	    	;;
	esac
done

if versionLessThan ${OPENGLVERSION} 2.2; then
	echo "OpenGL version is too low to install FastCAE, version 2.2+ is required!";
	exit 1;
elif versionLessThan ${OPENGLVERSION} 3.2; then
	read -p "OpenGL version is not enough to 3.2, FastCAE will be installed which is builded with vtk-6.1.0, continue?[y/n]: " ISCONTINUE
	if [ ${ISCONTINUE} != "y" ] && [ ${ISCONTINUE} != "Y" ]; then
		exit 0;
	fi
	ISVTK6="YES";
	unset ISCONTINUE;
else
	echo "OpenGL version: " $OPENGLVERSION;
fi
unset OPENGL
unset OPENGLVERSION

read -p "Run this script will take 2 hours, continue?[y/n]: " ISCONTINUE

if [ ${ISCONTINUE} != "y" ] && [ ${ISCONTINUE} != "Y" ]; then
	exit
fi

if [ ! -w $(pwd) ]; then
	echo -e "\033[31mHave no write right to current dirctory, please run as root! \033[0m"
	exit
fi

if [ "FASTCAE${VARPWD}" = "FASTCAE" ]; then
	read -p "Input password for running 'sudo ...' command: " VARPWD
fi

if [ ${FASTCAESOURCEINSTALLDIR} = ${WORKDIR}/FastCAE ]; then
	read -p "This script will install FastCAE source to ${WORKDIR}/FastCAE, input [y] accept the location or input a new location: " FASTCAEINPUT
	if [ ${FASTCAEINPUT} != "y" ] && [ ${FASTCAEINPUT} != "Y" ]; then
		mkdir -p ${FASTCAEINPUT}
		while [[ $? -ne 0 ]]; do
			read -p "Please input a valid path: " FASTCAEINPUT
			mkdir -p ${FASTCAEINPUT}
		done
	fi

	if [ -d ${FASTCAEINPUT} ]; then
		FASTCAESOURCEINSTALLDIR=${FASTCAEINPUT}
	fi
fi


output=`echo -e "\033[36mSet work dir to $WORKDIR \033[0m"` 
echo $output

testColor ()
{
	echo "\033[30m==30== \033[0m"
	echo "\033[31m==31== \033[0m"
	echo "\033[32m==32== \033[0m"
	echo "\033[33m==33== \033[0m"
	echo "\033[34m==34== \033[0m"
	echo "\033[35m==35== \033[0m"
	echo "\033[36m==36== \033[0m"
	echo "\033[37m==37== \033[0m"
	echo "\033[38m==38== \033[0m"
	echo "\033[39m==39== \033[0m"
}

commandExist ()
{
	type $1 > /dev/null 2>&1 || return 1;
}

installLibressl280 ()
{
	tar -zxvf ${PACKAGEDIR}/libressl-2.8.0.tar.gz -C ${TEMPDIR}
	cd ${TEMPDIR}/libressl-2.8.0
	./configure --prefix=/opt/ssllib
	make
	if [ $? -ne 0 ]; then
		return ${FAIL}
	fi
	echo ${VARPWD} | sudo make install
	if [ $? -eq 0 ]; then
		echo ${VARPWD} | sudo  mv /usr/bin/openssl /usr/bin/openssl.bak
		echo ${VARPWD} | sudo  mv /usr/include/openssl /usr/include/openssl.bak
		echo ${VARPWD} | sudo  ln -s /opt/ssllib/bin/openssl /usr/bin/openssl
		echo ${VARPWD} | sudo  ln -s /opt/ssllib/include/openssl /usr/include/openssl

		echo ${VARPWD} | sudo rm -rf ${TEMPDIR}/libressl-2.8.0/
		return ${SUCCESS}
	else
		echo ${VARPWD} | sudo rm -rf ${TEMPDIR}/libressl-2.8.0/
		return ${FAIL}
	fi
}
installPython ()
{
	if [ ! -f /opt/python-3.7.0/bin/python3 ]; then

		if ! installLibressl280; then
			return ${FAIL}
		fi

		if ! installTclTk; then 
			return ${FAIL}
		fi
		echo ${VARPWD} | sudo -S apt-get install zliblg -y
		if [ $? -ne 0 ]; then
			return ${FAIL}
		fi
		echo ${VARPWD} | sudo -S apt-get install build-essential python-dev python-setuptools python3-pip libreadline-dev libdb-dev -y
		if [ $? -ne 0 ]; then
			return ${FAIL}
		fi
		echo ${VARPWD} | sudo -S apt-get install libpcap-dev libexpat1-dev libbz2-dev  libncurses5-dev xz-utils liblzma-dev libncursesw5-dev -y
		if [ $? -ne 0 ]; then
			return ${FAIL}
		fi
		echo ${VARPWD} | sudo -S apt-get install libgdbm-dev libc6-dev libsqlite3-dev libffi-dev -y
		if [ $? -ne 0 ]; then
			return ${FAIL}
		fi
		echo -e "\033[32mBegin install python3.7.0... \033[0m" 

		tar -zxvf ${PACKAGEDIR}/Python-3.7.0.tgz -C ${TEMPDIR}
		cd ${TEMPDIR}/Python-3.7.0/
		./configure  --enable-optimizations --prefix=/opt/python-3.7.0 --with-ssl --enable-shared CFLAGS=-fPIC
		export CPPFLAGS=" -Wno-error=coverage-mismatch"
		make
		echo ${VARPWD} | sudo -S make install
		if [ $? -eq 0 ]; then
			echo -e "\033[32mPython-3.7.0 has been installed into /opt/python-3.7.0 successfully! \033[0m"
			echo ${VARPWD} | sudo rm -rf ${TEMPDIR}/Python-3.7.0/
			return ${SUCCESS}
		else
			echo -e "\033[31mFailed to install Python-3.7.0! \033[0m"
			echo ${VARPWD} | sudo rm -rf ${TEMPDIR}/Python-3.7.0/
			return ${FAIL}
		fi
		
	else
		echo -e "\036[36mPython-3.7.0 has been installed! \033[0m"
		return ${SUCCESS}
	fi
}

installQt5142 ()
{
	if [ ! -f /opt/Qt5.14.2/5.14.2/gcc_64/bin/qmake ]; then
		echo -e "\033[31mQt5.14.2 will be install next step, the component 'Desktop gcc 64-bit' and 'Qt WebEngine' are necessary! \033[0m"
		chmod +x ${PACKAGEDIR}/qt-opensource-linux-x64-5.14.2.run
		${PACKAGEDIR}/qt-opensource-linux-x64-5.14.2.run
	fi

	if [ ! -f /opt/Qt5.14.2/5.14.2/gcc_64/bin/qmake ]; then
		echo -e "\033[31mQt5.14.2 need to be installed frist! the component 'Desktop gcc 64-bit' and 'Qt WebEngine' are necessary! The reasons may be as follows: \033[0m"
		echo -e "\033[31m\t(1) The installation directory is not set to /opt/Qt5.14.2/ \033[0m"
		echo -e "\033[31m\t(2) The component 'Desktop gcc 64-bit' is not checked! \033[0m"
		echo -e "The installation medium is located at ${WORKDIR}/package/qt-opensource-linux-x64-5.14.2.run"
		return ${FAIL}
	else
		return ${SUCCESS}
	fi
}

installQt542 ()
{
	if [ ! -f /opt/Qt5.4.2/5.4/gcc_64/bin/qmake ]; then
		echo -e "\033[31mQt5.4.2 will be install next step, the component 'Desktop gcc 64-bit' and 'Qt WebEngine' are necessary! \033[0m"
		chmod +x ${PACKAGEDIR}/qt-opensource-linux-x64-5.4.2.run
		${PACKAGEDIR}/qt-opensource-linux-x64-5.4.2.run
	fi

	if [ ! -f /opt/Qt5.4.2/5.4/gcc_64/bin/qmake ]; then
		echo -e "\033[31mQt5.4.2 need to be installed frist! the component 'Desktop gcc 64-bit' and 'Qt WebEngine' are necessary! The reasons may be as follows: \033[0m"
		echo -e "\033[31m\t(1) The installation directory is not set to /opt/Qt5.4.2/ \033[0m"
		echo -e "\033[31m\t(2) The component 'Desktop gcc 64-bit' is not checked! \033[0m"
		echo -e "The installation medium is located at ${WORKDIR}/package/qt-opensource-linux-x64-5.4.2.run"
		return ${FAIL}
	else
		return ${SUCCESS}
	fi
}

installCmake3213 ()
{
	if [ ! -f /opt/cmake-3.21/bin/cmake ]; then
		chmod +x ${PACKAGEDIR}/cmake-3.21.3-linux-x86_64.sh
		echo ${VARPWD} | sudo -S  mkdir -p /opt/cmake-3.21/
		echo ${VARPWD} | sudo -S  ${PACKAGEDIR}/cmake-3.21.3-linux-x86_64.sh --prefix=/opt/cmake-3.21 --skip-license
		if [ $? -eq 0 ]; then
			return ${SUCCESS}
		else
			return ${FAIL}
		fi
	else
		return ${SUCCESS}
	fi
}

installCmake2812 ()
{
	if [ ! -f /opt/cmake-2.8/bin/cmake ]; then
		tar -zxvf ${PACKAGEDIR}/cmake-2.8.12.2.tar.gz -C ${TEMPDIR}
		cd ${TEMPDIR}/cmake-2.8.12.2/
		echo ${VARPWD} | sudo -S  mkdir -p /opt/cmake-2.8/
		./configure --no-qt-gui --prefix=/opt/cmake-2.8/
		make
		echo ${VARPWD} | sudo make install
		if [ $? -eq 0 ]; then
			return ${SUCCESS}
		else
			return ${FAIL}
		fi
	else
		return ${SUCCESS}
	fi
}

installQwt ()
{
	if [ ! -f ${TEMPDIR}/qwtpolar-1.1.1/bin/lib/libqwtpolar.so ]; then
		echo -e "\033[32mBegin install qwt6.1.6... \033[0m" 
		mkdir -p ${TEMPDIR}/qwt-6.1.6/source/
		mkdir -p ${TEMPDIR}/qwt-6.1.6/bin/
		tar -jxvf ${PACKAGEDIR}/qwt-6.1.6.tar.bz2 -C ${TEMPDIR}/qwt-6.1.6/source/
		cd ${TEMPDIR}/qwt-6.1.6/source/

		# default install path: /usr/local/qwt-6.1.6
		# replace it to: ${TEMPDIR}/qwt-6.1.6
		sed -i "s@/usr/local/qwt-\$\$QWT_VERSION@${TEMPDIR}/qwt-\$\$QWT_VERSION/bin@" ${TEMPDIR}/qwt-6.1.6/source/qwt-6.1.6/qwtconfig.pri
		cd ${TEMPDIR}/qwt-6.1.6/source/qwt-6.1.6/
		${QMAKE} qwt.pro
		make
		make install
		if [ $? -eq 0 ]; then
			echo -e "\033[32mFinish install qwt6.1.6! \033[0m" 
			echo -e "\033[32mBegin install qwtpolar-1.1.1... \033[0m" 
			mkdir -p ${TEMPDIR}/qwtpolar-1.1.1/source/
			mkdir -p ${TEMPDIR}/qwtpolar-1.1.1/bin/
			tar -jxvf ${PACKAGEDIR}/qwtpolar-1.1.1.tar.bz2 -C ${TEMPDIR}/qwtpolar-1.1.1/source/
			cd ${TEMPDIR}/qwtpolar-1.1.1/source/qwtpolar-1.1.1/

			#installpath:/usr/local/qwtpolar-1.1.1
			# replace it to: ${TEMPDIR}/qwtpolar-1.1.1
			sed -i "s@/usr/local/qwtpolar-\$\$QWT_POLAR_VERSION@${TEMPDIR}/qwtpolar-\$\$QWT_POLAR_VERSION/bin@" ${TEMPDIR}/qwtpolar-1.1.1/source/qwtpolar-1.1.1/qwtpolarconfig.pri
			echo "INCLUDEPATH	+=  ${TEMPDIR}/qwt-6.1.6/bin/include/" >> qwtpolarconfig.pri 
			echo "LIBS += -L${TEMPDIR}/qwt-6.1.6/bin/lib -lqwt" >> qwtpolarconfig.pri 

			${QMAKE} qwtpolar.pro
			make
			make install
			if [ $? -eq 0 ]; then
				echo -e "\033[32mFinish install qwtpolar-1.1.1! \033[0m" 
				return ${SUCCESS}
			else
				echo -e "\033[31mFailed to install qwtpolar-1.1.1! \033[0m" 
				return ${FAIL}
			fi

		else
			echo -e "\033[31mFailed to install qwt6.1.6! \033[0m" 
			return ${FAIL}
		fi
	else
		return ${SUCCESS}
	fi
}

installQuazip ()
{
	if [ ! -f ${TEMPDIR}/quazip-0.7.3/bin/lib/libquazip.so ]; then
		echo -e "\033[32mBegin install quazip-0.7.3... \033[0m" 
		mkdir -p ${TEMPDIR}/quazip-0.7.3/source
		mkdir -p ${TEMPDIR}/quazip-0.7.3/bin
		tar -zxvf ${WORKDIR}/package/quazip-0.7.3.tar.gz -C ${TEMPDIR}/quazip-0.7.3/source
		cd ${TEMPDIR}/quazip-0.7.3/source/quazip-0.7.3/
		${QMAKE} PREFIX=${TEMPDIR}/quazip-0.7.3/bin

		make
		make install
		if [ $? -eq 0 ]; then
			echo -e "\033[32mFinish install quazip-0.7.3! \033[0m" 
			return ${SUCCESS}
		else
			echo -e "\033[31mFailed to install quazip-0.7.3! \033[0m" 
			return ${FAIL}
		fi
	else
		return ${SUCCESS}
	fi

}

installVtk901 ()
{
	if [ ! -f ${TEMPDIR}/vtk-9.0.1/install/lib/libvtkRenderingCore-9.0.so ]; then
		echo -e "\033[32mBegin install vtk-9.0.1... \033[0m" 
		mkdir -p ${TEMPDIR}/vtk-9.0.1/source/
		mkdir -p ${TEMPDIR}/vtk-9.0.1/build/
		mkdir -p ${TEMPDIR}/vtk-9.0.1/install/
		tar -zxvf ${PACKAGEDIR}/VTK-9.0.1.tar.gz -C ${TEMPDIR}/vtk-9.0.1/source
		${QMAKE} -S ${TEMPDIR}/vtk-9.0.1/source/VTK-9.0.1 -B ${TEMPDIR}/vtk-9.0.1/build -DVTK_PYTHON_VERSION=3 -DVTK_GROUP_ENABLE_Qt=YES -DVTK_MODULE_ENABLE_VTK_GUISupportQt=YES -DVTK_MODULE_ENABLE_VTK_GUISupportQtSQL=YES -DVTK_MODULE_ENABLE_VTK_RenderingQt=YES -DVTK_MODULE_ENABLE_VTK_ViewsQt=YES -DCMAKE_INSTALL_PREFIX=${TEMPDIR}/vtk-9.0.1/install -DQt5_DIR=/opt/Qt5.14.2/5.14.2/gcc_64/lib/cmake/Qt5
		cd ${TEMPDIR}/vtk-9.0.1/build
		make
		make install
		if [ $? -eq 0 ]; then
			echo -e "\033[32mFinish install vtk-9.0.1! \033[0m"
			return ${SUCCESS}
		else
			echo -e "\033[31mFailed to install vtk-9.0.1! \033[0m"
			return ${FAIL}
		fi
	else
		return ${SUCCESS}
	fi
}

installVtk610 ()
{
	if [ ! -f ${TEMPDIR}/vtk-9.0.1/install/lib/libvtkRenderingCore-9.0.so ]; then
		echo -e "\033[32mBegin install vtk-6.1.0... \033[0m" 
		mkdir -p ${TEMPDIR}/vtk-6.1.0/source/
		mkdir -p ${TEMPDIR}/vtk-6.1.0/build/
		mkdir -p ${TEMPDIR}/vtk-6.1.0/install/
		tar -zxvf ${PACKAGEDIR}/VTK-6.1.0.tar.gz -C ${TEMPDIR}/vtk-6.1.0/source
		tar -zxvf ${PACKAGEDIR}/VTKData-6.1.0.tar.gz -C ${TEMPDIR}/vtk-6.1.0/source
		cd ${TEMPDIR}/vtk-6.1.0/build/
		sed -i 's/if(${_gcc_version} VERSION_GREATER 4.2.0 AND BUILD_SHARED_LIBS/if(_gcc_version VERSION_GREATER "4.2.0" AND BUILD_SHARED_LIBS/' ${TEMPDIR}/vtk-6.1.0/source/VTK-6.1.0/CMake/vtkCompilerExtras.cmake
		sed -i 's/if(${_gcc_version} VERSION_LESS "4.2")/if(_gcc_version VERSION_LESS "4.2")/' ${TEMPDIR}/vtk-6.1.0/source/VTK-6.1.0/CMake/GenerateExportHeader.cmake
		#${CMAKE} -D VTK_PYTHON_VERSION:STRING=3 -D VTK_GROUP_ENABLE_Qt:BOOL=YES -D CMAKE_CONFIGURATION_TYPES:STRING=Release -D VTK_MODULE_ENABLE_VTK_GUISupportQt:BOOL=YES -D VTK_MODULE_ENABLE_VTK_RenderingQt:BOOL=YES -D VTK_MODULE_ENABLE_VTK_ViewsQt:BOOL=YES -D CMAKE_INSTALL_PREFIX:STRING=${TEMPDIR}/vtk-6.1.0/install -D Qt5_DIR:STRING=/opt/Qt5.4.2/5.4/gcc_64/lib/cmake/Qt5 ${TEMPDIR}/vtk-6.1.0/source/VTK-6.1.0/
		
		${CMAKE} -D VTK_Group_Qt:BOOL=YES -D VTK_QT_VERSION:STRING=5 -D CMAKE_INSTALL_PREFIX:STRING=${TEMPDIR}/vtk-6.1.0/install -D CMAKE_PREFIX_PATH:STRING=/opt/Qt5.4.2/5.4/gcc_64 -D CMAKE_CONFIGURATION_TYPES:STRING=Release -DCMAKE_C_FLAGS=-DGLX_GLXEXT_LEGACY -DCMAKE_CXX_FLAGS=-DGLX_GLXEXT_LEGACY -Wno-dev ${TEMPDIR}/vtk-6.1.0/source/VTK-6.1.0/
		make
		make install
		if [ $? -eq 0 ]; then
			echo -e "\033[32mFinish install vtk-6.1.0! \033[0m"
			return ${SUCCESS}
		else
			echo -e "\033[31mFailed to install vtk-6.1.0! \033[0m"
			return ${FAIL}
		fi
	else
		return ${SUCCESS}
	fi
}

installTclTk ()
{
	if ! commandExist tclsh; then
		echo -e "\033[32mBegin install tcl/tk... \033[0m" 
		mkdir -p ${TEMPDIR}/tcltk/
		unzip ${PACKAGEDIR}/tcl8611-src.zip -d ${TEMPDIR}/tcltk/
		unzip ${PACKAGEDIR}/tk86111-src.zip -d ${TEMPDIR}/tcltk/
		cd ${TEMPDIR}/tcltk/tcl8.6.11/unix/
		./configure --enable-gcc --enable-shared --enable-threads --enable-64bit
		make
		echo ${VARPWD} | sudo -S  make install
		if [ $? -eq 0 ]; then
			cd ${TEMPDIR}/tcltk/tk8.6.11/unix/
			./configure --enable-gcc --enable-shared --enable-threads --enable-64bit
			make
			echo ${VARPWD} | sudo -S  make install
			if [ $? -eq 0 ]; then
				echo -e "\033[32mFinish install tcl/tk! \033[0m" 
				echo ${VARPWD} | sudo rm -rf ${TEMPDIR}/tcltk/
				return ${SUCCESS}
			else
				echo -e "\033[31mFailed to install tk! \033[0m" 
				echo ${VARPWD} | sudo rm -rf ${TEMPDIR}/tcltk/
				return ${FAIL}
			fi
		else
			echo -e "\033[31mFailed to install tcl! \033[0m" 
			echo ${VARPWD} | sudo rm -rf ${TEMPDIR}/tcltk/
			return ${FAIL}
		fi
	else
		return ${SUCCESS}
	fi
}

installFreeImage ()
{
	if [ ! -f /usr/lib/libfreeimage.so ]; then
		echo -e "\033[32mBegin install FreeImage... \033[0m" 
		unzip ${PACKAGEDIR}/FreeImage3180.zip -d ${TEMPDIR}
		cd ${TEMPDIR}/FreeImage/
		make
		echo ${VARPWD} | sudo -S make install
		if [ $? -eq 0 ]; then
			echo -e "\033[32mFinish install FreeImage! \033[0m" 
			echo ${VARPWD} | sudo rm -rf ${TEMPDIR}/FreeImage/
			return ${SUCCESS}
		else
			echo -e "\033[31mFailed to install FreeImage! \033[0m" 
			echo ${VARPWD} | sudo rm -rf ${TEMPDIR}/FreeImage/
			return ${FAIL}
		fi
		
	else
		return ${SUCCESS}
	fi
}

installOpenCaseCad ()
{
	if [ ! -f ${TEMPDIR}/occ-7.5.0/install/lib/libTKIVtk.so ]; then
		echo -e "\033[32mBegin install occ-7.5.0... \033[0m" 
		echo ${VARPWD} | sudo -S apt install libxi-dev -y
		mkdir -p ${TEMPDIR}/occ-7.5.0/source/
		mkdir -p ${TEMPDIR}/occ-7.5.0/build/
		mkdir -p ${TEMPDIR}/occ-7.5.0/install/
		tar -zxvf ${PACKAGEDIR}/opencascade-7.5.0.tgz -C ${TEMPDIR}/occ-7.5.0/source/
		cd ${TEMPDIR}/occ-7.5.0/build/
<<COMMENT		
		if [ ${ISVTK6} = "YES0000" ]; then
			rm -rf ${TEMPDIR}/occ-7.5.0/source/opencascade-7.5.0/adm/cmake/vtk.cmake
			cp ${WORKDIR}/vtk.cmake ${TEMPDIR}/occ-7.5.0/source/opencascade-7.5.0/adm/cmake/vtk.cmake
			if [ $? -ne 0 ]; then
				echo -e "\033[31mFailed to replace vtk.cmake \033[0m"
				return  ${FAIL}
			fi
			${CMAKE} -D USE_FREEIMAGE=TRUE -D USE_VTK=TRUE -D 3RDPARTY_VTK_DIR=${FASTCAESOURCEINSTALLDIR}/VTK -D 3RDPARTY_VTK_INCLUDE_DIR=${FASTCAESOURCEINSTALLDIR}/VTK/include/vtk-6.1 -D CMAKE_INSTALL_PREFIX=${TEMPDIR}/occ-7.5.0/install/ ${TEMPDIR}/occ-7.5.0/source/opencascade-7.5.0
		else
			${CMAKE} -S ${TEMPDIR}/occ-7.5.0/source/opencascade-7.5.0 -B ${TEMPDIR}/occ-7.5.0/build/ -DUSE_FREEIMAGE=TRUE -DUSE_VTK=TRUE -D3RDPARTY_VTK_DIR=${FASTCAESOURCEINSTALLDIR}/VTK -D3RDPARTY_VTK_INCLUDE_DIR=${FASTCAESOURCEINSTALLDIR}/VTK/include/vtk-9.0 -DCMAKE_INSTALL_PREFIX=${TEMPDIR}/occ-7.5.0/install/

			sed -i 's/all: src\/TKIVtkDraw\/all/#all: src\/TKIVtkDraw\/all/' ${TEMPDIR}/occ-7.5.0/build/CMakeFiles/Makefile2
			sed -i 's/preinstall: src\/TKIVtkDraw\/preinstall/#preinstall: src\/TKIVtkDraw\/preinstall/' ${TEMPDIR}/occ-7.5.0/build/CMakeFiles/Makefile2
			sed -i 's/clean: src\/TKIVtkDraw\/clean/#clean: src\/TKIVtkDraw\/clean/' ${TEMPDIR}/occ-7.5.0/build/CMakeFiles/Makefile2
			sed -i "s|include(\"$workDir/package/occ-build/src/TKIVtkDraw/cmake_install.cmake\")|#include(\"$workDir/package/occ-build/src/TKIVtkDraw/cmake_install.cmake\")|" ${TEMPDIR}/occ-7.5.0/build/cmake_install.cmake
		fi
COMMENT
		

		if [ ${ISVTK6} = "YES" ]; then
			${CMAKE} -S ${TEMPDIR}/occ-7.5.0/source/opencascade-7.5.0 -B ${TEMPDIR}/occ-7.5.0/build/ -DUSE_FREEIMAGE=TRUE -DUSE_VTK=TRUE -D3RDPARTY_VTK_DIR=${FASTCAESOURCEINSTALLDIR}/VTK -D3RDPARTY_VTK_INCLUDE_DIR=${FASTCAESOURCEINSTALLDIR}/VTK/include/vtk-6.1 -DCMAKE_INSTALL_PREFIX=${TEMPDIR}/occ-7.5.0/install/
		else
			${CMAKE} -S ${TEMPDIR}/occ-7.5.0/source/opencascade-7.5.0 -B ${TEMPDIR}/occ-7.5.0/build/ -DUSE_FREEIMAGE=TRUE -DUSE_VTK=TRUE -D3RDPARTY_VTK_DIR=${FASTCAESOURCEINSTALLDIR}/VTK -D3RDPARTY_VTK_INCLUDE_DIR=${FASTCAESOURCEINSTALLDIR}/VTK/include/vtk-9.0 -DCMAKE_INSTALL_PREFIX=${TEMPDIR}/occ-7.5.0/install/
			sed -i 's/all: src\/TKIVtkDraw\/all/#all: src\/TKIVtkDraw\/all/' ${TEMPDIR}/occ-7.5.0/build/CMakeFiles/Makefile2
			sed -i 's/preinstall: src\/TKIVtkDraw\/preinstall/#preinstall: src\/TKIVtkDraw\/preinstall/' ${TEMPDIR}/occ-7.5.0/build/CMakeFiles/Makefile2
			sed -i 's/clean: src\/TKIVtkDraw\/clean/#clean: src\/TKIVtkDraw\/clean/' ${TEMPDIR}/occ-7.5.0/build/CMakeFiles/Makefile2
			sed -i "s|include(\"$workDir/package/occ-build/src/TKIVtkDraw/cmake_install.cmake\")|#include(\"$workDir/package/occ-build/src/TKIVtkDraw/cmake_install.cmake\")|" ${TEMPDIR}/occ-7.5.0/build/cmake_install.cmake
		fi
		make
		make install
		if [ $? -eq 0 ]; then
			echo -e "\033[32mFinish install occ-7.5.0! \033[0m" 
			return ${SUCCESS}
		else
			echo -e "\033[31mFailed install occ-7.5.0! \033[0m" 
			return ${FAIL}
		fi
	else
		return ${SUCCESS}
	fi
}

installHdf5_bak ()
{
	mkdir -p ${TEMPDIR}/hdf5-1.12.1/source/
	mkdir -p ${TEMPDIR}/hdf5-1.12.1/bin/
	tar -zxvf ${PACKAGEDIR}/hdf5-1.12.1.tar.gz -C ${TEMPDIR}/hdf5-1.12.1/source/
	cd ${TEMPDIR}/hdf5-1.12.1/source/hdf5-1.12.1/
	./configure --prefix=${TEMPDIR}/hdf5-1.12.1/bin
	make
	make install
	if [ $? -eq 0 ]; then
		echo -e "\033[32mFinish install hdf5-1.12.1! \033[0m" 
		return ${SUCCESS}
	else
		echo -e "\033[31mFailed to install hdf5-1.12.1! \033[0m" 
		return ${FAIL}
	fi
}

installHdf5BySource ()
{
	mkdir -p ${TEMPDIR}/hdf5-1.12.1/source/
	mkdir -p ${TEMPDIR}/hdf5-1.12.1/build/
	mkdir -p ${TEMPDIR}/hdf5-1.12.1/install/
	cd ${TEMPDIR}/hdf5-1.12.1/build/
	echo -e '#include <float.h>\n#include <stdio.h>\n#define CHECK_FLOAT128 _SIZEOF___FLOAT128\n#if CHECK_FLOAT128!=0\n#if _HAVE_QUADMATH_H!=0\n#include <quadmath.h>\n#endif\n#ifdef FLT128_DIG\n#define C_FLT128_DIG FLT128_DIG\n#else\n#define C_FLT128_DIG 0\n#endif\n#else\n#define C_FLT128_DIG 0\n#endif\n#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L\n#define C_LDBL_DIG DECIMAL_DIG\n#else\n#define C_LDBL_DIG LDBL_DIG\n#endif\nint main() {\nFILE *pFile =fopen("pac_Cconftest.out","w");\nfprintf(pFile, "%d;%d;", C_LDBL_DIG, C_FLT128_DIG);\nreturn 0;\n}' > _pac_test.c
	gcc -o _pac_test _pac_test.c
	./_pac_test
	tar -zxvf ${PACKAGEDIR}/hdf5-1.12.1.tar.gz -C ${TEMPDIR}/hdf5-1.12.1/source/
	cd ${TEMPDIR}/hdf5-1.12.1/build/
	${CMAKE} -S HDF5config.cmake,BUILD_GENERATOR=Unix -C Release -V -O hdf5.log -S ${TEMPDIR}/hdf5-1.12.1/source/ -B ${TEMPDIR}/hdf5-1.12.1/build/ -DCMAKE_INSTALL_PREFIX=${TEMPDIR}/hdf5-1.12.1/install/
	make
	make install
	if [ $? -eq 0 ]; then
		echo -e "\033[32mFinish install hdf5-1.12.1! \033[0m" 
		return ${SUCCESS}
	else
		echo -e "\033[31mFailed to install hdf5-1.12.1! \033[0m" 
		return ${FAIL}
	fi
}

installHdf5ByBin ()
{
	mkdir -p ${TEMPDIR}/hdf5-1.12.1/
	${PACKAGEDIR}/HDF5-1.12.1-Linux.sh --prefix=${TEMPDIR}/hdf5-1.12.1/ --skip-license
	if [ $? -ne 0 ]; then
		exit ${FAIL}
	else
		return ${SUCCESS}
	fi
}

installHdf5ByCmake ()
{
	if [ ! -f ${TEMPDIR}/hdf5-1.12.1/HDF_Group/HDF5/1.12.1/lib/libhdf5.so ]; then
		tar -zxvf ${PACKAGEDIR}/CMake-hdf5-1.12.1.tar.gz -C ${TEMPDIR}
		mv ${TEMPDIR}/CMake-hdf5-1.12.1 ${TEMPDIR}/hdf5-1.12.1
		cd ${TEMPDIR}/hdf5-1.12.1/
		sed -i "s@execute_process (COMMAND cpack -C \${CTEST_CONFIGURATION_TYPE} -V@execute_process (COMMAND /opt/cmake-3.21/bin/cpack -C \${CTEST_CONFIGURATION_TYPE} -V@" ${TEMPDIR}/hdf5-1.12.1/CTestScript.cmake
		/opt/cmake-3.21/bin/ctest -S HDF5config.cmake,BUILD_GENERATOR=Unix -C Release -V -O hdf5.log
		if [ $? -ne 0 ]; then
			return ${FAIL}
		fi
		if [ ! -f ${TEMPDIR}/hdf5-1.12.1/HDF5-1.12.1-Linux.sh ]; then
			return ${FAIL}
		fi

		chmod +x ${TEMPDIR}/hdf5-1.12.1/HDF5-1.12.1-Linux.sh
		${TEMPDIR}/hdf5-1.12.1/HDF5-1.12.1-Linux.sh --prefix=${TEMPDIR}/hdf5-1.12.1/ --skip-license
		if [ $? -eq 0 ]; then
			return ${SUCCESS}
		else
			return ${FAIL}
		fi
	else
		return ${SUCCESS}
	fi
}
installGlibc ()
{
	if [ ! -f /usr/local/glibc-2.29/lib/libc-2.29.so ]; then
		tar -zxvf ${PACKAGEDIR}/glibc-2.29.tar.gz -C ${TEMPDIR}
		cd ${TEMPDIR}/glibc-2.29
		mkdir build && cd build
		echo ${VARPWD} | sudo -S apt-get install gawk bison -y
		${TEMPDIR}/glibc-2.29/configure --prefix=/usr/local/glibc-2.29

		make
		echo ${VARPWD} | sudo -S  make install
		if [ $? -eq 0 ]; then
			echo ${VARPWD} | sudo -S  cp /usr/local/glibc-2.29/lib/libc-2.29.so /lib64/libc-2.29.so 
			#mv /lib64/libc.so.6 /lib64/libc.so.6.bak
			#LD_PRELOAD=/lib64/libc-2.27.so 
			echo ${VARPWD} | sudo -S  ln -s /lib64/libc-2.29.so /lib64/libc.so.6
			return $?
		else
			return ${FAIL}
		fi
	else
		return ${SUCCESS}
	fi
}
installCgns ()
{
	if [ ! -f ${TEMPDIR}/cgns-4.2.0/install/include/cgnslib.h ]; then
		# hdf5最低要求3.12版本的cmake
		if ! installCmake3213; then
			exit ${FAIL}
		fi
		if ! installHdf5ByCmake; then
			exit ${FAIL}
		fi
		#if ! installGlibc; then
		#	exit ${FAIL}
		#fi
		mkdir -p ${TEMPDIR}/cgns-4.2.0/source/
		mkdir -p ${TEMPDIR}/cgns-4.2.0/build/
		mkdir -p ${TEMPDIR}/cgns-4.2.0/install/
		tar -zxvf ${PACKAGEDIR}/CGNS-4.2.0.tar.gz -C ${TEMPDIR}/cgns-4.2.0/source/
		cd ${TEMPDIR}/cgns-4.2.0/build/
		${CMAKE} -S ${TEMPDIR}/cgns-4.2.0/source/CGNS-4.2.0/ -B ${TEMPDIR}/cgns-4.2.0/build/ -DCGNS_BUILD_CGNSTOOLS=TRUE -DCGNS_ENABLE_HDF5=TRUE -DHDF5_DIR=${TEMPDIR}/hdf5-1.12.1/HDF_Group/HDF5/1.12.1/share/cmake/hdf5 -DOpenGL_GL_PREFERENCE=LEGACY -DCMAKE_INSTALL_PREFIX=${TEMPDIR}/cgns-4.2.0/install/
		
		make
		make install
		if [ $? -eq 0 ]; then
			echo -e "\033[32mFinish install CGNS-4.2.0! \033[0m" 
			return ${SUCCESS}
		else
			echo -e "\033[31mFailed to install CGNS-4.2.0! \033[0m" 
			return ${FAIL}
		fi
	fi
}

compileFastCAE ()
{
	mkdir -p ${FASTCAESOURCEINSTALLDIR}/build/python/
	cd ${FASTCAESOURCEINSTALLDIR}/build/python/
	${QMAKE} -o Makefile -Wnone ${FASTCAESOURCEINSTALLDIR}/Code/python/python.pro
	make ver=release
	if [ $? -ne 0 ]; then
		echo -e "\033[31mFailed to compile module python! \033[0m"
		return ${FAIL}
	fi

	mkdir -p ${FASTCAESOURCEINSTALLDIR}/build/settings/
	cd ${FASTCAESOURCEINSTALLDIR}/build/settings/
	${QMAKE} -o Makefile -Wnone ${FASTCAESOURCEINSTALLDIR}/Code/settings/setting.pro
	make ver=release
	if [ $? -ne 0 ]; then
		echo -e "\033[31mFailed to compile module setting! \033[0m"
		return ${FAIL}
	fi

	mkdir -p ${FASTCAESOURCEINSTALLDIR}/build/SARibbonBar/
	cd ${FASTCAESOURCEINSTALLDIR}/build/SARibbonBar/
	${QMAKE} -o Makefile -Wnone ${FASTCAESOURCEINSTALLDIR}/Code/SARibbonBar/SARibbonBar.pro
	make ver=release
	if [ $? -ne 0 ]; then
		echo -e "\033[31mFailed to compile module SARibbonBar! \033[0m"
		return ${FAIL}
	fi

	mkdir -p ${FASTCAESOURCEINSTALLDIR}/build/DataProperty/
	cd ${FASTCAESOURCEINSTALLDIR}/build/DataProperty/
	${QMAKE} -o Makefile -Wnone ${FASTCAESOURCEINSTALLDIR}/Code/DataProperty/DataProperty.pro
	make ver=release
	if [ $? -ne 0 ]; then
		echo -e "\033[31mFailed to compile module DataProperty! \033[0m"
		return ${FAIL}
	fi

	mkdir -p ${FASTCAESOURCEINSTALLDIR}/build/meshData/
	cd ${FASTCAESOURCEINSTALLDIR}/build/meshData/
	${QMAKE} -o Makefile -Wnone ${FASTCAESOURCEINSTALLDIR}/Code/meshData/meshData.pro
	make ver=release
	if [ $? -ne 0 ]; then
		echo -e "\033[31mFailed to compile module meshData! \033[0m"
		return ${FAIL}
	fi

	mkdir -p ${FASTCAESOURCEINSTALLDIR}/build/SelfDefObject/
	cd ${FASTCAESOURCEINSTALLDIR}/build/SelfDefObject/
	${QMAKE} -o Makefile -Wnone ${FASTCAESOURCEINSTALLDIR}/Code/SelfDefObject/SelfDefObject.pro
	make ver=release
	if [ $? -ne 0 ]; then
		echo -e "\033[31mFailed to compile module SelfDefObject! \033[0m"
		return ${FAIL}
	fi

	mkdir -p ${FASTCAESOURCEINSTALLDIR}/build/Material/
	cd ${FASTCAESOURCEINSTALLDIR}/build/Material/
	${QMAKE} -o Makefile -Wnone ${FASTCAESOURCEINSTALLDIR}/Code/Material/Material.pro
	make ver=release
	if [ $? -ne 0 ]; then
		echo -e "\033[31mFailed to compile module Material! \033[0m"
		return ${FAIL}
	fi

	mkdir -p ${FASTCAESOURCEINSTALLDIR}/build/BCBase/
	cd ${FASTCAESOURCEINSTALLDIR}/build/BCBase/
	${QMAKE} -o Makefile -Wnone ${FASTCAESOURCEINSTALLDIR}/Code/BCBase/BCBase.pro
	make ver=release
	if [ $? -ne 0 ]; then
		echo -e "\033[31mFailed to compile module BCBase! \033[0m"
		return ${FAIL}
	fi

	mkdir -p ${FASTCAESOURCEINSTALLDIR}/build/SolutionDataIO/
	cd ${FASTCAESOURCEINSTALLDIR}/build/SolutionDataIO/
	${QMAKE} -o Makefile -Wnone ${FASTCAESOURCEINSTALLDIR}/Code/SolutionDataIO/SolutionDataIO.pro
	make ver=release
	if [ $? -ne 0 ]; then
		echo -e "\033[31mFailed to compile module SolutionDataIO! \033[0m"
		return ${FAIL}
	fi

	mkdir -p ${FASTCAESOURCEINSTALLDIR}/build/ConfigOptions/
	cd ${FASTCAESOURCEINSTALLDIR}/build/ConfigOptions/
	${QMAKE} -o Makefile -Wnone ${FASTCAESOURCEINSTALLDIR}/Code/ConfigOptions/ConfigOptions.pro
	make ver=release
	if [ $? -ne 0 ]; then
		echo -e "\033[31mFailed to compile module ConfigOptions! \033[0m"
		return ${FAIL}
	fi

	mkdir -p ${FASTCAESOURCEINSTALLDIR}/build/ParaClassFactory/
	cd ${FASTCAESOURCEINSTALLDIR}/build/ParaClassFactory/
	${QMAKE} -o Makefile -Wnone ${FASTCAESOURCEINSTALLDIR}/Code/ParaClassFactory/ParaClassFactory.pro
	make ver=release
	if [ $? -ne 0 ]; then
		echo -e "\033[31mFailed to compile module ParaClassFactory! \033[0m"
		return ${FAIL}
	fi

	mkdir -p ${FASTCAESOURCEINSTALLDIR}/build/HeuDataSrcIO/
	cd ${FASTCAESOURCEINSTALLDIR}/build/HeuDataSrcIO/
	${QMAKE} -o Makefile -Wnone ${FASTCAESOURCEINSTALLDIR}/Code/HeuDataSrcIO/HeuDataSrcIO.pro
	make ver=release
	if [ $? -ne 0 ]; then
		echo -e "\033[31mFailed to compile module HeuDataSrcIO! \033[0m"
		return ${FAIL}
	fi

	mkdir -p ${FASTCAESOURCEINSTALLDIR}/build/geometry/
	cd ${FASTCAESOURCEINSTALLDIR}/build/geometry/
	${QMAKE} -o Makefile -Wnone ${FASTCAESOURCEINSTALLDIR}/Code/geometry/geometry.pro
	make ver=release
	if [ $? -ne 0 ]; then
		echo -e "\033[31mFailed to compile module geometry! \033[0m"
		return ${FAIL}
	fi

	mkdir -p ${FASTCAESOURCEINSTALLDIR}/build/ModelData/
	cd ${FASTCAESOURCEINSTALLDIR}/build/ModelData/
	${QMAKE} -o Makefile -Wnone ${FASTCAESOURCEINSTALLDIR}/Code/ModelData/modelData.pro
	make ver=release
	if [ $? -ne 0 ]; then
		echo -e "\033[31mFailed to compile module modelData! \033[0m"
		return ${FAIL}
	fi

	mkdir -p ${FASTCAESOURCEINSTALLDIR}/build/CurveAnalyse/
	cd ${FASTCAESOURCEINSTALLDIR}/build/CurveAnalyse/
	${QMAKE} -o Makefile -Wnone ${FASTCAESOURCEINSTALLDIR}/Code/CurveAnalyse/CurveAnalyse.pro
	make ver=release
	if [ $? -ne 0 ]; then
		echo -e "\033[31mFailed to compile module CurveAnalyse! \033[0m"
		return ${FAIL}
	fi

	mkdir -p ${FASTCAESOURCEINSTALLDIR}/build/moduleBase/
	cd ${FASTCAESOURCEINSTALLDIR}/build/moduleBase/
	${QMAKE} -o Makefile -Wnone ${FASTCAESOURCEINSTALLDIR}/Code/moduleBase/moduleBase.pro
	make ver=release
	if [ $? -ne 0 ]; then
		echo -e "\033[31mFailed to compile module moduleBase! \033[0m"
		return ${FAIL}
	fi

	mkdir -p ${FASTCAESOURCEINSTALLDIR}/build/GraphicsAnalyse/
	cd ${FASTCAESOURCEINSTALLDIR}/build/GraphicsAnalyse/
	${QMAKE} -o Makefile -Wnone ${FASTCAESOURCEINSTALLDIR}/Code/GraphicsAnalyse/GraphicsAnalyse.pro
	make ver=release
	if [ $? -ne 0 ]; then
		echo -e "\033[31mFailed to compile module GraphicsAnalyse! \033[0m"
		return ${FAIL}
	fi

	mkdir -p ${FASTCAESOURCEINSTALLDIR}/build/PostWidgets/
	cd ${FASTCAESOURCEINSTALLDIR}/build/PostWidgets/
	${QMAKE} -o Makefile -Wnone ${FASTCAESOURCEINSTALLDIR}/Code/PostWidgets/PostWidgets.pro
	make ver=release
	if [ $? -ne 0 ]; then
		echo -e "\033[31mFailed to compile module PostWidgets! \033[0m"
		return ${FAIL}
	fi

	mkdir -p ${FASTCAESOURCEINSTALLDIR}/build/GeometryDataExchange/
	cd ${FASTCAESOURCEINSTALLDIR}/build/GeometryDataExchange/
	${QMAKE} -o Makefile -Wnone ${FASTCAESOURCEINSTALLDIR}/Code/GeometryDataExchange/GeometryDataExchange.pro 
	make ver=release
	if [ $? -ne 0 ]; then
		echo -e "\033[31mFailed to compile module GeometryDataExchange! \033[0m"
		return ${FAIL}
	fi

	mkdir -p ${FASTCAESOURCEINSTALLDIR}/build/IO/
	cd ${FASTCAESOURCEINSTALLDIR}/build/IO/
	${QMAKE} -o Makefile -Wnone ${FASTCAESOURCEINSTALLDIR}/Code/IO/IO.pro
	make ver=release
	if [ $? -ne 0 ]; then
		echo -e "\033[31mFailed to compile module IO! \033[0m"
		return ${FAIL}
	fi

	mkdir -p ${FASTCAESOURCEINSTALLDIR}/build/ProjectTree/
	cd ${FASTCAESOURCEINSTALLDIR}/build/ProjectTree/
	${QMAKE} -o Makefile -Wnone ${FASTCAESOURCEINSTALLDIR}/Code/ProjectTree/projectTree.pro
	make ver=release
	if [ $? -ne 0 ]; then
		echo -e "\033[31mFailed to compile module projectTree! \033[0m"
		return ${FAIL}
	fi

	mkdir -p ${FASTCAESOURCEINSTALLDIR}/build/GeometryCommand/
	cd ${FASTCAESOURCEINSTALLDIR}/build/GeometryCommand/
	${QMAKE} -o Makefile -Wnone ${FASTCAESOURCEINSTALLDIR}/Code/GeometryCommand/geometryCommand.pro
	make ver=release
	if [ $? -ne 0 ]; then
		echo -e "\033[31mFailed to compile module geometryCommand! \033[0m"
		return ${FAIL}
	fi

	mkdir -p ${FASTCAESOURCEINSTALLDIR}/build/SolverControl/
	cd ${FASTCAESOURCEINSTALLDIR}/build/SolverControl/
	${QMAKE} -o Makefile -Wnone ${FASTCAESOURCEINSTALLDIR}/Code/SolverControl/solverControl.pro
	make ver=release
	if [ $? -ne 0 ]; then
		echo -e "\033[31mFailed to compile module solverControl! \033[0m"
		return ${FAIL}
	fi

	mkdir -p ${FASTCAESOURCEINSTALLDIR}/build/ProjectTreeExtend/
	cd ${FASTCAESOURCEINSTALLDIR}/build/ProjectTreeExtend/
	${QMAKE} -o Makefile -Wnone ${FASTCAESOURCEINSTALLDIR}/Code/ProjectTreeExtend/ProjectTreeExtend.pro
	make ver=release
	if [ $? -ne 0 ]; then
		echo -e "\033[31mFailed to compile module ProjectTreeExtend! \033[0m"
		return ${FAIL}
	fi

	mkdir -p ${FASTCAESOURCEINSTALLDIR}/build/GeometryWidgets/
	cd ${FASTCAESOURCEINSTALLDIR}/build/GeometryWidgets/
	${QMAKE} -o Makefile -Wnone ${FASTCAESOURCEINSTALLDIR}/Code/GeometryWidgets/geometryWidgets.pro
	make ver=release
	if [ $? -ne 0 ]; then
		echo -e "\033[31mFailed to compile module geometryWidgets! \033[0m"
		return ${FAIL}
	fi

	mkdir -p ${FASTCAESOURCEINSTALLDIR}/build/MainWidgets/
	cd ${FASTCAESOURCEINSTALLDIR}/build/MainWidgets/
	${QMAKE} -o Makefile -Wnone ${FASTCAESOURCEINSTALLDIR}/Code/MainWidgets/mainwidgets.pro
	make ver=release
	if [ $? -ne 0 ]; then
		echo -e "\033[31mFailed to compile module mainwidgets! \033[0m"
		return ${FAIL}
	fi

	mkdir -p ${FASTCAESOURCEINSTALLDIR}/build/PluginManager/
	cd ${FASTCAESOURCEINSTALLDIR}/build/PluginManager/
	${QMAKE} -o Makefile -Wnone ${FASTCAESOURCEINSTALLDIR}/Code/PluginManager/PluginManager.pro
	make ver=release
	if [ $? -ne 0 ]; then
		echo -e "\033[31mFailed to compile module PluginManager! \033[0m"
		return ${FAIL}
	fi

	mkdir -p ${FASTCAESOURCEINSTALLDIR}/build/Gmsh/
	cd ${FASTCAESOURCEINSTALLDIR}/build/Gmsh/
	${QMAKE} -o Makefile -Wnone ${FASTCAESOURCEINSTALLDIR}/Code/Gmsh/GmshModule.pro
	#cp -d ./gmsh441/lib/*    ../../output/bin/
	make ver=release
	if [ $? -ne 0 ]; then
		echo -e "\033[31mFailed to compile module GmshModule! \033[0m"
		return ${FAIL}
	fi

	mkdir -p ${FASTCAESOURCEINSTALLDIR}/build/UserGuidence/
	cd ${FASTCAESOURCEINSTALLDIR}/build/UserGuidence/
	${QMAKE} -o Makefile -Wnone ${FASTCAESOURCEINSTALLDIR}/Code/UserGuidence/UserGuidence.pro
	make ver=release
	if [ $? -ne 0 ]; then
		echo -e "\033[31mFailed to compile module UserGuidence! \033[0m"
		return ${FAIL}
	fi

	mkdir -p ${FASTCAESOURCEINSTALLDIR}/build/mainWindow/
	cd ${FASTCAESOURCEINSTALLDIR}/build/mainWindow/
	${QMAKE} -o Makefile -Wnone ${FASTCAESOURCEINSTALLDIR}/Code/mainWindow/mainWindow.pro
	make ver=release
	if [ $? -ne 0 ]; then
		echo -e "\033[31mFailed to compile module mainWindow! \033[0m"
		return ${FAIL}
	fi

	mkdir -p ${FASTCAESOURCEINSTALLDIR}/build/main/
	cd ${FASTCAESOURCEINSTALLDIR}/build/main/
	${QMAKE} -o Makefile -Wnone ${FASTCAESOURCEINSTALLDIR}/Code/main/main.pro
	make ver=release
	if [ $? -ne 0 ]; then
		echo -e "\033[31mFailed to compile module main! \033[0m"
		return ${FAIL}
	fi


	mkdir -p ${FASTCAESOURCEINSTALLDIR}/build/PluginMeshDataExchange/
	cd ${FASTCAESOURCEINSTALLDIR}/build/PluginMeshDataExchange/
	${QMAKE} -o Makefile -Wnone ${FASTCAESOURCEINSTALLDIR}/Code/PluginMeshDataExchange/meshDataExchangePlugin.pro
	make ver=release
	if [ $? -ne 0 ]; then
		echo -e "\033[31mFailed to compile module meshDataExchangePlugin! \033[0m"
		return ${FAIL}
	fi

	mkdir -p ${FASTCAESOURCEINSTALLDIR}/build/PluginCustomizer/
	cd ${FASTCAESOURCEINSTALLDIR}/build/PluginCustomizer/
	${QMAKE} -o Makefile -Wnone ${FASTCAESOURCEINSTALLDIR}/Code/PluginCustomizer/pluginCustomizer.pro
	make ver=release
	if [ $? -ne 0 ]; then
		echo -e "\033[31mFailed to compile module pluginCustomizer! \033[0m" 
		return ${FAIL}
	fi

	return ${SUCCESS}
}
installFastCAE ()
{
	if [ ! -f ${FASTCAESOURCEINSTALLDIR}/Code/FastCAE.pro ]; then

		echo ${VARPWD} | sudo -S apt-get install build-essential libgl1-mesa-dev libglu1-mesa-dev freeglut3-dev libglew-dev libglew-dev libgl1-mesa-glx libxmu-dev -y
		echo -e "\033[32mUnpack fastcae code... \033[0m" 
		mkdir -p ${FASTCAESOURCEINSTALLDIR}/Code
		if [ ${ISVTK6} = "YES" ];then
			tar -zxvf ${WORKDIR}/package/FastCAE-vtk6.tar.gz -C ${FASTCAESOURCEINSTALLDIR}
		else
			tar -zxvf ${WORKDIR}/package/FastCAE.tar.gz -C ${FASTCAESOURCEINSTALLDIR}
		fi
		mkdir -p ${FASTCAESOURCEINSTALLDIR}/output/bin/
		mkdir -p ${FASTCAESOURCEINSTALLDIR}/output/temp/
		cp ${FASTCAESOURCEINSTALLDIR}/Code/python/Py/* ${FASTCAESOURCEINSTALLDIR}/output/bin/

		#gmsh
		mkdir -p ${FASTCAESOURCEINSTALLDIR}/output/bin/gmsh
		cp -a ${FASTCAESOURCEINSTALLDIR}/Code/Gmsh/gmsh454/gmsh ${FASTCAESOURCEINSTALLDIR}/output/bin/gmsh/
		cp -a ${FASTCAESOURCEINSTALLDIR}/Code/Gmsh/gmsh454/gmsh.Geo ${FASTCAESOURCEINSTALLDIR}/output/bin/gmsh/
		chmod +x ${FASTCAESOURCEINSTALLDIR}/output/bin/gmsh/gmsh
	fi

	if [ ! -f ${FASTCAESOURCEINSTALLDIR}/output/python37/bin/python3 ]; then
		if ! installPython; then
			exit ${FAIL}
		fi
		echo -e "\033[32mCopy python library... \033[0m" 
		mkdir -p ${FASTCAESOURCEINSTALLDIR}/output/python37/
		cp -rf /opt/python-3.7.0/* ${FASTCAESOURCEINSTALLDIR}/output/python37/
		mv ${FASTCAESOURCEINSTALLDIR}/output/python37/include/python3.7m/* ${FASTCAESOURCEINSTALLDIR}/output/python37/include/
		#python
		cp -a ${FASTCAESOURCEINSTALLDIR}/output/python37/lib/*	${FASTCAESOURCEINSTALLDIR}/output/bin/
		rm -rf ${FASTCAESOURCEINSTALLDIR}/output/python37/include/python3.7m
	fi
	
	if [ ! -f ${FASTCAESOURCEINSTALLDIR}/quazip/lib/libquazip.so ]; then
		if ! installQuazip; then
			exit ${FAIL}
		fi
		echo -e "\033[32mCopy quazip library... \033[0m" 
		mkdir -p ${FASTCAESOURCEINSTALLDIR}/quazip/
		cp -rf ${TEMPDIR}/quazip-0.7.3/bin/* ${FASTCAESOURCEINSTALLDIR}/quazip/
		#quazip
		cp -a ${FASTCAESOURCEINSTALLDIR}/quazip/lib/*     	${FASTCAESOURCEINSTALLDIR}/output/bin/
		rm -rf ${TEMPDIR}/quazip-0.7.3/
	fi
	
	if [ ! -f ${FASTCAESOURCEINSTALLDIR}/Qwt/lib/libqwtpolar.so ]; then
		if ! installQwt; then
			exit ${FAIL}
		fi
		echo -e "\033[32mCopy qwt library... \033[0m" 
		mkdir -p ${FASTCAESOURCEINSTALLDIR}/Qwt/
		cp -rf ${TEMPDIR}/qwtpolar-1.1.1/bin/* ${FASTCAESOURCEINSTALLDIR}/Qwt/
		cp -rf ${TEMPDIR}/qwt-6.1.6/bin/* ${FASTCAESOURCEINSTALLDIR}/Qwt/
		#Qwt
		cp -a ${FASTCAESOURCEINSTALLDIR}/Qwt/lib/* ${FASTCAESOURCEINSTALLDIR}/output/bin/
		rm -rf ${TEMPDIR}/qwtpolar-1.1.1/
		rm -rf ${TEMPDIR}/qwt-6.1.6/
	fi
	if [ ${ISVTK6} = "YES" ]; then
		if [ ! -f ${FASTCAESOURCEINSTALLDIR}/VTK/lib/libvtkRenderingCore-6.1.so ]; then
			if ! installVtk610; then
				exit ${FAIL}
			fi
			echo -e "\033[32mCopy vtk library... \033[0m"
			mkdir -p ${FASTCAESOURCEINSTALLDIR}/VTK/
			cp -rf ${TEMPDIR}/vtk-6.1.0/install/* ${FASTCAESOURCEINSTALLDIR}/VTK/
			#VTK
			cp -a ${FASTCAESOURCEINSTALLDIR}/VTK/lib/* ${FASTCAESOURCEINSTALLDIR}/output/bin/
			rm -rf ${TEMPDIR}/vtk-6.1.0/
		fi
	else
		if [ ! -f ${FASTCAESOURCEINSTALLDIR}/VTK/lib/libvtkRenderingCore-9.0.so ]; then
			if ! installVtk901; then
				exit ${FAIL}
			fi
			echo -e "\033[32mCopy vtk library... \033[0m"
			mkdir -p ${FASTCAESOURCEINSTALLDIR}/VTK/
			cp -rf ${TEMPDIR}/vtk-9.0.1/install/* ${FASTCAESOURCEINSTALLDIR}/VTK/
			#VTK
			cp -a ${FASTCAESOURCEINSTALLDIR}/VTK/lib64/* ${FASTCAESOURCEINSTALLDIR}/output/bin/
			rm -rf ${TEMPDIR}/vtk-9.0.1/
		fi
	fi

	
	if [ ! -f ${FASTCAESOURCEINSTALLDIR}/OCC/lib/libTKIVtk.so ]; then
		if ! installTclTk; then
			exit ${FAIL}
		fi

		if ! installFreeImage; then
			exit ${FAIL}
		fi

		if ! installOpenCaseCad; then
			exit ${FAIL}
		fi
		echo -e "\033[32mCopy opencascade library... \033[0m" 
		mkdir -p ${FASTCAESOURCEINSTALLDIR}/OCC/
		cp -rf ${TEMPDIR}/occ-7.5.0/install/* ${FASTCAESOURCEINSTALLDIR}/OCC/

		#OCC
		cp -a ${FASTCAESOURCEINSTALLDIR}/OCC/lib/* ${FASTCAESOURCEINSTALLDIR}/output/bin/

		rm -rf ${TEMPDIR}/occ-7.5.0/
	fi
	if [ ! -f ${FASTCAESOURCEINSTALLDIR}/cgns/cgns_linux/cgnslib.h ]; then
		if ! installCgns; then
			exit ${FAIL}
		fi

		echo -e "\033[32mCopy cgns library... \033[0m" 
		mkdir -p ${FASTCAESOURCEINSTALLDIR}/cgns/cgns_linux/
		cp -rf ${TEMPDIR}/hdf5-1.12.1/HDF_Group/HDF5/1.12.1/include/* ${FASTCAESOURCEINSTALLDIR}/cgns/cgns_linux/
		cp -rf ${TEMPDIR}/hdf5-1.12.1/HDF_Group/HDF5/1.12.1/lib/* ${FASTCAESOURCEINSTALLDIR}/cgns/cgns_linux/
		cp -rf ${TEMPDIR}/hdf5-1.12.1/HDF_Group/HDF5/1.12.1/bin/* ${FASTCAESOURCEINSTALLDIR}/cgns/cgns_linux/
		cp -rf ${TEMPDIR}/hdf5-1.12.1/HDF_Group/HDF5/1.12.1/share/* ${FASTCAESOURCEINSTALLDIR}/cgns/cgns_linux/

		cp -rf ${TEMPDIR}/cgns-4.2.0/install/include/* ${FASTCAESOURCEINSTALLDIR}/cgns/cgns_linux/
		cp -rf ${TEMPDIR}/cgns-4.2.0/install/lib/* ${FASTCAESOURCEINSTALLDIR}/cgns/cgns_linux/
		cp -rf ${TEMPDIR}/cgns-4.2.0/install/bin/* ${FASTCAESOURCEINSTALLDIR}/cgns/cgns_linux/
		cp -rf ${TEMPDIR}/cgns-4.2.0/install/share/* ${FASTCAESOURCEINSTALLDIR}/cgns/cgns_linux/

		cp -a ${FASTCAESOURCEINSTALLDIR}/cgns/cgns_linux/* ${FASTCAESOURCEINSTALLDIR}/output/bin/
		rm -rf ${TEMPDIR}/hdf5-1.12.1/
		rm -rf ${TEMPDIR}/cgns-4.2.0/
	fi

	if [ ! -f /etc/ld.so.conf.d/fastcae.conf ];then
echo ${VARPWD} | sudo  su - root << EOF
		echo "${FASTCAESOURCEINSTALLDIR}/output/bin/" >> /etc/ld.so.conf.d/fastcae.conf;
		/sbin/ldconfig;
		exit;
EOF
	elif [ $(grep -c "${FASTCAESOURCEINSTALLDIR}/output/bin/" /etc/ld.so.conf.d/fastcae.conf) -eq 0 ];then
echo ${VARPWD} | sudo su - root << EOF
		echo "${FASTCAESOURCEINSTALLDIR}/output/bin/" >> /etc/ld.so.conf.d/fastcae.conf;
		/sbin/ldconfig;
		exit;
EOF
	fi

	g=$(groups)
	n=$(whoami)
	chown -R ${n}:${n} ${FASTCAESOURCEINSTALLDIR}
	
	if ! compileFastCAE; then
		echo -e "\033[31mFailed to compile FastCAE! \033[0m" 
		exit ${FAIL}
	fi

	cd ${FASTCAESOURCEINSTALLDIR}/output/bin/
	echo "export PYTHONHOME=\$PYTHONHOME:/opt/python-3.7.0/" > StartFastCAE.sh
	echo "export PYTHONPATH=\$PYTHONPATH:/opt/python-3.7.0/lib/python3.7/" >> StartFastCAE.sh
	echo "./FastCAE" >> StartFastCAE.sh
	
	chmod +x ./StartFastCAE.sh

	./StartFastCAE.sh &

}

if [ ! -d ${TEMPDIR} ];then
	mkdir -p ${TEMPDIR}
fi



if [ ${ISVTK6} = "YES" ]; then
	if [ -f /usr/bin/qmake ]; then
		if [ $(echo $(qmake -version) | grep -c "Using Qt version 5.4.2") -eq 0 ]; then
			if ! installQt542; then
				exit ${FAIL}
			else
				QMAKE=/opt/Qt5.4.2/5.4/gcc_64/bin/qmake;
			fi
		else
			QMAKE=qmake;
		fi
	else
		if ! installQt542; then
			exit ${FAIL}
		else
			QMAKE=/opt/Qt5.4.2/5.4/gcc_64/bin/qmake;
		fi
	fi
else
	if [ -f /usr/bin/qmake ]; then
		if [ $(echo $(qmake -version) | grep -c "Using Qt version 5.14.2") -eq 0 ]; then
			if ! installQt5142; then
				exit ${FAIL}
			else
				QMAKE=/opt/Qt5.14.2/5.14.2/gcc_64/bin/qmake;
			fi
		else
			QMAKE=qmake;
		fi
	else
		if ! installQt5142; then
			exit ${FAIL}
		else
			QMAKE=/opt/Qt5.14.2/5.14.2/gcc_64/bin/qmake;
		fi
	fi
	
fi

if ! installCmake3213; then
	exit ${FAIL}
fi
CMAKE=/opt/cmake-3.21/bin/cmake;

if ! installFastCAE; then
	exit ${FAIL}
fi

  

 

上一篇:Oracle 11g review


下一篇:Jmeter+Influxdb+Grafana搭建实时性能展示平台