提交 cf7b249e authored 作者: Iñaki Baz Castillo's avatar Iñaki Baz Castillo

Makefile: add cpu_cores.sh (taken from mediasoup v3)

上级 8408d953
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
# Best effort to get Python 2 executable and also allow custom PYTHON # Best effort to get Python 2 executable and also allow custom PYTHON
# environment variable set by the user. # environment variable set by the user.
PYTHON ?= $(shell command -v python2 2> /dev/null || echo python) PYTHON ?= $(shell command -v python2 2> /dev/null || echo python)
ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
CORES ?= $(shell ${ROOT_DIR}/scripts/cpu_cores.sh)
.PHONY: \ .PHONY: \
default Release Debug test test-Release test-Debug fuzzer \ default Release Debug test test-Release test-Debug fuzzer \
...@@ -19,11 +21,11 @@ endif ...@@ -19,11 +21,11 @@ endif
Release: Release:
$(PYTHON) ./scripts/configure.py -R mediasoup-worker $(PYTHON) ./scripts/configure.py -R mediasoup-worker
$(MAKE) BUILDTYPE=Release -C out $(MAKE) -j$(CORES) BUILDTYPE=Release -C out
Debug: Debug:
$(PYTHON) ./scripts/configure.py -R mediasoup-worker $(PYTHON) ./scripts/configure.py -R mediasoup-worker
$(MAKE) BUILDTYPE=Debug -C out $(MAKE) -j$(CORES) BUILDTYPE=Debug -C out
test: test:
ifeq ($(MEDIASOUP_BUILDTYPE),Debug) ifeq ($(MEDIASOUP_BUILDTYPE),Debug)
...@@ -34,15 +36,15 @@ endif ...@@ -34,15 +36,15 @@ endif
test-Release: test-Release:
$(PYTHON) ./scripts/configure.py -R mediasoup-worker-test $(PYTHON) ./scripts/configure.py -R mediasoup-worker-test
$(MAKE) BUILDTYPE=Release -C out $(MAKE) -j$(CORES) BUILDTYPE=Release -C out
test-Debug: test-Debug:
$(PYTHON) ./scripts/configure.py -R mediasoup-worker-test $(PYTHON) ./scripts/configure.py -R mediasoup-worker-test
$(MAKE) BUILDTYPE=Debug -C out $(MAKE) -j$(CORES) BUILDTYPE=Debug -C out
fuzzer: fuzzer:
$(PYTHON) ./scripts/configure.py -R mediasoup-worker-fuzzer $(PYTHON) ./scripts/configure.py -R mediasoup-worker-fuzzer
$(MAKE) BUILDTYPE=Release -C out $(MAKE) -j$(CORES) BUILDTYPE=Release -C out
fuzzer-docker-build: fuzzer-docker-build:
ifeq ($(DOCKER_NO_CACHE),true) ifeq ($(DOCKER_NO_CACHE),true)
......
#!/usr/bin/env bash
set -e
OS="$(uname -s)"
NUM_CORES=
case "${OS}" in
Linux*) NUM_CORES=$(nproc);;
Darwin*) NUM_CORES=$(sysctl -n hw.ncpu);;
*) NUM_CORES=1;;
esac
echo ${NUM_CORES}
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论