prepare_solution_linux.sh 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #!/bin/bash
  2. #
  3. # Copyright (c) Contributors to the Open 3D Engine Project.
  4. # For complete copyright and license terms please see the LICENSE at the root of this distribution.
  5. #
  6. # SPDX-License-Identifier: Apache-2.0 OR MIT
  7. #
  8. # Build
  9. CMAKE='cmake'
  10. BUILD='build'
  11. mkdir ${BUILD}
  12. mkdir bin
  13. LINUX_BIN_DIR='bin/linux'
  14. mkdir ${LINUX_BIN_DIR}
  15. CONFIGURATIONS=("Release" "Debug")
  16. MY_CC="/usr/bin/gcc"
  17. MY_CXX="/usr/bin/g++"
  18. EXTRA_CXX_OPTION=""
  19. NUM_ARGS=$#
  20. if [ $NUM_ARGS -eq 1 ]; then
  21. if [ $1 = "clang" ]; then
  22. MY_CC="clang-12"
  23. MY_CXX="clang++-12"
  24. EXTRA_CXX_OPTION="-DWITH_LIBCXX=Off" #Required by ANTLR to avoid failure to find std c++ include files like <algorithm>, etc.
  25. fi
  26. fi
  27. for CONFIG in ${CONFIGURATIONS[@]}; do
  28. echo ""
  29. echo "Configuring for $CONFIG build..."
  30. echo ""
  31. BUILD_DIR=$BUILD/$CONFIG
  32. $CMAKE -G "Unix Makefiles" -S "src/" -B $BUILD_DIR $EXTRA_CXX_OPTION -DCMAKE_BUILD_TYPE=$CONFIG -DCMAKE_C_COMPILER=$MY_CC -DCMAKE_CXX_COMPILER=$MY_CXX
  33. echo "Will proceed to build in $CONFIG configuration..."
  34. $CMAKE --build $BUILD_DIR --target azslc --config $CONFIG -j 16
  35. pushd $BUILD_DIR
  36. echo "Executing azslc in $CONFIG version:"
  37. ./azslc --version
  38. popd
  39. echo "Deploying azslc $CONFIG binary..."
  40. CONFIG_LCASE="$(tr [A-Z] [a-z] <<< "$CONFIG")"
  41. DEPLOY_DIR=$LINUX_BIN_DIR/$CONFIG_LCASE
  42. mkdir $DEPLOY_DIR
  43. cp $BUILD_DIR/azslc $DEPLOY_DIR/
  44. echo "azslc was deployed to $DEPLOY_DIR"
  45. done