You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

linux-build 2.4KB

3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. #!/bin/bash
  2. ov_build_type=Release
  3. ov_script_dir="${PWD}"
  4. ov_build_dir="${ov_script_dir}/../local-tmp/linux-${ov_build_type}"
  5. ov_install_dir="${ov_script_dir}/../dist"
  6. while [[ $# -gt 0 ]]; do
  7. key="$1"
  8. case $key in
  9. -h | --help)
  10. usage
  11. exit
  12. ;;
  13. -v | --verbose)
  14. verbose=1
  15. ;;
  16. -d | --debug)
  17. ov_build_type=Debug
  18. ;;
  19. -r | --release)
  20. ov_build_type=Release
  21. ;;
  22. --debug-symbols)
  23. ov_build_type=RelWithDebInfo
  24. ;;
  25. --profile)
  26. ov_build_type=RelWithDebInfo
  27. extra_flags="-DCMAKE_CXX_FLAGS_RELWITHDEBINFO='-O2 -g -DNDEBUG -pg' -DCMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO='-pg' -DCMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO='-pg' -DCMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO='-pg'"
  28. ;;
  29. --build-dir)
  30. ov_build_dir="$2"
  31. shift
  32. ;;
  33. --install-dir)
  34. ov_install_dir="$2"
  35. shift
  36. ;;
  37. --sdk)
  38. ov_sdk_dir="-DOPENVIBE_SDK_PATH=$2"
  39. shift
  40. ;;
  41. --designer)
  42. ov_designer_dir="-DDESIGNER_SDK_PATH=$2"
  43. shift
  44. ;;
  45. --dependencies-dir)
  46. dependencies_path="-DLIST_DEPENDENCIES_PATH=$2"
  47. shift
  48. ;;
  49. --sdk-src)
  50. ov_sdk_src_dir="$2"
  51. shift
  52. ;;
  53. --userdata-subdir)
  54. UserDataSubdir="-DOV_CONFIG_SUBDIR=$2"
  55. shift
  56. ;;
  57. *)
  58. echo "ERROR: Unknown parameter $key"
  59. exit 1
  60. ;;
  61. esac
  62. shift # past argument or value
  63. done
  64. echo ""
  65. echo "_______________________________________________________________________________"
  66. echo ""
  67. mkdir -p "${ov_build_dir}" 2> /dev/null
  68. pushd "${ov_build_dir}" 2> /dev/null
  69. echo ""
  70. echo "Creating makefiles..."
  71. echo ""
  72. cmake ${ov_script_dir}/.. -DCMAKE_BUILD_TYPE=${ov_build_type} ${extra_flags} -DCMAKE_INSTALL_PREFIX=${ov_install_dir} ${ov_sdk_dir} ${ov_designer_dir} ${dependencies_path} ${UserDataSubdir} -DOV_SDK_SOURCE_PATH=${ov_sdk_src_dir}
  73. if [ $? -eq 0 ]; then
  74. echo CMake has been called successfully !
  75. else
  76. exit -1
  77. fi;
  78. echo ""
  79. echo "Building ..."
  80. echo ""
  81. NJOBS=`grep processor /proc/cpuinfo | wc -l`
  82. make $1 -j $NJOBS # VERBOSE=1
  83. if [ $? -eq 0 ]; then
  84. echo Make has been called successfully !
  85. else
  86. exit -1
  87. fi;
  88. echo ""
  89. echo "Installing files to 'dist' folder, this can take a few seconds - maybe a few minutes..."
  90. echo ""
  91. make install
  92. if [ $? -eq 0 ]; then
  93. echo Make install has been called successfully !
  94. else
  95. true # exit -1
  96. fi;
  97. popd 2> /dev/null
  98. echo ""
  99. echo "_______________________________________________________________________________"
  100. echo ""
  101. echo ""
  102. echo "Building process terminated successfully !"
  103. echo ""
  104. echo ""
  105. echo "Install completed !"
  106. echo ""
  107. true