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

cmake.sh 880 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/bin/bash
  2. set -e
  3. BASEDIR=$(readlink -f "$(dirname "$0")"/..)
  4. source "${BASEDIR}/ci/utils.sh"
  5. if [[ "$1" == cpu ]]; then
  6. DMGE_WITH_DISTRIBUTED=OFF
  7. DMGE_WITH_CUDA=OFF
  8. elif [[ "$1" == cuda ]]; then
  9. DMGE_WITH_DISTRIBUTED=ON
  10. DMGE_WITH_CUDA=ON
  11. else
  12. log "Argument must cpu or cuda"
  13. exit 1
  14. fi
  15. function build() {
  16. log "Start to build"
  17. local build_dir="/tmp/build/${1}"
  18. mkdir -p "$build_dir"
  19. pushd ${build_dir} >/dev/null
  20. cmake -S "${BASEDIR}" -B "${build_dir}" \
  21. -DMGE_WITH_DISTRIBUTED=${DMGE_WITH_DISTRIBUTED} \
  22. -DMGE_WITH_CUDA=${DMGE_WITH_CUDA} \
  23. -DMGE_WITH_TEST=ON \
  24. -DCMAKE_BUILD_TYPE=RelWithDebInfo \
  25. -DMGE_WITH_CUSTOM_OP=ON
  26. make -j$(($(nproc) * 2)) -I ${build_dir}
  27. make develop
  28. popd >/dev/null
  29. log "End build: $(ls ${build_dir})"
  30. }
  31. build "$@"