Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions gfootball/build_game_engine.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,13 @@ if [[ "$OSTYPE" == "darwin"* ]] ; then
fi

# Take into account # of cores and available RAM for deciding on compilation parallelism.
# TODO: Try importing psutil and if failed fall back to 1 thread
PARALLELISM=$(python3 -c 'import psutil; import multiprocessing as mp; print(int(max(1,min((psutil.virtual_memory().available/1000000000-1)/0.5, mp.cpu_count()))))')
# Try importing psutil; if unavailable, fall back to CPU count (or 1 if that fails).
PARALLELISM=$(python3 -c 'import multiprocessing as mp
try:
import psutil
print(int(max(1, min((psutil.virtual_memory().available/1000000000-1)/0.5, mp.cpu_count()))))
except ImportError:
print(mp.cpu_count())' 2>/dev/null || echo 1)

# Delete pre-existing version of CMakeCache.txt to make 'python3 -m pip install' work.
rm -f third_party/gfootball_engine/CMakeCache.txt
Expand Down