Skip to content

Instantly share code, notes, and snippets.

@Jiwan
Last active January 16, 2017 20:26
Show Gist options
  • Save Jiwan/60531742b9d0e2b36b50b83dffef4070 to your computer and use it in GitHub Desktop.
Save Jiwan/60531742b9d0e2b36b50b83dffef4070 to your computer and use it in GitHub Desktop.
Compiler env.sh
COMPILER_ENV=GCC_7
if [ -z "$COMPILER_ENV" ];
then
echo "Variable COMPILER_ENV must be set and be the name of a folder in /opt";
else
echo "Configuring compiler environment.";
INSTALL_DIR=/opt/${COMPILER_ENV}
THIRD_PARTY_DIR=${INSTALL_DIR}/thirdparty
export GCC_ENV_DIR=${INSTALL_DIR}
export GCC_BIN_DIR=${GCC_ENV_DIR}/bin
export CC=${GCC_BIN_DIR}/gcc
export CXX=${GCC_BIN_DIR}/g++
export CPP=${GCC_BIN_DIR}/cpp
# export LD=$GCC_BIN_DIR/gcc
export LD_PRELOAD_PATH=${GCC_ENV_DIR}/libexec:${GCC_ENV_DIR}/lib64:${GCC_ENV_DIR}/lib:${LD_PRELOAD_PATH}
export LD_LIBRARY_PATH=${LD_PRELOAD_PATH}:${LD_LIBRARY_PATH}
export LIBRARY_PATH=${GCC_ENV_DIR}/lib
export C_INCLUDE_PATH=${GCC_ENV_DIR}/include
export CPLUS_INCLUDE_PATH=${GCC_ENV_DIR}/include
export BOOST_INCLUDEDIR=${GCC_ENV_DIR}/include
# Thirdparty.
export LD_PRELOAD_PATH=$THIRD_PARTY_DIR/lib:$LD_PRELOAD_PATH
export LD_LIBRARY_PATH=$THIRD_PARTY_DIR/lib:${LD_LIBRARY_PATH}
export LIBRARY_PATH=$THIRD_PARTY_DIR/lib:${LIBRARY_PATH}
export C_INCLUDE_PATH=$THIRD_PARTY_DIR/include:$C_INCLUDE_PATH
export CPLUS_INCLUDE_PATH=$THIRD_PARTY_DIR/include:$CPLUS_INCLUDE_PATH
export PATH=$GCC_BIN_DIR:$THIRD_PARTY_DIR/bin:$PATH
# Cmake paths
export CMAKE_INCLUDE_PATH=$CPLUS_INCLUDE_PATH
export CMAKE_LIBRARY_PATH=$LD_LIBRARY_PATH
export CMAKE_PREFIX_PATH=$GCC_ENV_DIR/thirdparty/
fi;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment