From ad0le, 6 Months ago, written in Bash.
  1. #!/bin/bash
  2.  
  3. bin_dir='/mnt/workspace/c++/durango/bin'
  4.  
  5. release_build_include_path="-I/opt/vc/include"
  6. release_build_library_path="-L/opt/vc/lib"
  7. release_build_library_items="-lbcm_host -lbrcmEGL -lbrcmGLESv2"
  8.  
  9. debug_build_include_path="-I/opt/vc/include"
  10. debug_build_library_path="-L/opt/vc/lib"
  11. debug_build_library_items="-lbcm_host -lbrcmEGL -lbrcmGLESv2"
  12.  
  13. clear
  14.  
  15. echo "Changining directory..."
  16. cd /mnt/workspace/c++/durango
  17. if [ -d "$bin_dir" ]
  18. then
  19.         echo "Deleting existing bin directory..."
  20.         rm -rf "$bin_dir"
  21. fi
  22.  
  23. echo "Making bin directory..."
  24.  
  25. mkdir "$bin_dir"
  26. if [[ $# -eq 0 ]]
  27. then
  28.         echo "Must specify 'debug' or 'release'. Exiting..."
  29.         exit 1
  30. fi
  31.  
  32. build_type=$1
  33.  
  34. if [ "${build_type,,}" == "debug" ]
  35. then
  36.         cd "$bin_dir"
  37.         mkdir debug
  38.         cd ../..
  39.         build_command="g++ -std=c++11 -Wall -g $debug_build_include_path $debug_build_library_path $debug_build_library_items ./source/*.cpp -o ./bin/debug/durango"
  40.         echo "Compiling debug executable..."
  41.         echo "$build_command"
  42.         eval "$build_command"
  43. elif [ "${build_type,,}" == "release" ]
  44. then
  45.         cd "$bin_dir"
  46.         mkdir release
  47.         cd ../..
  48.         build_command="g++ -std=c++11 -O2 $release_build_include_path $release_build_library_path $release_build_library_items ./source/*.cpp -o ./bin/release/durango"
  49.         echo "Compiling release executable..."
  50.         echo "$build_command"
  51.         eval "$build_command"
  52. else
  53.         echo "Unknown build option..."
  54.         exit 1
  55. fi
captcha