Unverified 提交 df066364 authored 作者: Nazar Mokrynskyi's avatar Nazar Mokrynskyi 提交者: GitHub

Merge pull request #622 from nazar-pc/meson

Meson build system 💪
...@@ -26,12 +26,24 @@ jobs: ...@@ -26,12 +26,24 @@ jobs:
- os: macos-10.15 - os: macos-10.15
cc: clang cc: clang
cxx: clang++ cxx: clang++
# macOS 11 is in private preview currently. - os: macos-11
# - os: macos-11.0 cc: gcc
# Windows needs to be tuned before it can run, I didn't bother, feel cxx: g++
# free to contribute. - os: macos-11
cc: clang
cxx: clang++
# TODO: These build, but don't run, unlock if you figure out why
# - os: windows-2019 # - os: windows-2019
# Just 1 Node.js version should be fine for C++. # cc: gcc
# cxx: g++
# - os: windows-2019
# cc: clang
# cxx: clang++
# TODO: Unlock when intermittent unexplainable CI errors are resolved
# - os: windows-2019
# cc: cl
# cxx: cl
# A single Node.js version should be fine for C++.
node: node:
- 14 - 14
...@@ -42,6 +54,24 @@ jobs: ...@@ -42,6 +54,24 @@ jobs:
CXX: ${{ matrix.build.cxx }} CXX: ${{ matrix.build.cxx }}
steps: steps:
- name: Add MSVC compiler
uses: ilammy/msvc-dev-cmd@v1
if: runner.os == 'Windows' && matrix.build.cc == 'cl'
# This is needed as a workaround for GNU linker being first in PATH and thus preventing Meson from finding MSVC
# linker.
- name: Remove GNU linker for MSVC
shell: bash
run: rm /usr/bin/link
if: runner.os == 'Windows' && matrix.build.cc == 'cl'
# Clang is in MSYS2's bin directory, but adding it to PATH breaks a lot of stuff, so let's just fix paths.
- name: Specify full path to Clang on Windows
run: |
echo "CC=C:\msys64\mingw64\bin\${env:CC}" >> $env:GITHUB_ENV
echo "CXX=C:\msys64\mingw64\bin\${env:CXX}" >> $env:GITHUB_ENV
if: runner.os == 'Windows' && matrix.build.cc == 'clang'
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
...@@ -50,6 +80,13 @@ jobs: ...@@ -50,6 +80,13 @@ jobs:
with: with:
node-version: ${{ matrix.node }} node-version: ${{ matrix.node }}
- run: npm run install-clang-tools
# TODO: Maybe fix this one day
if: runner.os != 'Windows'
- run: npm run lint:worker
# TODO: Maybe fix this one day
if: runner.os != 'Windows'
- name: Configure cache - name: Configure cache
uses: actions/cache@v2 uses: actions/cache@v2
with: with:
...@@ -59,7 +96,8 @@ jobs: ...@@ -59,7 +96,8 @@ jobs:
restore-keys: | restore-keys: |
${{ matrix.build.os }}-node-${{matrix.build.cc}}- ${{ matrix.build.os }}-node-${{matrix.build.cc}}-
- run: npm install - run: npm run worker:build
- run: npm run install-clang-tools
- run: npm run lint:worker
- run: npm run test:worker - run: npm run test:worker
# All compilers on Windows can build everything, but tests fail to run on GCC/Clang with "Error -1073741511",
# remove condition below if you fixed it.
if: runner.os != 'Windows' || matrix.build.cc == 'cl'
...@@ -2,16 +2,8 @@ ...@@ -2,16 +2,8 @@
/coverage/ /coverage/
/NO_GIT/ /NO_GIT/
# clang-tidy stuff. # Generated stuff.
/worker/compile_commands.json
# gyp generated stuff.
/worker/out/ /worker/out/
/worker/**/*.xcodeproj/
/worker/**/*.sln
/worker/**/*.vcxproj
/worker/**/*.vcxproj.filters
/worker/**/*.vcxproj.user
# clang-fuzzer stuff is too big. # clang-fuzzer stuff is too big.
/worker/deps/clang-fuzzer /worker/deps/clang-fuzzer
...@@ -27,8 +19,6 @@ ...@@ -27,8 +19,6 @@
# Mac Stuff. # Mac Stuff.
.DS_Store .DS_Store
# Python generated stuff in Windows.
/worker/scripts/configure.pyc
# worker scripts node-modules. # worker scripts node-modules.
/worker/scripts/node_modules/ /worker/scripts/node_modules/
...@@ -50,3 +40,9 @@ ...@@ -50,3 +40,9 @@
# Rust examples. # Rust examples.
/rust/examples-frontend/*/node_modules /rust/examples-frontend/*/node_modules
/rust/examples-frontend/*/package-lock.json /rust/examples-frontend/*/package-lock.json
# Meson.
/worker/subprojects/*
!/worker/subprojects/*.wrap
# Temporarily included meson.build files
!/worker/subprojects/packagefiles
...@@ -94,9 +94,19 @@ Builds the `libmediasoup-worker` static library at `worker/out/Release/`. ...@@ -94,9 +94,19 @@ Builds the `libmediasoup-worker` static library at `worker/out/Release/`.
Cleans built objects and binaries. Cleans built objects and binaries.
### `make clean-pip`
Cleans `meson` and `ninja` installed in local prefix with pip.
### `make clean-subprojects`
Cleans subprojects downloaded with Meson.
### `make clean-all` ### `make clean-all`
Cleans all objects and binaries, including those generated for library dependencies (such as libuv, openssl, libsrtp, etc). Cleans built objects and binaries, `meson` and `ninja` installed in local prefix with pip and all subprojects downloaded with Meson.
### `make xcode` ### `make xcode`
...@@ -119,25 +129,13 @@ Rewrites mediasoup-worker C++ files using [clang-format](https://clang.llvm.org/ ...@@ -119,25 +129,13 @@ Rewrites mediasoup-worker C++ files using [clang-format](https://clang.llvm.org/
Builds and runs the `mediasoup-worker-test` binary at `worker/out/Release/` (or at `worker/out/Debug/` if the "MEDIASOUP_BUILDTYPE" environment variable is set to "Debug"), which uses [Catch2](https://github.com/catchorg/Catch2) to run test units located at `worker/test/` folder. Builds and runs the `mediasoup-worker-test` binary at `worker/out/Release/` (or at `worker/out/Debug/` if the "MEDIASOUP_BUILDTYPE" environment variable is set to "Debug"), which uses [Catch2](https://github.com/catchorg/Catch2) to run test units located at `worker/test/` folder.
### `make bear`
Generates the `worker/compile_commands_template.json` file which is a ["Clang compilation database"](https://clang.llvm.org/docs/JSONCompilationDatabase.html).
**Requirements:**
* [Bear](https://github.com/rizsotto/Bear) is required.
- Install it in Debian/Ubuntu via `apt install bear` and in OSX via `brew install bear`.
- For now, Bear version must be 2.1.X.
* Before running `make bear` you must have mediasoup C/C++ dependencies already compiled. To be sure, run `make clean-all && make` before running `make bear`.
### `make tidy` ### `make tidy`
Runs [clang-tidy](http://clang.llvm.org/extra/clang-tidy/) and performs C++ code checks following `worker/.clang-tidy` rules. Runs [clang-tidy](http://clang.llvm.org/extra/clang-tidy/) and performs C++ code checks following `worker/.clang-tidy` rules.
**Requirements:** **Requirements:**
* `make clean-all`, then `make` and then `make bear` must have been called first. * `make clean` and `make` must have been called first.
* [PyYAML](https://pyyaml.org/) is required. * [PyYAML](https://pyyaml.org/) is required.
- In OSX install it with `brew install libyaml` and `sudo easy_install-X.Y pyyaml`. - In OSX install it with `brew install libyaml` and `sudo easy_install-X.Y pyyaml`.
......
...@@ -11,20 +11,6 @@ const task = process.argv.slice(2).join(' '); ...@@ -11,20 +11,6 @@ const task = process.argv.slice(2).join(' ');
// mediasoup mayor version. // mediasoup mayor version.
const MAYOR_VERSION = 3; const MAYOR_VERSION = 3;
// Just for Windows.
let PYTHON;
let MSBUILD;
let MEDIASOUP_BUILDTYPE;
let MEDIASOUP_TEST_TAGS;
if (isWindows)
{
PYTHON = process.env.PYTHON || 'python';
MSBUILD = process.env.MSBUILD || 'MSBuild';
MEDIASOUP_BUILDTYPE = process.env.MEDIASOUP_BUILDTYPE || 'Release';
MEDIASOUP_TEST_TAGS = process.env.MEDIASOUP_TEST_TAGS || '';
}
let MAKE; let MAKE;
if (isFreeBSD) if (isFreeBSD)
...@@ -79,6 +65,16 @@ switch (task) ...@@ -79,6 +65,16 @@ switch (task)
break; break;
} }
case 'worker:build':
{
if (!process.env.MEDIASOUP_WORKER_BIN)
{
execute(`${MAKE} -C worker`);
}
break;
}
case 'lint:node': case 'lint:node':
{ {
execute('cross-env MEDIASOUP_NODE_LANGUAGE=typescript eslint -c .eslintrc.js --max-warnings 0 --ext=ts src/'); execute('cross-env MEDIASOUP_NODE_LANGUAGE=typescript eslint -c .eslintrc.js --max-warnings 0 --ext=ts src/');
...@@ -119,17 +115,7 @@ switch (task) ...@@ -119,17 +115,7 @@ switch (task)
case 'test:worker': case 'test:worker':
{ {
if (!isWindows) execute(`${MAKE} test -C worker`);
{
execute(`${MAKE} test -C worker`);
}
else if (!process.env.MEDIASOUP_WORKER_BIN)
{
execute(`${PYTHON} ./worker/scripts/configure.py --format=msvs -R mediasoup-worker-test`);
execute(`${MSBUILD} ./worker/mediasoup-worker.sln /p:Configuration=${MEDIASOUP_BUILDTYPE}`);
execute(`cd worker && .\\out\\${MEDIASOUP_BUILDTYPE}\\mediasoup-worker-test.exe --invisibles --use-colour=yes ${MEDIASOUP_TEST_TAGS}`);
}
break; break;
} }
...@@ -144,18 +130,9 @@ switch (task) ...@@ -144,18 +130,9 @@ switch (task)
case 'postinstall': case 'postinstall':
{ {
if (!process.env.MEDIASOUP_WORKER_BIN) execute('node npm-scripts.js worker:build');
{ execute(`${MAKE} clean-pip -C worker`);
if (!isWindows) execute(`${MAKE} clean-subprojects -C worker`);
{
execute(`${MAKE} -C worker`);
}
else
{
execute(`${PYTHON} ./worker/scripts/configure.py --format=msvs -R mediasoup-worker`);
execute(`${MSBUILD} ./worker/mediasoup-worker.sln /p:Configuration=${MEDIASOUP_BUILDTYPE}`);
}
}
break; break;
} }
...@@ -206,7 +183,19 @@ function execute(command) ...@@ -206,7 +183,19 @@ function execute(command)
try try
{ {
execSync(command, { stdio: [ 'ignore', process.stdout, process.stderr ] }); // Set MSVC compiler as default on Windows
const env = isWindows ? {
CC : process.env.CC || 'cl',
CXX : process.env.CXX || 'cl',
...process.env
} : process.env;
execSync(
command,
{
env : env,
stdio : [ 'ignore', process.stdout, process.stderr ]
});
} }
catch (error) catch (error)
{ {
......
...@@ -18,6 +18,25 @@ ...@@ -18,6 +18,25 @@
}, },
"main": "lib/index.js", "main": "lib/index.js",
"types": "lib/index.d.ts", "types": "lib/index.d.ts",
"files": [
"lib",
"worker/deps/libwebrtc",
"worker/fuzzer/include",
"worker/fuzzer/src",
"worker/include",
"worker/scripts/*.py",
"worker/scripts/*.sh",
"worker/scripts/*.js",
"worker/scripts/*.json",
"worker/src",
"worker/subprojects/packagefiles",
"worker/subprojects/*.wrap",
"worker/test/include",
"worker/test/src",
"worker/Makefile",
"worker/meson.build",
"npm-scripts.js"
],
"keywords": [ "keywords": [
"webrtc", "webrtc",
"ortc", "ortc",
...@@ -31,14 +50,15 @@ ...@@ -31,14 +50,15 @@
"install-clang-tools": "node npm-scripts.js install-clang-tools", "install-clang-tools": "node npm-scripts.js install-clang-tools",
"typescript:build": "node npm-scripts.js typescript:build", "typescript:build": "node npm-scripts.js typescript:build",
"typescript:watch": "node npm-scripts.js typescript:watch", "typescript:watch": "node npm-scripts.js typescript:watch",
"worker:build": "node npm-scripts.js worker:build",
"lint": "npm run lint:node && npm run lint:worker", "lint": "npm run lint:node && npm run lint:worker",
"lint:node": "node npm-scripts.js lint:node", "lint:node": "node npm-scripts.js lint:node",
"lint:worker": "node npm-scripts.js lint:worker", "lint:worker": "node npm-scripts.js lint:worker",
"format:worker": "node npm-scripts.js format:worker", "format:worker": "node npm-scripts.js format:worker",
"test": "npm run test:node && npm run test:worker", "test": "npm run test:node && npm run test:worker",
"test:node": "npm run postinstall && node npm-scripts.js test:node", "test:node": "npm run worker:build && node npm-scripts.js test:node",
"test:worker": "node npm-scripts.js test:worker", "test:worker": "node npm-scripts.js test:worker",
"coverage": "npm run postinstall && node npm-scripts.js coverage", "coverage": "npm run worker:build && node npm-scripts.js coverage",
"postinstall": "node npm-scripts.js postinstall", "postinstall": "node npm-scripts.js postinstall",
"release": "node npm-scripts.js release" "release": "node npm-scripts.js release"
}, },
......
...@@ -8,30 +8,22 @@ license = "ISC" ...@@ -8,30 +8,22 @@ license = "ISC"
documentation = "https://docs.rs/mediasoup-sys" documentation = "https://docs.rs/mediasoup-sys"
repository = "https://github.com/versatica/mediasoup/tree/v3/worker" repository = "https://github.com/versatica/mediasoup/tree/v3/worker"
include = [ include = [
"/deps/getops",
"/deps/gyp",
"!/deps/gyp/{samples,test}",
"/deps/json",
"!/deps/json/{include,ChangeLog.md}",
"!/deps/json/ChangeLog.md",
"/deps/libsrtp",
"!/deps/libsrtp/srtp/{doc,fuzzer,test,CHANGES}",
"/deps/libuv",
"!/deps/libuv/libuv/{docs,img,m4,test,ChangeLog}",
"/deps/libwebrtc", "/deps/libwebrtc",
"/deps/openssl", "!/deps/libwebrtc/deps/abseil-cpp",
"!/deps/openssl/openssl/{apps,demos,docs,fuzz,test,tools,CHANGES}", "/fuzzer/include",
"/deps/usrsctp", "/fuzzer/src",
"!/deps/usrsctp/programs",
"/include", "/include",
"/scripts", "/scripts",
"!/scripts/node_modules", "!/scripts/node_modules",
"/src", "/src",
"/subprojects/packagefiles",
"/subprojects/*.wrap",
"/test/include",
"/test/src",
"/build.rs", "/build.rs",
"/Cargo.toml", "/Cargo.toml",
"/common.gypi",
"/Makefile", "/Makefile",
"/mediasoup-worker.gyp", "/meson.build",
] ]
[package.metadata.docs.rs] [package.metadata.docs.rs]
......
...@@ -7,7 +7,7 @@ RUN \ ...@@ -7,7 +7,7 @@ RUN \
&& apt-get install --yes \ && apt-get install --yes \
bash-completion wget curl subversion screen gcc g++ cmake ninja-build golang \ bash-completion wget curl subversion screen gcc g++ cmake ninja-build golang \
autoconf libtool apache2 python-dev pkg-config zlib1g-dev libgcrypt11-dev \ autoconf libtool apache2 python-dev pkg-config zlib1g-dev libgcrypt11-dev \
libgss-dev libssl-dev libxml2-dev nasm libarchive-dev make bear automake \ libgss-dev libssl-dev libxml2-dev nasm libarchive-dev make automake \
libdbus-1-dev libboost-dev autoconf-archive bash-completion python-yaml libdbus-1-dev libboost-dev autoconf-archive bash-completion python-yaml
# Install node 10. # Install node 10.
......
...@@ -2,58 +2,120 @@ ...@@ -2,58 +2,120 @@
# make tasks for mediasoup-worker. # make tasks for mediasoup-worker.
# #
# Best effort to prefer Python 2 executable since there are yet pending issues # We need Python 3 here.
# with gyp and Python3. PYTHON ?= $(shell command -v python3 2> /dev/null || echo python)
PYTHON ?= $(shell command -v python2 2> /dev/null || command -v python 2> /dev/null || echo python3)
ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
CORES ?= $(shell ${ROOT_DIR}/scripts/cpu_cores.sh || echo 4) CORES ?= $(shell ${ROOT_DIR}/scripts/cpu_cores.sh || echo 4)
MEDIASOUP_OUT_DIR ?= out MEDIASOUP_OUT_DIR ?= $(shell pwd)/out
MEDIASOUP_BUILDTYPE ?= Release MEDIASOUP_BUILDTYPE ?= Release
GULP = ./scripts/node_modules/.bin/gulp GULP = ./scripts/node_modules/.bin/gulp
LCOV = ./deps/lcov/bin/lcov LCOV = ./deps/lcov/bin/lcov
BEAR ?= bear
SED ?= sed
DOCKER ?= docker DOCKER ?= docker
PIP_DIR = $(MEDIASOUP_OUT_DIR)/pip
MESON ?= $(PIP_DIR)/bin/meson
MESON_ARGS ?= ""
# Disable `*.pyc` files creation.
export PYTHONDONTWRITEBYTECODE = 1
# Instruct `meson` where to look for ninja binary.
ifeq ($(OS),Windows_NT)
# Windows is, of course, special.
export NINJA = $(PIP_DIR)/bin/ninja.exe
else
export NINJA = $(PIP_DIR)/bin/ninja
endif
# Instruct Python where to look for modules it needs, such that `meson` actually runs from installed location.
export PYTHONPATH = $(PIP_DIR)
.PHONY: \ .PHONY: \
default clean clean-all xcode lint format test bear tidy \ default meson-ninja setup clean clean-pip clean-subprojects clean-all mediasoup-worker xcode lint format test tidy \
fuzzer fuzzer-run-all docker-build docker-run libmediasoup-worker fuzzer fuzzer-run-all docker-build docker-run libmediasoup-worker
default: default: mediasoup-worker
ifeq ($(MEDIASOUP_WORKER_BIN),)
$(PYTHON) ./scripts/configure.py -R mediasoup-worker meson-ninja:
$(MAKE) -j$(CORES) BUILDTYPE=$(MEDIASOUP_BUILDTYPE) -C $(MEDIASOUP_OUT_DIR) ifeq ($(wildcard $(PIP_DIR)),)
# Updated pip and setuptools are needed for meson
# `--system` is not present everywhere and is only needed as workaround for Debian-specific issue (copied from
# https://github.com/gluster/gstatus/pull/33), fallback to command without `--system` if the first one fails.
$(PYTHON) -m pip install --system --target=$(PIP_DIR) pip setuptools || \
$(PYTHON) -m pip install --target=$(PIP_DIR) pip setuptools || \
echo "Installation failed, likely because PIP is unavailable, if you are on Debian/Ubuntu or derivative please install the python3-pip package"
# Install `meson` and `ninja` using `pip` into custom location, so we don't depend on system-wide installation.
$(PYTHON) -m pip install --upgrade --target=$(PIP_DIR) meson ninja
endif
setup: meson-ninja
# We try to call `--reconfigure` first as a workaround for https://github.com/ninja-build/ninja/issues/1997
ifeq ($(MEDIASOUP_BUILDTYPE),Release)
$(MESON) setup \
--buildtype release \
-Db_ndebug=true \
-Db_pie=true \
-Db_staticpic=true \
--reconfigure \
$(MESON_ARGS) \
$(MEDIASOUP_OUT_DIR)/$(MEDIASOUP_BUILDTYPE) || \
$(MESON) setup \
--buildtype release \
-Db_ndebug=true \
-Db_pie=true \
-Db_staticpic=true \
$(MESON_ARGS) \
$(MEDIASOUP_OUT_DIR)/$(MEDIASOUP_BUILDTYPE)
else
ifeq ($(MEDIASOUP_BUILDTYPE),Debug)
$(MESON) setup \
--buildtype debug \
-Db_pie=true \
-Db_staticpic=true \
--reconfigure \
$(MESON_ARGS) \
$(MEDIASOUP_OUT_DIR)/$(MEDIASOUP_BUILDTYPE) || \
$(MESON) setup \
--buildtype debug \
-Db_pie=true \
-Db_staticpic=true \
$(MESON_ARGS) \
$(MEDIASOUP_OUT_DIR)/$(MEDIASOUP_BUILDTYPE)
else
$(MESON) setup \
--buildtype $(MEDIASOUP_BUILDTYPE) \
-Db_ndebug=if-release \
-Db_pie=true \
-Db_staticpic=true \
--reconfigure \
$(MESON_ARGS) \
$(MEDIASOUP_OUT_DIR)/$(MEDIASOUP_BUILDTYPE) || \
$(MESON) setup \
--buildtype $(MEDIASOUP_BUILDTYPE) \
-Db_ndebug=if-release \
-Db_pie=true \
-Db_staticpic=true \
$(MESON_ARGS) \
$(MEDIASOUP_OUT_DIR)/$(MEDIASOUP_BUILDTYPE)
endif
endif endif
clean: clean:
$(RM) -rf $(MEDIASOUP_OUT_DIR)/Release/mediasoup-worker $(RM) -rf $(MEDIASOUP_OUT_DIR)/$(MEDIASOUP_BUILDTYPE)
$(RM) -rf $(MEDIASOUP_OUT_DIR)/Release/obj.target/mediasoup-worker
$(RM) -rf $(MEDIASOUP_OUT_DIR)/Release/mediasoup-worker-test clean-pip:
$(RM) -rf $(MEDIASOUP_OUT_DIR)/Release/obj.target/mediasoup-worker-test $(RM) -rf $(PIP_DIR)
$(RM) -rf $(MEDIASOUP_OUT_DIR)/Release/mediasoup-worker-fuzzer
$(RM) -rf $(MEDIASOUP_OUT_DIR)/Release/obj.target/mediasoup-worker-fuzzer clean-subprojects: meson-ninja
$(RM) -rf $(MEDIASOUP_OUT_DIR)/Release/libmediasoup-worker.a $(MESON) subprojects purge --include-cache --confirm
$(RM) -rf $(MEDIASOUP_OUT_DIR)/Release/obj.target/libmediasoup-worker.a
$(RM) -rf $(MEDIASOUP_OUT_DIR)/Debug/mediasoup-worker clean-all: clean-subprojects
$(RM) -rf $(MEDIASOUP_OUT_DIR)/Debug/obj.target/mediasoup-worker
$(RM) -rf $(MEDIASOUP_OUT_DIR)/Debug/mediasoup-worker-test
$(RM) -rf $(MEDIASOUP_OUT_DIR)/Debug/obj.target/mediasoup-worker-test
$(RM) -rf $(MEDIASOUP_OUT_DIR)/Debug/mediasoup-worker-fuzzer
$(RM) -rf $(MEDIASOUP_OUT_DIR)/Debug/obj.target/mediasoup-worker-fuzzer
$(RM) -rf $(MEDIASOUP_OUT_DIR)/Debug/libmediasoup-worker.a
$(RM) -rf $(MEDIASOUP_OUT_DIR)/Debug/obj.target/libmediasoup-worker.a
clean-all:
$(RM) -rf $(MEDIASOUP_OUT_DIR) $(RM) -rf $(MEDIASOUP_OUT_DIR)
$(RM) -rf $(ROOT_DIR)/mediasoup-worker.xcodeproj
$(RM) -rf $(ROOT_DIR)/mediasoup-worker-test.xcodeproj
$(RM) -rf $(ROOT_DIR)/deps/gyp/pylib/gyp/__pycache__
$(RM) -rf $(ROOT_DIR)/deps/gyp/pylib/gyp/generator/__pycache__
$(RM) -rf $(ROOT_DIR)/deps/*/*.xcodeproj
$(RM) -rf $(ROOT_DIR)/libwebrtc/*/*.xcodeproj
xcode: mediasoup-worker: setup
$(PYTHON) ./scripts/configure.py --format=xcode ifeq ($(MEDIASOUP_WORKER_BIN),)
$(MESON) compile -j $(CORES) -C $(MEDIASOUP_OUT_DIR)/$(MEDIASOUP_BUILDTYPE) mediasoup-worker
endif
xcode: setup
$(MESON) setup --buildtype debug --backend xcode $(MEDIASOUP_OUT_DIR)/xcode
lint: lint:
$(GULP) --gulpfile ./scripts/gulpfile.js lint:worker $(GULP) --gulpfile ./scripts/gulpfile.js lint:worker
...@@ -61,38 +123,35 @@ lint: ...@@ -61,38 +123,35 @@ lint:
format: format:
$(GULP) --gulpfile ./scripts/gulpfile.js format:worker $(GULP) --gulpfile ./scripts/gulpfile.js format:worker
test: test: setup
ifeq ($(MEDIASOUP_WORKER_BIN),) ifeq ($(MEDIASOUP_WORKER_BIN),)
$(PYTHON) ./scripts/configure.py -R mediasoup-worker-test $(MESON) compile -j $(CORES) -C $(MEDIASOUP_OUT_DIR)/$(MEDIASOUP_BUILDTYPE) mediasoup-worker-test
$(MAKE) -j$(CORES) BUILDTYPE=$(MEDIASOUP_BUILDTYPE) -C $(MEDIASOUP_OUT_DIR) # On Windows lcov doesn't work (at least not yet) and we need to add `.exe` to the binary path.
ifeq ($(OS),Windows_NT)
$(MEDIASOUP_OUT_DIR)/$(MEDIASOUP_BUILDTYPE)/mediasoup-worker-test.exe --invisibles --use-colour=yes $(MEDIASOUP_TEST_TAGS)
else
$(LCOV) --directory ./ --zerocounters $(LCOV) --directory ./ --zerocounters
./$(MEDIASOUP_OUT_DIR)/$(MEDIASOUP_BUILDTYPE)/mediasoup-worker-test --invisibles --use-colour=yes $(MEDIASOUP_TEST_TAGS) $(MEDIASOUP_OUT_DIR)/$(MEDIASOUP_BUILDTYPE)/mediasoup-worker-test --invisibles --use-colour=yes $(MEDIASOUP_TEST_TAGS)
endif
endif endif
bear:
$(MAKE) clean
$(BEAR) -o compile_commands_template.json $(MAKE)
$(SED) -i" " "s|$(PWD)|PATH|g" compile_commands_template.json
tidy: tidy:
$(SED) "s|PATH|$(PWD)|g" compile_commands_template.json > compile_commands.json
$(PYTHON) ./scripts/clang-tidy.py \ $(PYTHON) ./scripts/clang-tidy.py \
-clang-tidy-binary=./scripts/node_modules/.bin/clang-tidy \ -clang-tidy-binary=./scripts/node_modules/.bin/clang-tidy \
-clang-apply-replacements-binary=./scripts/node_modules/.bin/clang-apply-replacements \ -clang-apply-replacements-binary=./scripts/node_modules/.bin/clang-apply-replacements \
-header-filter='(Channel/**/*.hpp|DepLibSRTP.hpp|DepLibUV.hpp|DepLibWebRTC.hpp|DepOpenSSL.hpp|DepUsrSCTP.hpp|LogLevel.hpp|Logger.hpp|MediaSoupError.hpp|RTC/**/*.hpp|Settings.hpp|Utils.hpp|Worker.hpp|common.hpp|handles/**/*.hpp)' \ -header-filter='(Channel/**/*.hpp|DepLibSRTP.hpp|DepLibUV.hpp|DepLibWebRTC.hpp|DepOpenSSL.hpp|DepUsrSCTP.hpp|LogLevel.hpp|Logger.hpp|MediaSoupError.hpp|RTC/**/*.hpp|Settings.hpp|Utils.hpp|Worker.hpp|common.hpp|handles/**/*.hpp)' \
-p=. \ -p=$(MEDIASOUP_OUT_DIR)/$(MEDIASOUP_BUILDTYPE) \
-j=$(CORES) \ -j=$(CORES) \
-checks=$(MEDIASOUP_TIDY_CHECKS) \ -checks=$(MEDIASOUP_TIDY_CHECKS) \
-quiet -quiet
fuzzer: fuzzer: setup
ifeq ($(MEDIASOUP_WORKER_BIN),) ifeq ($(MEDIASOUP_WORKER_BIN),)
$(PYTHON) ./scripts/configure.py -R mediasoup-worker-fuzzer $(MESON) compile -j $(CORES) -C $(MEDIASOUP_OUT_DIR)/$(MEDIASOUP_BUILDTYPE) mediasoup-worker-fuzzer
$(MAKE) -j$(CORES) BUILDTYPE=$(MEDIASOUP_BUILDTYPE) -C $(MEDIASOUP_OUT_DIR)
endif endif
fuzzer-run-all: fuzzer-run-all:
LSAN_OPTIONS=verbosity=1:log_threads=1 ./$(MEDIASOUP_OUT_DIR)/Release/mediasoup-worker-fuzzer -artifact_prefix=fuzzer/reports/ -max_len=1400 fuzzer/new-corpus deps/webrtc-fuzzer-corpora/corpora/stun-corpus deps/webrtc-fuzzer-corpora/corpora/rtp-corpus deps/webrtc-fuzzer-corpora/corpora/rtcp-corpus LSAN_OPTIONS=verbosity=1:log_threads=1 ./$(MEDIASOUP_OUT_DIR)/$(MEDIASOUP_BUILDTYPE)/mediasoup-worker-fuzzer -artifact_prefix=fuzzer/reports/ -max_len=1400 fuzzer/new-corpus deps/webrtc-fuzzer-corpora/corpora/stun-corpus deps/webrtc-fuzzer-corpora/corpora/rtp-corpus deps/webrtc-fuzzer-corpora/corpora/rtcp-corpus
docker-build: docker-build:
ifeq ($(DOCKER_NO_CACHE),true) ifeq ($(DOCKER_NO_CACHE),true)
...@@ -109,6 +168,5 @@ docker-run: ...@@ -109,6 +168,5 @@ docker-run:
-v $(shell pwd)/../:/mediasoup \ -v $(shell pwd)/../:/mediasoup \
mediasoup/docker:latest mediasoup/docker:latest
libmediasoup-worker: libmediasoup-worker: setup
$(PYTHON) ./scripts/configure.py -R libmediasoup-worker $(MESON) compile -j $(CORES) -C $(MEDIASOUP_OUT_DIR)/$(MEDIASOUP_BUILDTYPE) libmediasoup-worker
$(MAKE) -j$(CORES) BUILDTYPE=$(MEDIASOUP_BUILDTYPE) -C $(MEDIASOUP_OUT_DIR)
...@@ -7,11 +7,6 @@ fn main() { ...@@ -7,11 +7,6 @@ fn main() {
return; return;
} }
let current_dir = std::env::current_dir()
.unwrap()
.into_os_string()
.into_string()
.unwrap();
let out_dir = env::var("OUT_DIR").unwrap(); let out_dir = env::var("OUT_DIR").unwrap();
// Add C++ std lib // Add C++ std lib
...@@ -85,6 +80,8 @@ fn main() { ...@@ -85,6 +80,8 @@ fn main() {
if !Command::new("make") if !Command::new("make")
.arg("libmediasoup-worker") .arg("libmediasoup-worker")
.env("PYTHONDONTWRITEBYTECODE", "1") .env("PYTHONDONTWRITEBYTECODE", "1")
.env("MEDIASOUP_OUT_DIR", &out_dir)
.env("MEDIASOUP_BUILDTYPE", "Release")
.spawn() .spawn()
.expect("Failed to start") .expect("Failed to start")
.wait() .wait()
...@@ -94,33 +91,11 @@ fn main() { ...@@ -94,33 +91,11 @@ fn main() {
panic!("Failed to build libmediasoup-worker") panic!("Failed to build libmediasoup-worker")
} }
for file in &[
"libuv.a",
"libopenssl.a",
"libsrtp.a",
"libusrsctp.a",
"libwebrtc.a",
"libmediasoup-worker.a",
"libabseil.a",
#[cfg(windows)]
"libgetopt.a",
] {
std::fs::copy(
format!("{}/out/Release/{}", current_dir, file),
format!("{}/{}", out_dir, file),
)
.unwrap_or_else(|_| {
panic!(
"Failed to copy static library from {}/out/Release/{} to {}/{}",
current_dir, file, out_dir, file
)
});
}
if env::var("KEEP_BUILD_ARTIFACTS") != Ok("1".to_string()) { if env::var("KEEP_BUILD_ARTIFACTS") != Ok("1".to_string()) {
// Clean // Clean
if !Command::new("make") if !Command::new("make")
.arg("clean-all") .arg("clean-all")
.env("PYTHONDONTWRITEBYTECODE", "1")
.spawn() .spawn()
.expect("Failed to start") .expect("Failed to start")
.wait() .wait()
...@@ -132,14 +107,7 @@ fn main() { ...@@ -132,14 +107,7 @@ fn main() {
} }
} }
println!("cargo:rustc-link-lib=static=uv");
println!("cargo:rustc-link-lib=static=openssl");
println!("cargo:rustc-link-lib=static=srtp");
println!("cargo:rustc-link-lib=static=usrsctp");
println!("cargo:rustc-link-lib=static=webrtc");
println!("cargo:rustc-link-lib=static=mediasoup-worker"); println!("cargo:rustc-link-lib=static=mediasoup-worker");
println!("cargo:rustc-link-lib=static=abseil");
#[cfg(windows)]
println!("cargo:rustc-link-lib=static=getopt");
println!("cargo:rustc-link-search=native={}", out_dir); println!("cargo:rustc-link-search=native={}", out_dir);
println!("cargo:rustc-link-search=native={}/Release", out_dir);
} }
{
'variables':
{
# libuv variables.
'uv_library%': 'static_library',
# openssl variables.
'library%': 'static_library',
'openssl_fips%': '',
'openssl_no_asm%': 0,
'libopenssl': '<(PRODUCT_DIR)/libopenssl.a',
# usrsctp variables.
'sctp_debug%': 'false',
# Others.
'clang%': 0,
'mediasoup_asan%': 'false'
},
'target_defaults':
{
'default_configuration': 'Release',
'configurations':
{
'Release':
{
'cflags': [ '-O3', '-Wno-unknown-warning-option', '-fPIC' ]
},
'Debug':
{
'defines': [ 'DEBUG', 'MS_LOG_TRACE', 'MS_LOG_FILE_LINE' ],
'cflags': [ '-g', '-O0', '-Wno-parentheses-equality', '-Wno-unknown-warning-option', '-fPIC' ],
'xcode_settings':
{
'GCC_OPTIMIZATION_LEVEL': '0'
}
}
},
'xcode_settings':
{
'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0',
'GCC_WARN_ABOUT_MISSING_NEWLINE': 'YES', # -Wnewline-eof
'PREBINDING': 'NO', # No -Wl,-prebind
'OTHER_CFLAGS':
[
'-fstrict-aliasing',
'-g',
'-fPIC'
],
'WARNING_CFLAGS':
[
'-Wall',
'-Wendif-labels',
'-W',
'-Wno-unused-parameter',
'-Wundeclared-selector',
'-Wno-parentheses-equality'
]
},
'conditions':
[
[ 'target_arch == "ia32"', {
'xcode_settings': { 'ARCHS': [ 'i386' ] }
}],
[ 'target_arch == "x64"', {
'xcode_settings': { 'ARCHS': [ 'x86_64' ] }
}],
[ 'target_arch == "arm64"', {
'xcode_settings': { 'ARCHS': [ 'arm64' ] }
}],
[ 'OS in "linux freebsd openbsd solaris"', {
'target_conditions':
[
[ '_type == "static_library"', {
# Disable thin archive which needs binutils >= 2.19.
'standalone_static_library': 1
}]
],
'conditions':
[
[ 'target_arch == "ia32"', {
'cflags': [ '-m32' ],
'ldflags': [ '-m32' ]
}],
[ 'target_arch == "x64"', {
'cflags': [ '-m64' ],
'ldflags': [ '-m64' ]
}]
]
}]
]
}
}
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -8,3 +8,5 @@ This folder contains a modified/adapted subset of the libwebrtc library, which i ...@@ -8,3 +8,5 @@ This folder contains a modified/adapted subset of the libwebrtc library, which i
The file `libwebrtc/mediasoup_helpers.h` includes some utilities to plug mediasoup classes into libwebrtc. The file `libwebrtc/mediasoup_helpers.h` includes some utilities to plug mediasoup classes into libwebrtc.
The file `worker/deps/libwebrtc/deps/abseil-cpp/abseil-cpp/absl/synchronization/internal/graphcycles.cc` has `#include <limits>` added to it to fix CI builds with Clang. The file `worker/deps/libwebrtc/deps/abseil-cpp/abseil-cpp/absl/synchronization/internal/graphcycles.cc` has `#include <limits>` added to it to fix CI builds with Clang.
The file `meson.build` is written for using with Meson build system.
libwebrtc_sources = [
'libwebrtc/system_wrappers/source/field_trial.cc',
'libwebrtc/rtc_base/rate_statistics.cc',
'libwebrtc/rtc_base/experiments/field_trial_parser.cc',
'libwebrtc/rtc_base/experiments/alr_experiment.cc',
'libwebrtc/rtc_base/experiments/field_trial_units.cc',
'libwebrtc/rtc_base/experiments/rate_control_settings.cc',
'libwebrtc/rtc_base/network/sent_packet.cc',
'libwebrtc/call/rtp_transport_controller_send.cc',
'libwebrtc/api/transport/bitrate_settings.cc',
'libwebrtc/api/transport/field_trial_based_config.cc',
'libwebrtc/api/transport/network_types.cc',
'libwebrtc/api/transport/goog_cc_factory.cc',
'libwebrtc/api/units/timestamp.cc',
'libwebrtc/api/units/time_delta.cc',
'libwebrtc/api/units/data_rate.cc',
'libwebrtc/api/units/data_size.cc',
'libwebrtc/api/units/frequency.cc',
'libwebrtc/api/network_state_predictor.cc',
'libwebrtc/modules/pacing/interval_budget.cc',
'libwebrtc/modules/pacing/bitrate_prober.cc',
'libwebrtc/modules/pacing/paced_sender.cc',
'libwebrtc/modules/remote_bitrate_estimator/overuse_detector.cc',
'libwebrtc/modules/remote_bitrate_estimator/overuse_estimator.cc',
'libwebrtc/modules/remote_bitrate_estimator/aimd_rate_control.cc',
'libwebrtc/modules/remote_bitrate_estimator/inter_arrival.cc',
'libwebrtc/modules/remote_bitrate_estimator/bwe_defines.cc',
'libwebrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.cc',
'libwebrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.cc',
'libwebrtc/modules/bitrate_controller/send_side_bandwidth_estimation.cc',
'libwebrtc/modules/bitrate_controller/loss_based_bandwidth_estimation.cc',
'libwebrtc/modules/congestion_controller/goog_cc/goog_cc_network_control.cc',
'libwebrtc/modules/congestion_controller/goog_cc/probe_bitrate_estimator.cc',
'libwebrtc/modules/congestion_controller/goog_cc/congestion_window_pushback_controller.cc',
'libwebrtc/modules/congestion_controller/goog_cc/link_capacity_estimator.cc',
'libwebrtc/modules/congestion_controller/goog_cc/alr_detector.cc',
'libwebrtc/modules/congestion_controller/goog_cc/probe_controller.cc',
'libwebrtc/modules/congestion_controller/goog_cc/median_slope_estimator.cc',
'libwebrtc/modules/congestion_controller/goog_cc/bitrate_estimator.cc',
'libwebrtc/modules/congestion_controller/goog_cc/trendline_estimator.cc',
'libwebrtc/modules/congestion_controller/goog_cc/delay_based_bwe.cc',
'libwebrtc/modules/congestion_controller/goog_cc/acknowledged_bitrate_estimator.cc',
'libwebrtc/modules/congestion_controller/rtp/send_time_history.cc',
'libwebrtc/modules/congestion_controller/rtp/transport_feedback_adapter.cc',
'libwebrtc/modules/congestion_controller/rtp/control_handler.cc',
]
abseil_cpp_proj = subproject(
'abseil-cpp',
default_options: [
'warning_level=0',
],
)
local_include_directories = declare_dependency(
include_directories: include_directories('libwebrtc')
)
libwebrtc = library(
'libwebrtc',
libwebrtc_sources,
dependencies: [
local_include_directories,
openssl_proj.get_variable('openssl_dep'),
abseil_cpp_proj.get_variable('absl_strings_dep'),
abseil_cpp_proj.get_variable('absl_types_dep'),
nlohmann_json_proj.get_variable('nlohmann_json_dep'),
libuv_proj.get_variable('libuv_dep'),
],
include_directories: libwebrtc_include_directories,
cpp_args: cpp_args,
)
libwebrtc_dep = declare_dependency(
dependencies: [
local_include_directories,
abseil_cpp_proj.get_variable('absl_strings_dep'),
abseil_cpp_proj.get_variable('absl_types_dep'),
],
include_directories: include_directories('.'),
link_with: libwebrtc,
)
{
'make_global_settings':
[
['CC.target', '<(openssl_fips)/bin/fipsld'],
['LINK', '<(openssl_fips)/bin/fipsld']
]
}
...@@ -9,9 +9,6 @@ ...@@ -9,9 +9,6 @@
#include <memory> // std::addressof() #include <memory> // std::addressof()
#ifdef _WIN32 #ifdef _WIN32
#include <winsock2.h> #include <winsock2.h>
// https://stackoverflow.com/a/27443191/2085408
#undef max
#undef min
// avoid uv/win.h: error C2628 'intptr_t' followed by 'int' is illegal. // avoid uv/win.h: error C2628 'intptr_t' followed by 'int' is illegal.
#if !defined(_SSIZE_T_) && !defined(_SSIZE_T_DEFINED) #if !defined(_SSIZE_T_) && !defined(_SSIZE_T_DEFINED)
#include <BaseTsd.h> #include <BaseTsd.h>
......
{
'target_defaults': {
'type': 'executable',
'dependencies':
[
'deps/libuv/uv.gyp:libuv',
'deps/openssl/openssl.gyp:openssl',
'deps/libsrtp/libsrtp.gyp:libsrtp',
'deps/usrsctp/usrsctp.gyp:usrsctp',
'deps/libwebrtc/libwebrtc.gyp:libwebrtc',
'deps/libwebrtc/deps/abseil-cpp/abseil-cpp.gyp:abseil'
],
# TODO: SCTP_DEBUG must be dynamic based on a condition variable in common.gyp.
# 'defines': [ 'SCTP_DEBUG' ],
'sources':
[
# C++ source files.
'src/lib.cpp',
'src/DepLibSRTP.cpp',
'src/DepLibUV.cpp',
'src/DepLibWebRTC.cpp',
'src/DepOpenSSL.cpp',
'src/DepUsrSCTP.cpp',
'src/Logger.cpp',
'src/MediaSoupErrors.cpp',
'src/Settings.cpp',
'src/Worker.cpp',
'src/Utils/Crypto.cpp',
'src/Utils/File.cpp',
'src/Utils/IP.cpp',
'src/Utils/String.cpp',
'src/handles/SignalsHandler.cpp',
'src/handles/TcpConnectionHandler.cpp',
'src/handles/TcpServerHandler.cpp',
'src/handles/Timer.cpp',
'src/handles/UdpSocketHandler.cpp',
'src/handles/UnixStreamSocket.cpp',
'src/Channel/ChannelNotifier.cpp',
'src/Channel/ChannelRequest.cpp',
'src/Channel/ChannelSocket.cpp',
'src/PayloadChannel/Notification.cpp',
'src/PayloadChannel/PayloadChannelNotifier.cpp',
'src/PayloadChannel/PayloadChannelRequest.cpp',
'src/PayloadChannel/PayloadChannelSocket.cpp',
'src/RTC/ActiveSpeakerObserver.cpp',
'src/RTC/AudioLevelObserver.cpp',
'src/RTC/Consumer.cpp',
'src/RTC/DataConsumer.cpp',
'src/RTC/DataProducer.cpp',
'src/RTC/DirectTransport.cpp',
'src/RTC/DtlsTransport.cpp',
'src/RTC/IceCandidate.cpp',
'src/RTC/IceServer.cpp',
'src/RTC/KeyFrameRequestManager.cpp',
'src/RTC/NackGenerator.cpp',
'src/RTC/PipeConsumer.cpp',
'src/RTC/PipeTransport.cpp',
'src/RTC/PlainTransport.cpp',
'src/RTC/PortManager.cpp',
'src/RTC/Producer.cpp',
'src/RTC/RateCalculator.cpp',
'src/RTC/Router.cpp',
'src/RTC/RtpListener.cpp',
'src/RTC/RtpObserver.cpp',
'src/RTC/RtpPacket.cpp',
'src/RTC/RtpProbationGenerator.cpp',
'src/RTC/RtpStream.cpp',
'src/RTC/RtpStreamRecv.cpp',
'src/RTC/RtpStreamSend.cpp',
'src/RTC/RtxStream.cpp',
'src/RTC/SctpAssociation.cpp',
'src/RTC/SctpListener.cpp',
'src/RTC/SenderBandwidthEstimator.cpp',
'src/RTC/SeqManager.cpp',
'src/RTC/SimpleConsumer.cpp',
'src/RTC/SimulcastConsumer.cpp',
'src/RTC/SrtpSession.cpp',
'src/RTC/StunPacket.cpp',
'src/RTC/SvcConsumer.cpp',
'src/RTC/TcpConnection.cpp',
'src/RTC/TcpServer.cpp',
'src/RTC/Transport.cpp',
'src/RTC/TransportCongestionControlClient.cpp',
'src/RTC/TransportCongestionControlServer.cpp',
'src/RTC/TransportTuple.cpp',
'src/RTC/TrendCalculator.cpp',
'src/RTC/UdpSocket.cpp',
'src/RTC/WebRtcTransport.cpp',
'src/RTC/Codecs/H264.cpp',
'src/RTC/Codecs/VP8.cpp',
'src/RTC/Codecs/VP9.cpp',
'src/RTC/RtpDictionaries/Media.cpp',
'src/RTC/RtpDictionaries/Parameters.cpp',
'src/RTC/RtpDictionaries/RtcpFeedback.cpp',
'src/RTC/RtpDictionaries/RtcpParameters.cpp',
'src/RTC/RtpDictionaries/RtpCodecMimeType.cpp',
'src/RTC/RtpDictionaries/RtpCodecParameters.cpp',
'src/RTC/RtpDictionaries/RtpEncodingParameters.cpp',
'src/RTC/RtpDictionaries/RtpHeaderExtensionParameters.cpp',
'src/RTC/RtpDictionaries/RtpHeaderExtensionUri.cpp',
'src/RTC/RtpDictionaries/RtpParameters.cpp',
'src/RTC/RtpDictionaries/RtpRtxParameters.cpp',
'src/RTC/SctpDictionaries/SctpStreamParameters.cpp',
'src/RTC/RTCP/Packet.cpp',
'src/RTC/RTCP/CompoundPacket.cpp',
'src/RTC/RTCP/SenderReport.cpp',
'src/RTC/RTCP/ReceiverReport.cpp',
'src/RTC/RTCP/Sdes.cpp',
'src/RTC/RTCP/Bye.cpp',
'src/RTC/RTCP/Feedback.cpp',
'src/RTC/RTCP/FeedbackPs.cpp',
'src/RTC/RTCP/FeedbackRtp.cpp',
'src/RTC/RTCP/FeedbackRtpNack.cpp',
'src/RTC/RTCP/FeedbackRtpTmmb.cpp',
'src/RTC/RTCP/FeedbackRtpSrReq.cpp',
'src/RTC/RTCP/FeedbackRtpTllei.cpp',
'src/RTC/RTCP/FeedbackRtpEcn.cpp',
'src/RTC/RTCP/FeedbackRtpTransport.cpp',
'src/RTC/RTCP/FeedbackPsPli.cpp',
'src/RTC/RTCP/FeedbackPsSli.cpp',
'src/RTC/RTCP/FeedbackPsRpsi.cpp',
'src/RTC/RTCP/FeedbackPsFir.cpp',
'src/RTC/RTCP/FeedbackPsTst.cpp',
'src/RTC/RTCP/FeedbackPsVbcm.cpp',
'src/RTC/RTCP/FeedbackPsLei.cpp',
'src/RTC/RTCP/FeedbackPsAfb.cpp',
'src/RTC/RTCP/FeedbackPsRemb.cpp',
'src/RTC/RTCP/XR.cpp',
'src/RTC/RTCP/XrDelaySinceLastRr.cpp',
'src/RTC/RTCP/XrReceiverReferenceTime.cpp',
# C++ include files.
'include/lib.hpp',
'include/DepLibSRTP.hpp',
'include/DepLibUV.hpp',
'include/DepLibWebRTC.hpp',
'include/DepOpenSSL.hpp',
'include/DepUsrSCTP.hpp',
'include/LogLevel.hpp',
'include/Logger.hpp',
'include/MediaSoupErrors.hpp',
'include/Settings.hpp',
'include/Utils.hpp',
'include/Worker.hpp',
'include/common.hpp',
'include/handles/SignalsHandler.hpp',
'include/handles/TcpConnectionHandler.hpp',
'include/handles/TcpServerHandler.hpp',
'include/handles/Timer.hpp',
'include/handles/UdpSocketHandler.hpp',
'include/handles/UnixStreamSocket.hpp',
'include/Channel/ChannelNotifier.hpp',
'include/Channel/ChannelRequest.hpp',
'include/Channel/ChannelSocket.hpp',
'include/PayloadChannel/Notification.hpp',
'include/PayloadChannel/PayloadChannelNotifier.hpp',
'include/PayloadChannel/PayloadChannelRequest.hpp',
'include/PayloadChannel/PayloadChannelSocket.hpp',
'include/RTC/BweType.hpp',
'include/RTC/ActiveSpeakerObserver.hpp',
'include/RTC/AudioLevelObserver.hpp',
'include/RTC/Consumer.hpp',
'include/RTC/DataConsumer.hpp',
'include/RTC/DirectTransport.hpp',
'include/RTC/DataProducer.hpp',
'include/RTC/DtlsTransport.hpp',
'include/RTC/IceCandidate.hpp',
'include/RTC/IceServer.hpp',
'include/RTC/KeyFrameRequestManager.hpp',
'include/RTC/NackGenerator.hpp',
'include/RTC/Parameters.hpp',
'include/RTC/PipeConsumer.hpp',
'include/RTC/PipeTransport.hpp',
'include/RTC/PlainTransport.hpp',
'include/RTC/PortManager.hpp',
'include/RTC/Producer.hpp',
'include/RTC/RateCalculator.hpp',
'include/RTC/Router.hpp',
'include/RTC/RtpDictionaries.hpp',
'include/RTC/RtpHeaderExtensionIds.hpp',
'include/RTC/RtpListener.hpp',
'include/RTC/RtpObserver.hpp',
'include/RTC/RtpPacket.hpp',
'include/RTC/RtpProbationGenerator.hpp',
'include/RTC/RtpStream.hpp',
'include/RTC/RtpStreamRecv.hpp',
'include/RTC/RtpStreamSend.hpp',
'include/RTC/RtxStream.hpp',
'include/RTC/SctpAssociation.hpp',
'include/RTC/SctpDictionaries.hpp',
'include/RTC/SctpListener.hpp',
'include/RTC/SenderBandwidthEstimator.hpp',
'include/RTC/SeqManager.hpp',
'include/RTC/SimpleConsumer.hpp',
'include/RTC/SimulcastConsumer.hpp',
'include/RTC/SrtpSession.hpp',
'include/RTC/StunPacket.hpp',
'include/RTC/SvcConsumer.hpp',
'include/RTC/TcpConnection.hpp',
'include/RTC/TcpServer.hpp',
'include/RTC/Transport.hpp',
'include/RTC/TransportCongestionControlClient.hpp',
'include/RTC/TransportCongestionControlServer.hpp',
'include/RTC/TransportTuple.hpp',
'include/RTC/TrendCalculator.hpp',
'include/RTC/UdpSocket.hpp',
'include/RTC/WebRtcTransport.hpp',
'include/RTC/Codecs/Tools.hpp',
'include/RTC/Codecs/PayloadDescriptorHandler.hpp',
'include/RTC/Codecs/H264.hpp',
'include/RTC/Codecs/VP8.hpp',
'include/RTC/Codecs/VP9.hpp',
'include/RTC/RTCP/Packet.hpp',
'include/RTC/RTCP/CompoundPacket.hpp',
'include/RTC/RTCP/SenderReport.hpp',
'include/RTC/RTCP/ReceiverReport.hpp',
'include/RTC/RTCP/Sdes.hpp',
'include/RTC/RTCP/Bye.hpp',
'include/RTC/RTCP/Feedback.hpp',
'include/RTC/RTCP/FeedbackItem.hpp',
'include/RTC/RTCP/FeedbackPs.hpp',
'include/RTC/RTCP/FeedbackRtp.hpp',
'include/RTC/RTCP/FeedbackRtpNack.hpp',
'include/RTC/RTCP/FeedbackRtpTmmb.hpp',
'include/RTC/RTCP/FeedbackRtpSrReq.hpp',
'include/RTC/RTCP/FeedbackRtpTllei.hpp',
'include/RTC/RTCP/FeedbackRtpEcn.hpp',
'include/RTC/RTCP/FeedbackRtpTransport.hpp',
'include/RTC/RTCP/FeedbackPsPli.hpp',
'include/RTC/RTCP/FeedbackPsSli.hpp',
'include/RTC/RTCP/FeedbackPsRpsi.hpp',
'include/RTC/RTCP/FeedbackPsFir.hpp',
'include/RTC/RTCP/FeedbackPsTst.hpp',
'include/RTC/RTCP/FeedbackPsVbcm.hpp',
'include/RTC/RTCP/FeedbackPsLei.hpp',
'include/RTC/RTCP/FeedbackPsAfb.hpp',
'include/RTC/RTCP/FeedbackPsRemb.hpp',
'include/RTC/RTCP/XR.hpp',
'include/RTC/RTCP/XrDelaySinceLastRr.hpp',
'include/RTC/RTCP/XrReceiverReferenceTime.hpp'
],
'include_dirs':
[
'include',
'deps/json/single_include'
],
'conditions':
[
# FIPS.
[ 'openssl_fips != ""', {
'defines': [ 'BUD_FIPS_ENABLED=1' ]
}],
# Endianness.
[ 'node_byteorder == "big"', {
# Define Big Endian.
'defines': [ 'MS_BIG_ENDIAN' ]
}, {
# Define Little Endian.
'defines': [ 'MS_LITTLE_ENDIAN' ]
}],
# Platform-specifics.
[ 'OS == "mac" and mediasoup_asan == "true"', {
'xcode_settings':
{
'OTHER_CFLAGS': [ '-fsanitize=address' ],
'OTHER_LDFLAGS': [ '-fsanitize=address' ]
}
}],
[ 'OS == "linux"', {
'defines':
[
'_POSIX_C_SOURCE=200112',
'_GNU_SOURCE'
]
}],
[ 'OS == "linux" and mediasoup_asan == "true"', {
'cflags': [ '-fsanitize=address' ],
'ldflags': [ '-fsanitize=address' ]
}],
[ 'OS in "linux freebsd"', {
'ldflags': [ '-Wl,--whole-archive <(libopenssl) -Wl,--no-whole-archive' ]
}],
[ 'OS in "freebsd"', {
'ldflags': [ '-Wl,--export-dynamic' ]
}],
[ 'OS == "win"', {
'dependencies': [ 'deps/getopt/getopt.gyp:getopt' ],
# Handle multi files with same name.
# https://stackoverflow.com/a/22936230/2085408
# https://docs.microsoft.com/en-us/dotnet/api/microsoft.visualstudio.vcprojectengine.vcclcompilertool.objectfile?view=visualstudiosdk-2017#Microsoft_VisualStudio_VCProjectEngine_VCCLCompilerTool_ObjectFile
'msvs_settings': {
'VCCLCompilerTool': { 'ObjectFile': ['$(IntDir)\%(RelativeDir)\%(Filename).obj'], },
},
# Output Directory setting for msvc.
# https://github.com/nodejs/node-gyp/issues/1242#issuecomment-310921441
'msvs_configuration_attributes': {
'OutputDirectory': '$(SolutionDir)\\out\\$(Configuration)\\'
}
}],
[ 'OS != "win"', {
'cflags': [ '-std=c++11', '-Wall', '-Wextra', '-Wno-unused-parameter', '-Wno-implicit-fallthrough' ]
}],
[ 'OS == "mac"', {
'xcode_settings':
{
'WARNING_CFLAGS': [ '-Wall', '-Wextra', '-Wno-unused-parameter' ],
'OTHER_CPLUSPLUSFLAGS' : [ '-std=c++11' ]
}
}],
# Dependency-specifics.
[ 'sctp_debug == "true"', {
'defines': [ 'SCTP_DEBUG' ]
}]
]
},
'targets':
[
{
'target_name': 'mediasoup-worker',
'sources':
[
# C++ source files.
'src/main.cpp'
],
'defines': [ 'MS_EXECUTABLE' ]
},
{
'target_name': 'libmediasoup-worker',
'type': 'static_library'
},
{
'target_name': 'mediasoup-worker-test',
'defines': [ 'MS_LOG_STD', 'MS_TEST' ],
'sources':
[
# C++ source files.
'test/src/tests.cpp',
'test/src/RTC/TestKeyFrameRequestManager.cpp',
'test/src/RTC/TestNackGenerator.cpp',
'test/src/RTC/TestRateCalculator.cpp',
'test/src/RTC/TestRtpPacket.cpp',
'test/src/RTC/TestRtpStreamSend.cpp',
'test/src/RTC/TestRtpStreamRecv.cpp',
'test/src/RTC/TestSeqManager.cpp',
'test/src/RTC/TestTrendCalculator.cpp',
'test/src/RTC/TestRtpEncodingParameters.cpp',
'test/src/RTC/Codecs/TestVP8.cpp',
'test/src/RTC/RTCP/TestFeedbackPsAfb.cpp',
'test/src/RTC/RTCP/TestFeedbackPsFir.cpp',
'test/src/RTC/RTCP/TestFeedbackPsLei.cpp',
'test/src/RTC/RTCP/TestFeedbackPsPli.cpp',
'test/src/RTC/RTCP/TestFeedbackPsRemb.cpp',
'test/src/RTC/RTCP/TestFeedbackPsRpsi.cpp',
'test/src/RTC/RTCP/TestFeedbackPsSli.cpp',
'test/src/RTC/RTCP/TestFeedbackPsTst.cpp',
'test/src/RTC/RTCP/TestFeedbackPsVbcm.cpp',
'test/src/RTC/RTCP/TestFeedbackRtpEcn.cpp',
'test/src/RTC/RTCP/TestFeedbackRtpNack.cpp',
'test/src/RTC/RTCP/TestFeedbackRtpSrReq.cpp',
'test/src/RTC/RTCP/TestFeedbackRtpTllei.cpp',
'test/src/RTC/RTCP/TestFeedbackRtpTmmb.cpp',
'test/src/RTC/RTCP/TestFeedbackRtpTransport.cpp',
'test/src/RTC/RTCP/TestBye.cpp',
'test/src/RTC/RTCP/TestReceiverReport.cpp',
'test/src/RTC/RTCP/TestSdes.cpp',
'test/src/RTC/RTCP/TestSenderReport.cpp',
'test/src/RTC/RTCP/TestPacket.cpp',
'test/src/RTC/RTCP/TestXr.cpp',
'test/src/Utils/TestBits.cpp',
'test/src/Utils/TestIP.cpp',
'test/src/Utils/TestJson.cpp',
'test/src/Utils/TestString.cpp',
'test/src/Utils/TestTime.cpp',
# C++ include files.
'test/include/helpers.hpp'
],
'include_dirs':
[
'test/include',
'deps/catch2/single_include'
],
'xcode_settings':
{
'OTHER_CPLUSPLUSFLAGS':
[
'--coverage'
],
'OTHER_LDFLAGS': [
'--coverage'
]
}
},
{
'target_name': 'mediasoup-worker-fuzzer',
'defines': [ 'DEBUG', 'MS_LOG_STD', 'MS_TEST' ],
'sources':
[
# C++ source files.
'fuzzer/src/fuzzer.cpp',
'fuzzer/src/FuzzerUtils.cpp',
'fuzzer/src/RTC/FuzzerStunPacket.cpp',
'fuzzer/src/RTC/FuzzerRtpPacket.cpp',
'fuzzer/src/RTC/FuzzerTrendCalculator.cpp',
'fuzzer/src/RTC/RTCP/FuzzerBye.cpp',
'fuzzer/src/RTC/RTCP/FuzzerFeedbackPs.cpp',
'fuzzer/src/RTC/RTCP/FuzzerFeedbackPsAfb.cpp',
'fuzzer/src/RTC/RTCP/FuzzerFeedbackPsFir.cpp',
'fuzzer/src/RTC/RTCP/FuzzerFeedbackPsLei.cpp',
'fuzzer/src/RTC/RTCP/FuzzerFeedbackPsPli.cpp',
'fuzzer/src/RTC/RTCP/FuzzerFeedbackPsRemb.cpp',
'fuzzer/src/RTC/RTCP/FuzzerFeedbackPsRpsi.cpp',
'fuzzer/src/RTC/RTCP/FuzzerFeedbackPsSli.cpp',
'fuzzer/src/RTC/RTCP/FuzzerFeedbackPsTst.cpp',
'fuzzer/src/RTC/RTCP/FuzzerFeedbackPsVbcm.cpp',
'fuzzer/src/RTC/RTCP/FuzzerFeedbackRtp.cpp',
'fuzzer/src/RTC/RTCP/FuzzerFeedbackRtpEcn.cpp',
'fuzzer/src/RTC/RTCP/FuzzerFeedbackRtpNack.cpp',
'fuzzer/src/RTC/RTCP/FuzzerFeedbackRtpSrReq.cpp',
'fuzzer/src/RTC/RTCP/FuzzerFeedbackRtpTllei.cpp',
'fuzzer/src/RTC/RTCP/FuzzerFeedbackRtpTmmb.cpp',
'fuzzer/src/RTC/RTCP/FuzzerFeedbackRtpTransport.cpp',
'fuzzer/src/RTC/RTCP/FuzzerPacket.cpp',
'fuzzer/src/RTC/RTCP/FuzzerReceiverReport.cpp',
'fuzzer/src/RTC/RTCP/FuzzerSdes.cpp',
'fuzzer/src/RTC/RTCP/FuzzerSenderReport.cpp',
'fuzzer/src/RTC/RTCP/FuzzerXr.cpp',
# C++ include files.
'fuzzer/include/FuzzerUtils.hpp',
'fuzzer/include/RTC/FuzzerRtpPacket.hpp',
'fuzzer/include/RTC/FuzzerStunPacket.hpp',
'fuzzer/include/RTC/FuzzerTrendCalculator.hpp',
'fuzzer/include/RTC/RTCP/FuzzerBye.hpp',
'fuzzer/include/RTC/RTCP/FuzzerFeedbackPs.hpp',
'fuzzer/include/RTC/RTCP/FuzzerFeedbackPsAfb.hpp',
'fuzzer/include/RTC/RTCP/FuzzerFeedbackPsFir.hpp',
'fuzzer/include/RTC/RTCP/FuzzerFeedbackPsLei.hpp',
'fuzzer/include/RTC/RTCP/FuzzerFeedbackPsPli.hpp',
'fuzzer/include/RTC/RTCP/FuzzerFeedbackPsRemb.hpp',
'fuzzer/include/RTC/RTCP/FuzzerFeedbackPsRpsi.hpp',
'fuzzer/include/RTC/RTCP/FuzzerFeedbackPsSli.hpp',
'fuzzer/include/RTC/RTCP/FuzzerFeedbackPsTst.hpp',
'fuzzer/include/RTC/RTCP/FuzzerFeedbackPsVbcm.hpp',
'fuzzer/include/RTC/RTCP/FuzzerFeedbackRtp.hpp',
'fuzzer/include/RTC/RTCP/FuzzerFeedbackRtpEcn.hpp',
'fuzzer/include/RTC/RTCP/FuzzerFeedbackRtpNack.hpp',
'fuzzer/include/RTC/RTCP/FuzzerFeedbackRtpSrReq.hpp',
'fuzzer/include/RTC/RTCP/FuzzerFeedbackRtpTllei.hpp',
'fuzzer/include/RTC/RTCP/FuzzerFeedbackRtpTmmb.hpp',
'fuzzer/include/RTC/RTCP/FuzzerFeedbackRtpTransport.hpp',
'fuzzer/include/RTC/RTCP/FuzzerPacket.hpp',
'fuzzer/include/RTC/RTCP/FuzzerReceiverReport.hpp',
'fuzzer/include/RTC/RTCP/FuzzerSdes.hpp',
'fuzzer/include/RTC/RTCP/FuzzerSenderReport.hpp',
'fuzzer/include/RTC/RTCP/FuzzerXr.hpp',
],
'include_dirs':
[
'fuzzer/include'
],
'conditions':
[
[ 'OS == "linux"', {
'cflags': [ '-g', '-O0', '-fsanitize=address,fuzzer' ],
'ldflags': [ '-fsanitize=address,fuzzer' ]
}]
]
}
]
}
project(
'mediasoup-worker',
['c', 'cpp'],
default_options : [
'warning_level=1',
'cpp_std=c++11',
'default_library=static',
],
meson_version: '>= 0.58',
)
cpp_args = [
host_machine.endian() == 'little' ? '-DMS_LITTLE_ENDIAN' : '-DMS_BIG_ENDIAN',
]
if host_machine.system() == 'windows'
cpp_args += [
'-DNOMINMAX', # Don't define min and max macros (windows.h)
# Don't bloat namespace with incompatible winsock versions.
'-DWIN32_LEAN_AND_MEAN',
# Don't warn about usage of insecure C functions.
'-D_CRT_SECURE_NO_WARNINGS',
'-D_SCL_SECURE_NO_WARNINGS',
# Introduced in VS 2017 15.8, allow overaligned types in aligned_storage.
'-D_ENABLE_EXTENDED_ALIGNED_STORAGE',
]
endif
common_sources = [
'src/lib.cpp',
'src/DepLibSRTP.cpp',
'src/DepLibUV.cpp',
'src/DepLibWebRTC.cpp',
'src/DepOpenSSL.cpp',
'src/DepUsrSCTP.cpp',
'src/Logger.cpp',
'src/MediaSoupErrors.cpp',
'src/Settings.cpp',
'src/Worker.cpp',
'src/Utils/Crypto.cpp',
'src/Utils/File.cpp',
'src/Utils/IP.cpp',
'src/Utils/String.cpp',
'src/handles/SignalsHandler.cpp',
'src/handles/TcpConnectionHandler.cpp',
'src/handles/TcpServerHandler.cpp',
'src/handles/Timer.cpp',
'src/handles/UdpSocketHandler.cpp',
'src/handles/UnixStreamSocket.cpp',
'src/Channel/ChannelNotifier.cpp',
'src/Channel/ChannelRequest.cpp',
'src/Channel/ChannelSocket.cpp',
'src/PayloadChannel/Notification.cpp',
'src/PayloadChannel/PayloadChannelNotifier.cpp',
'src/PayloadChannel/PayloadChannelRequest.cpp',
'src/PayloadChannel/PayloadChannelSocket.cpp',
'src/RTC/ActiveSpeakerObserver.cpp',
'src/RTC/AudioLevelObserver.cpp',
'src/RTC/Consumer.cpp',
'src/RTC/DataConsumer.cpp',
'src/RTC/DataProducer.cpp',
'src/RTC/DirectTransport.cpp',
'src/RTC/DtlsTransport.cpp',
'src/RTC/IceCandidate.cpp',
'src/RTC/IceServer.cpp',
'src/RTC/KeyFrameRequestManager.cpp',
'src/RTC/NackGenerator.cpp',
'src/RTC/PipeConsumer.cpp',
'src/RTC/PipeTransport.cpp',
'src/RTC/PlainTransport.cpp',
'src/RTC/PortManager.cpp',
'src/RTC/Producer.cpp',
'src/RTC/RateCalculator.cpp',
'src/RTC/Router.cpp',
'src/RTC/RtpListener.cpp',
'src/RTC/RtpObserver.cpp',
'src/RTC/RtpPacket.cpp',
'src/RTC/RtpProbationGenerator.cpp',
'src/RTC/RtpStream.cpp',
'src/RTC/RtpStreamRecv.cpp',
'src/RTC/RtpStreamSend.cpp',
'src/RTC/RtxStream.cpp',
'src/RTC/SctpAssociation.cpp',
'src/RTC/SctpListener.cpp',
'src/RTC/SenderBandwidthEstimator.cpp',
'src/RTC/SeqManager.cpp',
'src/RTC/SimpleConsumer.cpp',
'src/RTC/SimulcastConsumer.cpp',
'src/RTC/SrtpSession.cpp',
'src/RTC/StunPacket.cpp',
'src/RTC/SvcConsumer.cpp',
'src/RTC/TcpConnection.cpp',
'src/RTC/TcpServer.cpp',
'src/RTC/Transport.cpp',
'src/RTC/TransportCongestionControlClient.cpp',
'src/RTC/TransportCongestionControlServer.cpp',
'src/RTC/TransportTuple.cpp',
'src/RTC/TrendCalculator.cpp',
'src/RTC/UdpSocket.cpp',
'src/RTC/WebRtcTransport.cpp',
'src/RTC/Codecs/H264.cpp',
'src/RTC/Codecs/VP8.cpp',
'src/RTC/Codecs/VP9.cpp',
'src/RTC/RtpDictionaries/Media.cpp',
'src/RTC/RtpDictionaries/Parameters.cpp',
'src/RTC/RtpDictionaries/RtcpFeedback.cpp',
'src/RTC/RtpDictionaries/RtcpParameters.cpp',
'src/RTC/RtpDictionaries/RtpCodecMimeType.cpp',
'src/RTC/RtpDictionaries/RtpCodecParameters.cpp',
'src/RTC/RtpDictionaries/RtpEncodingParameters.cpp',
'src/RTC/RtpDictionaries/RtpHeaderExtensionParameters.cpp',
'src/RTC/RtpDictionaries/RtpHeaderExtensionUri.cpp',
'src/RTC/RtpDictionaries/RtpParameters.cpp',
'src/RTC/RtpDictionaries/RtpRtxParameters.cpp',
'src/RTC/SctpDictionaries/SctpStreamParameters.cpp',
'src/RTC/RTCP/Packet.cpp',
'src/RTC/RTCP/CompoundPacket.cpp',
'src/RTC/RTCP/SenderReport.cpp',
'src/RTC/RTCP/ReceiverReport.cpp',
'src/RTC/RTCP/Sdes.cpp',
'src/RTC/RTCP/Bye.cpp',
'src/RTC/RTCP/Feedback.cpp',
'src/RTC/RTCP/FeedbackPs.cpp',
'src/RTC/RTCP/FeedbackRtp.cpp',
'src/RTC/RTCP/FeedbackRtpNack.cpp',
'src/RTC/RTCP/FeedbackRtpTmmb.cpp',
'src/RTC/RTCP/FeedbackRtpSrReq.cpp',
'src/RTC/RTCP/FeedbackRtpTllei.cpp',
'src/RTC/RTCP/FeedbackRtpEcn.cpp',
'src/RTC/RTCP/FeedbackRtpTransport.cpp',
'src/RTC/RTCP/FeedbackPsPli.cpp',
'src/RTC/RTCP/FeedbackPsSli.cpp',
'src/RTC/RTCP/FeedbackPsRpsi.cpp',
'src/RTC/RTCP/FeedbackPsFir.cpp',
'src/RTC/RTCP/FeedbackPsTst.cpp',
'src/RTC/RTCP/FeedbackPsVbcm.cpp',
'src/RTC/RTCP/FeedbackPsLei.cpp',
'src/RTC/RTCP/FeedbackPsAfb.cpp',
'src/RTC/RTCP/FeedbackPsRemb.cpp',
'src/RTC/RTCP/XR.cpp',
'src/RTC/RTCP/XrDelaySinceLastRr.cpp',
'src/RTC/RTCP/XrReceiverReferenceTime.cpp',
]
cpp = meson.get_compiler('cpp')
openssl_proj = subproject(
'openssl',
default_options: [
'warning_level=0',
],
)
nlohmann_json_proj = subproject(
'nlohmann_json',
default_options: [
'warning_level=0',
],
)
libuv_proj = subproject(
'libuv',
default_options: [
'warning_level=0',
'build_tests=false',
'build_benchmarks=false',
],
)
libsrtp2_proj = subproject(
'libsrtp2',
default_options: [
'warning_level=0',
'crypto-library=openssl',
'crypto-library-kdf=disabled',
'tests=disabled',
],
)
usrsctp_proj = subproject(
'usrsctp',
default_options: [
'warning_level=0',
'sctp_build_programs=false',
],
)
abseil_cpp_proj = subproject(
'abseil-cpp',
default_options: [
'warning_level=0',
],
)
libwebrtc_include_directories = include_directories('include')
subdir('deps/libwebrtc')
dependencies = [
openssl_proj.get_variable('openssl_dep'),
nlohmann_json_proj.get_variable('nlohmann_json_dep'),
libuv_proj.get_variable('libuv_dep'),
libsrtp2_proj.get_variable('libsrtp2_dep'),
usrsctp_proj.get_variable('usrsctp_dep'),
libwebrtc_dep,
]
link_whole = [
openssl_proj.get_variable('libcrypto_lib'),
openssl_proj.get_variable('libssl_lib'),
libuv_proj.get_variable('libuv'),
libsrtp2_proj.get_variable('libsrtp2'),
usrsctp_proj.get_variable('usrsctp'),
libwebrtc,
]
if host_machine.system() == 'windows'
wingetopt_proj = subproject(
'wingetopt',
default_options: [
'warning_level=0',
],
)
dependencies += [
wingetopt_proj.get_variable('wingetopt_dep'),
]
link_whole += [
wingetopt_proj.get_variable('wingetopt_lib'),
]
endif
libmediasoup_worker = library(
'libmediasoup-worker',
name_prefix: '',
build_by_default: false,
dependencies: dependencies,
sources: common_sources,
include_directories: include_directories('include'),
cpp_args: cpp_args,
link_whole: link_whole,
)
executable(
'mediasoup-worker',
build_by_default: true,
dependencies: dependencies,
sources: common_sources + ['src/main.cpp'],
include_directories: include_directories('include'),
cpp_args: cpp_args + ['-DMS_EXECUTABLE'],
)
mediasoup_worker_test = executable(
'mediasoup-worker-test',
build_by_default: false,
dependencies: dependencies + [
dependency('catch2'),
],
sources: common_sources + [
'test/src/tests.cpp',
'test/src/RTC/TestKeyFrameRequestManager.cpp',
'test/src/RTC/TestNackGenerator.cpp',
'test/src/RTC/TestRateCalculator.cpp',
'test/src/RTC/TestRtpPacket.cpp',
'test/src/RTC/TestRtpStreamSend.cpp',
'test/src/RTC/TestRtpStreamRecv.cpp',
'test/src/RTC/TestSeqManager.cpp',
'test/src/RTC/TestTrendCalculator.cpp',
'test/src/RTC/TestRtpEncodingParameters.cpp',
'test/src/RTC/Codecs/TestVP8.cpp',
'test/src/RTC/RTCP/TestFeedbackPsAfb.cpp',
'test/src/RTC/RTCP/TestFeedbackPsFir.cpp',
'test/src/RTC/RTCP/TestFeedbackPsLei.cpp',
'test/src/RTC/RTCP/TestFeedbackPsPli.cpp',
'test/src/RTC/RTCP/TestFeedbackPsRemb.cpp',
'test/src/RTC/RTCP/TestFeedbackPsRpsi.cpp',
'test/src/RTC/RTCP/TestFeedbackPsSli.cpp',
'test/src/RTC/RTCP/TestFeedbackPsTst.cpp',
'test/src/RTC/RTCP/TestFeedbackPsVbcm.cpp',
'test/src/RTC/RTCP/TestFeedbackRtpEcn.cpp',
'test/src/RTC/RTCP/TestFeedbackRtpNack.cpp',
'test/src/RTC/RTCP/TestFeedbackRtpSrReq.cpp',
'test/src/RTC/RTCP/TestFeedbackRtpTllei.cpp',
'test/src/RTC/RTCP/TestFeedbackRtpTmmb.cpp',
'test/src/RTC/RTCP/TestFeedbackRtpTransport.cpp',
'test/src/RTC/RTCP/TestBye.cpp',
'test/src/RTC/RTCP/TestReceiverReport.cpp',
'test/src/RTC/RTCP/TestSdes.cpp',
'test/src/RTC/RTCP/TestSenderReport.cpp',
'test/src/RTC/RTCP/TestPacket.cpp',
'test/src/RTC/RTCP/TestXr.cpp',
'test/src/Utils/TestBits.cpp',
'test/src/Utils/TestIP.cpp',
'test/src/Utils/TestJson.cpp',
'test/src/Utils/TestString.cpp',
'test/src/Utils/TestTime.cpp',
],
include_directories: include_directories(
'include',
'test/include',
),
cpp_args: cpp_args + [
'-DMS_LOG_STD',
'-DMS_TEST',
],
)
test(
'mediasoup-worker-test',
mediasoup_worker_test,
workdir: meson.source_root(),
)
if host_machine.system() == 'linux'
executable(
'mediasoup-worker-fuzzer',
build_by_default: false,
dependencies: dependencies,
sources: common_sources + [
'fuzzer/src/fuzzer.cpp',
'fuzzer/src/FuzzerUtils.cpp',
'fuzzer/src/RTC/FuzzerStunPacket.cpp',
'fuzzer/src/RTC/FuzzerRtpPacket.cpp',
'fuzzer/src/RTC/FuzzerTrendCalculator.cpp',
'fuzzer/src/RTC/RTCP/FuzzerBye.cpp',
'fuzzer/src/RTC/RTCP/FuzzerFeedbackPs.cpp',
'fuzzer/src/RTC/RTCP/FuzzerFeedbackPsAfb.cpp',
'fuzzer/src/RTC/RTCP/FuzzerFeedbackPsFir.cpp',
'fuzzer/src/RTC/RTCP/FuzzerFeedbackPsLei.cpp',
'fuzzer/src/RTC/RTCP/FuzzerFeedbackPsPli.cpp',
'fuzzer/src/RTC/RTCP/FuzzerFeedbackPsRemb.cpp',
'fuzzer/src/RTC/RTCP/FuzzerFeedbackPsRpsi.cpp',
'fuzzer/src/RTC/RTCP/FuzzerFeedbackPsSli.cpp',
'fuzzer/src/RTC/RTCP/FuzzerFeedbackPsTst.cpp',
'fuzzer/src/RTC/RTCP/FuzzerFeedbackPsVbcm.cpp',
'fuzzer/src/RTC/RTCP/FuzzerFeedbackRtp.cpp',
'fuzzer/src/RTC/RTCP/FuzzerFeedbackRtpEcn.cpp',
'fuzzer/src/RTC/RTCP/FuzzerFeedbackRtpNack.cpp',
'fuzzer/src/RTC/RTCP/FuzzerFeedbackRtpSrReq.cpp',
'fuzzer/src/RTC/RTCP/FuzzerFeedbackRtpTllei.cpp',
'fuzzer/src/RTC/RTCP/FuzzerFeedbackRtpTmmb.cpp',
'fuzzer/src/RTC/RTCP/FuzzerFeedbackRtpTransport.cpp',
'fuzzer/src/RTC/RTCP/FuzzerPacket.cpp',
'fuzzer/src/RTC/RTCP/FuzzerReceiverReport.cpp',
'fuzzer/src/RTC/RTCP/FuzzerSdes.cpp',
'fuzzer/src/RTC/RTCP/FuzzerSenderReport.cpp',
'fuzzer/src/RTC/RTCP/FuzzerXr.cpp',
],
include_directories: include_directories(
'include',
'fuzzer/include',
),
cpp_args: cpp_args + [
'-g',
'-O0',
'-fsanitize=address,fuzzer',
'-DMS_LOG_STD',
],
link_args: [
'-fsanitize=address,fuzzer',
],
)
endif
#!/usr/bin/env python
#
# Script inspired in bud:
# https://github.com/indutny/bud
#
import platform
import os
import subprocess
import sys
CC = os.environ.get('CC', 'cc')
script_dir = os.path.dirname(__file__)
root = os.path.normpath(os.path.join(script_dir, '..'))
output_dir = os.environ.get('MEDIASOUP_OUT_DIR', os.path.join(os.path.abspath(root), 'out'))
sys.path.insert(0, os.path.join(root, 'deps', 'gyp', 'pylib'))
try:
import gyp
except ImportError:
print('Error: you need to install gyp in deps/gyp first, run:')
print(' ./scripts/get-dep.sh gyp')
sys.exit(42)
def host_arch():
machine = platform.machine()
if machine == 'i386': return 'ia32'
if machine == 'x86_64': return 'x64'
if machine == 'AMD64': return 'x64'
if machine == 'aarch64': return 'arm64'
if machine == 'arm64': return 'arm64'
if machine == 'mips64': return 'mips64el'
if machine.startswith('arm'): return 'arm'
if machine.startswith('mips'): return 'mips'
return machine # Return as-is and hope for the best.
def compiler_version():
proc = subprocess.Popen(CC.split() + ['--version'], stdout=subprocess.PIPE)
is_clang = b'clang' in proc.communicate()[0].split(b'\n')[0]
proc = subprocess.Popen(CC.split() + ['-dumpversion'], stdout=subprocess.PIPE)
version = proc.communicate()[0].split(b'.')
mayor_version = int(version[:1][0])
if is_clang is False and mayor_version >= 7:
proc = subprocess.Popen(CC.split() + ['-dumpfullversion'], stdout=subprocess.PIPE)
version = proc.communicate()[0].split(b'.')
version = map(int, version[:2])
version = tuple(version)
return (version, is_clang)
def run_gyp(args):
rc = gyp.main(args)
if rc != 0:
print('Error running GYP')
sys.exit(rc)
if __name__ == '__main__':
args = sys.argv[1:]
# GYP bug.
# On msvs it will crash if it gets an absolute path.
# On Mac/make it will crash if it doesn't get an absolute path.
# NOTE ibc: Not sure that it requires absolute path in Mac/make...
if sys.platform == 'win32':
args.append(os.path.join(root, 'mediasoup-worker.gyp'))
common_fn = os.path.join(root, 'common.gypi')
# we force vs 2010 over 2008 which would otherwise be the default for gyp.
if not os.environ.get('GYP_MSVS_VERSION'):
os.environ['GYP_MSVS_VERSION'] = '2010'
else:
args.append(os.path.join(os.path.abspath(root), 'mediasoup-worker.gyp'))
common_fn = os.path.join(os.path.abspath(root), 'common.gypi')
if os.path.exists(common_fn):
args.extend(['-I', common_fn])
args.append('--depth=' + root)
# There's a bug with windows which doesn't allow this feature.
if sys.platform != 'win32':
if '-f' not in args:
args.extend('-f make'.split())
if 'ninja' not in args:
args.extend(['-Goutput_dir=' + output_dir])
args.extend(['--generator-output', output_dir])
(major, minor), is_clang = compiler_version()
args.append('-Dgcc_version=%d' % (10 * major + minor))
args.append('-Dclang=%d' % int(is_clang))
if is_clang is False and major == 4 and minor <= 8:
raise RuntimeError('gcc <= 4.8 not supported, please upgrade your gcc')
if not any(a.startswith('-Dhost_arch=') for a in args):
args.append('-Dhost_arch=%s' % host_arch())
if not any(a.startswith('-Dtarget_arch=') for a in args):
args.append('-Dtarget_arch=%s' % host_arch())
if any(a.startswith('-Dopenssl_fips=') for a in args):
fips_fn = os.path.join(os.path.abspath(root), 'fips.gypi')
args.extend(['-I', fips_fn])
else:
args.append('-Dopenssl_fips=')
if 'asan' in args:
args.append('-Dmediasoup_asan=true')
args = filter(lambda arg: arg != 'asan', args)
else:
args.append('-Dmediasoup_asan=false')
args.append('-Dnode_byteorder=' + sys.byteorder)
gyp_args = list(args)
print(gyp_args)
run_gyp(gyp_args)
[wrap-file]
directory = abseil-cpp-20210324.2
source_url = https://github.com/abseil/abseil-cpp/archive/20210324.2.tar.gz
source_filename = abseil-cpp-20210324.2.tar.gz
source_hash = 59b862f50e710277f8ede96f083a5bb8d7c9595376146838b9580be90374ee1f
patch_filename = abseil-cpp_20210324.2-1_patch.zip
patch_url = https://wrapdb.mesonbuild.com/v2/abseil-cpp_20210324.2-1/get_patch
patch_hash = d933b97e008dad25166271f06814865756987f62765f8d40371322785ecb45e0
[provide]
absl_base = absl_base_dep
absl_container = absl_container_dep
absl_debugging = absl_debugging_dep
absl_flags = absl_flags_dep
absl_hash = absl_hash_dep
absl_numeric = absl_numeric_dep
absl_random = absl_random_dep
absl_status = absl_status_dep
absl_strings = absl_strings_dep
absl_synchronization = absl_synchronization_dep
absl_time = absl_time_dep
absl_types = absl_types_dep
[wrap-file]
directory = Catch2-2.13.7
source_url = https://github.com/catchorg/Catch2/archive/v2.13.7.zip
source_filename = Catch2-2.13.7.zip
source_hash = 3f3ccd90ad3a8fbb1beeb15e6db440ccdcbebe378dfd125d07a1f9a587a927e9
patch_filename = catch2_2.13.7-1_patch.zip
patch_url = https://wrapdb.mesonbuild.com/v2/catch2_2.13.7-1/get_patch
patch_hash = 2f7369645d747e5bd866317ac1dd4c3d04dc97d3aad4fc6b864bdf75d3b57158
[provide]
catch2 = catch2_dep
[wrap-file]
directory = libsrtp-2.4.2
source_url = https://github.com/cisco/libsrtp/archive/refs/tags/v2.4.2.zip
source_filename = libsrtp-2.4.2.zip
source_hash = 35b1ae7a6256224feb058f1feb42170537a44896340f80e77b49cc59af686a82
[provide]
libsrtp2 = libsrtp2_dep
[wrap-file]
directory = libuv-v1.41.0
source_url = https://dist.libuv.org/dist/v1.41.0/libuv-v1.41.0.tar.gz
source_filename = libuv-v1.41.0.tar.gz
source_hash = 1184533907e1ddad9c0dcd30a5abb0fe25288c287ff7fee303fff7b9b2d6eb6e
patch_url = https://wrapdb.mesonbuild.com/v2/libuv_1.41.0-1/get_patch
patch_filename = libuv-1.41.0-1-wrap.zip
patch_hash = 66cab50ca1f002d823a2015611c08401b69d6f7c1ecd0059cb6afd34e1138b40
[provide]
libuv = libuv_dep
[wrap-file]
directory = nlohmann_json-3.9.1
lead_directory_missing = true
source_url = https://github.com/nlohmann/json/releases/download/v3.9.1/include.zip
source_filename = nlohmann_json-3.9.1.zip
source_hash = 6bea5877b1541d353bd77bdfbdb2696333ae5ed8f9e8cc22df657192218cad91
patch_url = https://wrapdb.mesonbuild.com/v2/nlohmann_json_3.9.1-1/get_patch
patch_filename = nlohmann_json-3.9.1-1-wrap.zip
patch_hash = 1774e5506fbe3897d652f67e41973194b948d2ab851cf464a742f35f160a1435
[provide]
nlohmann_json = nlohmann_json_dep
[wrap-file]
directory = openssl-1.1.1l
source_url = https://www.openssl.org/source/openssl-1.1.1l.tar.gz
source_filename = openssl-1.1.1l.tar.gz
source_hash = 0b7a3e5e59c34827fe0c3a74b7ec8baef302b98fa80088d7f9153aa16fa76bd1
patch_filename = openssl_1.1.1l-1_patch.zip
patch_url = https://wrapdb.mesonbuild.com/v2/openssl_1.1.1l-1/get_patch
patch_hash = 670db31580039e06c17f48bcd31e489f453fe72c22006de6d693b9b033f1003a
[provide]
libcrypto = libcrypto_dep
libssl = libssl_dep
openssl = openssl_dep
project(
'wingetopt',
'c',
version: '0.95',
license : ['ISC', 'BSD-3-Clause'],
meson_version: '>= 0.55',
default_options: [
'warning_level=1',
],
)
compiler = meson.get_compiler('c')
c_args = []
if compiler.get_id() == 'msvc'
c_args += [
'-D_CRT_SECURE_NO_WARNINGS',
]
if get_option('default_library') == 'shared'
c_args += [
'-DBUILDING_WINGETOPT_DLL',
'-DWINGETOPT_SHARED_LIB',
]
endif
endif
wingetopt_lib = library(
'wingetopt',
'src/getopt.c',
include_directories: include_directories(
'src',
),
c_args: c_args,
)
wingetopt_dep = declare_dependency(
link_with: wingetopt_lib,
include_directories: include_directories(
'src',
),
)
[wrap-file]
directory = usrsctp-9d6b99b10a70f7a63d21cd80d03c353da9ac19d3
source_url = https://github.com/sctplab/usrsctp/archive/9d6b99b10a70f7a63d21cd80d03c353da9ac19d3.zip
source_filename = 9d6b99b10a70f7a63d21cd80d03c353da9ac19d3.zip
source_hash = d9b7b3350ea0be2a3d1437e404d4852df741c4984b734729c5edc337ff4b7611
[provide]
usrsctp = usrsctp_dep
[wrap-file]
directory = wingetopt-0.95
source_url = https://github.com/alex85k/wingetopt/archive/v0.95.zip
source_filename = wingetopt-0.95.zip
source_hash = 7b535dd753b93446539504a76cd561282e9a8a9969fe06e0d8691fc3048987c5
patch_directory = wingetopt
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论