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

Improve building system.

上级 1c0955d3
...@@ -7,6 +7,10 @@ This document is intended for **mediasoup** developers. ...@@ -7,6 +7,10 @@ This document is intended for **mediasoup** developers.
The root folder of the project contains a `Makefile` to build the mediasoup worker subproject (under the `worker/` folder). The root folder of the project contains a `Makefile` to build the mediasoup worker subproject (under the `worker/` folder).
### `make`
The default task runs the `Release` task unless the environment `MEDIASOUP_BUILDTYPE` is set to `Debug` (if so it runs the `Debug` task).
### `make Release` ### `make Release`
Builds the production ready mediasoup worker binary at `worker/out/Release/`. This is the binary used in production when installing the **mediasoup** NPM module with `npm install mediasoup`. Builds the production ready mediasoup worker binary at `worker/out/Release/`. This is the binary used in production when installing the **mediasoup** NPM module with `npm install mediasoup`.
...@@ -25,8 +29,16 @@ $ MEDIASOUP_BUILDTYPE=Debug node myapp.js ...@@ -25,8 +29,16 @@ $ MEDIASOUP_BUILDTYPE=Debug node myapp.js
### `make test` ### `make test`
Runs the `test-Release` task unless the environment `MEDIASOUP_BUILDTYPE` is set to `Debug` (if so it runs the `test-Debug` task).
### `make test-Release`
Builds the `mediasoup-worker-test` test unit binary at `worker/out/Release/`. Builds the `mediasoup-worker-test` test unit binary at `worker/out/Release/`.
### `make test-Debug`
Builds the `mediasoup-worker-test` test unit binary in `Debug` mode at `worker/out/Debug/`.
### `make xcode` ### `make xcode`
Builds a Xcode project for the mediasoup worker subproject. Builds a Xcode project for the mediasoup worker subproject.
...@@ -39,10 +51,6 @@ Cleans objects and binaries related to the mediasoup worker. ...@@ -39,10 +51,6 @@ Cleans objects and binaries related to the mediasoup worker.
Cleans all the objects and binaries, including those generated for library dependencies (such as libuv, openssl and libsrtp). Cleans all the objects and binaries, including those generated for library dependencies (such as libuv, openssl and libsrtp).
### `make`
The default task runs the `Release` task unless the environment `MEDIASOUP_BUILDTYPE` is set to `Debug` (if so it runs the `Debug` task).
## gulpfile.js ## gulpfile.js
...@@ -69,13 +77,19 @@ Runs the JavaScript [test units](test/). Before it, it invokes the `make` comman ...@@ -69,13 +77,19 @@ Runs the JavaScript [test units](test/). Before it, it invokes the `make` comman
In order to run the JavaScript test units with the mediasoup worker in `Debug` mode the `MEDIASOUP_BUILDTYPE` environment variable must be set to `Debug`: In order to run the JavaScript test units with the mediasoup worker in `Debug` mode the `MEDIASOUP_BUILDTYPE` environment variable must be set to `Debug`:
```bash ```bash
$ MEDIASOUP_BUILDTYPE=Debug gulp test:debug $ MEDIASOUP_BUILDTYPE=Debug gulp test:api
``` ```
### `gulp test:worker` ### `gulp test:worker`
Runs the mediasoup worker [test units](worker/test/). Before it, it invokes the `make test` command. Runs the mediasoup worker [test units](worker/test/). Before it, it invokes the `make test` command.
In order to run the worker test units with the mediasoup worker in `Debug` mode the `MEDIASOUP_BUILDTYPE` environment variable must be set to `Debug`:
```bash
$ MEDIASOUP_BUILDTYPE=Debug gulp test:worker
```
### `gulp test` ### `gulp test`
Runs both the `test:api` and `test:worker` gulp tasks. Runs both the `test:api` and `test:worker` gulp tasks.
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
# environment variable set by the user. # environment variable set by the user.
PYTHON?=$(type -p python2 || echo python) PYTHON?=$(type -p python2 || echo python)
.PHONY: default Release Debug test xcode clean clean-all .PHONY: default Release Debug test test-Release test-Debug xcode clean clean-all
default: default:
ifeq ($(MEDIASOUP_BUILDTYPE),Debug) ifeq ($(MEDIASOUP_BUILDTYPE),Debug)
...@@ -24,9 +24,20 @@ Debug: ...@@ -24,9 +24,20 @@ Debug:
$(MAKE) BUILDTYPE=Debug -C worker/out $(MAKE) BUILDTYPE=Debug -C worker/out
test: test:
ifeq ($(MEDIASOUP_BUILDTYPE),Debug)
make test-Debug
else
make test-Release
endif
test-Release:
cd worker && $(PYTHON) ./scripts/configure.py -R mediasoup-worker-test cd worker && $(PYTHON) ./scripts/configure.py -R mediasoup-worker-test
$(MAKE) BUILDTYPE=Release -C worker/out $(MAKE) BUILDTYPE=Release -C worker/out
test-Debug:
cd worker && $(PYTHON) ./scripts/configure.py -R mediasoup-worker-test
$(MAKE) BUILDTYPE=Debug -C worker/out
xcode: xcode:
cd worker && $(PYTHON) ./scripts/configure.py --format=xcode cd worker && $(PYTHON) ./scripts/configure.py --format=xcode
......
...@@ -60,7 +60,7 @@ gulp.task('test:api', shell.task( ...@@ -60,7 +60,7 @@ gulp.task('test:api', shell.task(
gulp.task('test:worker', shell.task( gulp.task('test:worker', shell.task(
[ [
'if type make &> /dev/null; then make test; fi', 'if type make &> /dev/null; then make test; fi',
'cd worker && ./out/Release/mediasoup-worker-test --invisibles --use-colour=yes' `cd worker && ./out/${process.env.MEDIASOUP_BUILDTYPE === 'Debug' ? 'Debug' : 'Release'}/mediasoup-worker-test --invisibles --use-colour=yes`
], ],
{ {
verbose : true verbose : true
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论