diff --git a/jsk_unitree_robot/cross/build_ros1.sh b/jsk_unitree_robot/cross/build_ros1.sh index 27d52d2f32..4779c1ecf3 100755 --- a/jsk_unitree_robot/cross/build_ros1.sh +++ b/jsk_unitree_robot/cross/build_ros1.sh @@ -1,7 +1,12 @@ #!/bin/bash -# From https://qiita.com/ymdymd/items/312c9f554d4ffb1f8dc6 -JOBS=$(($(grep cpu.cores /proc/cpuinfo | sort -u | sed 's/[^0-9]//g') + 1)) +if [[ "$OSTYPE" == "linux-gnu"* ]]; then + JOBS=$(cat /proc/cpuinfo | grep "processor" | wc -l) +elif [[ "$OSTYPE" == "darwin"* ]]; then + JOBS=$(sysctl -n hw.logicalcpu) +else + JOBS=8 +fi TARGET_MACHINE="${TARGET_MACHINE:-arm64v8}" HOST_INSTALL_ROOT="${BASE_ROOT:-${PWD}}/"${TARGET_MACHINE}_System diff --git a/jsk_unitree_robot/cross/build_ros1_dependencies.sh b/jsk_unitree_robot/cross/build_ros1_dependencies.sh index f250b7c824..097fbe89d4 100755 --- a/jsk_unitree_robot/cross/build_ros1_dependencies.sh +++ b/jsk_unitree_robot/cross/build_ros1_dependencies.sh @@ -1,7 +1,14 @@ #!/bin/bash -# From https://qiita.com/ymdymd/items/312c9f554d4ffb1f8dc6 -JOBS=$(($(grep cpu.cores /proc/cpuinfo | sort -u | sed 's/[^0-9]//g') + 1)) +IMAGE_NAME="${IMAGE_NAME:-ros1-unitree}" + +if [[ "$OSTYPE" == "linux-gnu"* ]]; then + JOBS=$(cat /proc/cpuinfo | grep "processor" | wc -l) +elif [[ "$OSTYPE" == "darwin"* ]]; then + JOBS=$(sysctl -n hw.logicalcpu) +else + JOBS=8 +fi TARGET_MACHINE="${TARGET_MACHINE:-arm64v8}" HOST_INSTALL_ROOT="${BASE_ROOT:-${PWD}}/"${TARGET_MACHINE}_System