Skip to content

Commit

Permalink
worflow: nproc doesn't exist on mac
Browse files Browse the repository at this point in the history
  • Loading branch information
Ed94 committed Oct 19, 2024
1 parent 06f82b7 commit 6c20c3e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
7 changes: 0 additions & 7 deletions .github/workflows/macos_build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,6 @@ jobs:
brew install bash
echo "Bash version: $(bash --version)"
if command -v nproc &> /dev/null; then
echo "nproc is installed. Number of processors: $(nproc)"
else
echo "Error: nproc installation failed"
exit 1
fi
- name: Run build script
run: |
if [ -f "./scripts/build_sokol_demo.sh" ]; then
Expand Down
22 changes: 20 additions & 2 deletions scripts/build_sokol_demo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,26 @@ if [ -f "$path_system_details" ]; then
CoreCount_Physical=$(grep "PhysicalCores" "$path_system_details" | cut -d'=' -f2)
CoreCount_Logical=$(grep "LogicalCores" "$path_system_details" | cut -d'=' -f2)
else
CoreCount_Physical=$(nproc --all)
CoreCount_Logical=$(nproc)
# Detect the operating system
OS=$(uname -s)

case "$OS" in
Darwin*)
# macOS-specific commands
CoreCount_Physical=$(sysctl -n hw.physicalcpu)
CoreCount_Logical=$(sysctl -n hw.logicalcpu)
;;
Linux*)
# Linux-specific commands
CoreCount_Physical=$(nproc --all)
CoreCount_Logical=$(nproc)
;;
*)
echo "Unsupported operating system: $OS"
CoreCount_Physical=1
CoreCount_Logical=1
;;
esac

echo "[CPU]" > "$path_system_details"
echo "PhysicalCores=$CoreCount_Physical" >> "$path_system_details"
Expand Down

0 comments on commit 6c20c3e

Please sign in to comment.