-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
60 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/bin/bash | ||
#!/bin/sh | ||
# Use this script to build MegaGlest using cmake | ||
# ---------------------------------------------------------------------------- | ||
# Written by Mark Vejvoda <[email protected]> | ||
|
@@ -133,7 +133,19 @@ EXTRA_CMAKE_OPTIONS= | |
|
||
# Build threads | ||
# By default we use all physical CPU cores to build. | ||
NUMCORES=`lscpu -p | grep -cv '^#'` | ||
# Detect number of CPU cores for Linux, macOS, and BSD-based systems | ||
|
||
if command -v lscpu >/dev/null 2>&1; then | ||
# Linux-specific (using lscpu) | ||
NUMCORES=$(lscpu -p | grep -cv '^#') | ||
elif uname | grep -iq bsd; then | ||
# macOS and any BSD-based system (using sysctl) | ||
NUMCORES=$(sysctl -n hw.ncpu) | ||
else | ||
# Unsupported OS, set NUMCORES to 1 | ||
NUMCORES=1 | ||
fi | ||
|
||
echo "CPU cores detected: $NUMCORES" | ||
if [ "$NUMCORES" = '' ]; then NUMCORES=1; fi | ||
if [ $CPU_COUNT != -1 ]; then NUMCORES=$CPU_COUNT; fi | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters